Created
August 26, 2018 22:50
-
-
Save dabukalam/9aad7405cb8b851343e1b7d4b7acb1b4 to your computer and use it in GitHub Desktop.
Scaleway custom kernel module script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Determine versions | |
arch="$(uname -m)" | |
release="$(uname -r)" | |
upstream="${release%%-*}" | |
local="${release#*-}" | |
# Get kernel sources | |
mkdir -p /usr/src | |
wget -O "/usr/src/linux-${upstream}.tar.xz" "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${upstream}.tar.xz" | |
tar xf "/usr/src/linux-${upstream}.tar.xz" -C /usr/src/ | |
ln -fns "/usr/src/linux-${upstream}" /usr/src/linux | |
ln -fns "/usr/src/linux-${upstream}" "/lib/modules/${release}/build" | |
# Prepare kernel | |
zcat /proc/config.gz > /usr/src/linux/.config | |
printf 'CONFIG_LOCALVERSION="%s"\nCONFIG_CROSS_COMPILE=""\n' "${local:+-$local}" >> /usr/src/linux/.config | |
wget -O /usr/src/linux/Module.symvers "http://mirror.scaleway.com/kernel/${arch}/${release}/Module.symvers" | |
apt-get install -y libssl-dev # adapt to your package manager | |
make -C /usr/src/linux prepare modules_prepare |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment