Last active
February 6, 2020 20:13
-
-
Save dalehamel/43a6d96c63ef4adfd648c0862eb5a727 to your computer and use it in GitHub Desktop.
install kernel headers for docker desktop, for BCC
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 | |
set -x | |
set -e | |
KERNEL_VERSION="${KERNEL_VERSION:-$(uname -r)}" | |
kernel_version="$(echo "${KERNEL_VERSION}" | awk -vFS=- '{ print $1 }')" | |
major_version="$(echo "${KERNEL_VERSION}" | awk -vFS=. '{ print $1 }')" | |
apt-get install -y build-essential bc curl flex bison libelf-dev | |
mkdir -p /usr/src/linux | |
curl -sL "https://www.kernel.org/pub/linux/kernel/v${major_version}.x/linux-$kernel_version.tar.gz" | tar --strip-components=1 -xzf - -C /usr/src/linux | |
cd /usr/src/linux | |
zcat /proc/config.gz > .config | |
make ARCH=x86 oldconfig | |
make ARCH=x86 prepare | |
mkdir -p /lib/modules/$(uname -r) | |
ln -sf /usr/src/linux /lib/modules/$(uname -r)/source | |
ln -sf /usr/src/linux /lib/modules/$(uname -r)/build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tested against latest docker stable (2.2.0) with kernel 4.19