Skip to content

Instantly share code, notes, and snippets.

@christovic
Last active July 7, 2020 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christovic/5890340d282e4bac6859382042d25e31 to your computer and use it in GitHub Desktop.
Save christovic/5890340d282e4bac6859382042d25e31 to your computer and use it in GitHub Desktop.
Enabling WireGuard on a Raspberry Pi with 64-bit kernel
sudo apt install -y zip git wget
mkdir ubuntu; cd ubuntu
function post_chroot {
cat <<EOT >> build.sh
apt update
apt-get install -y libelf-dev build-essential pkg-config bc bison flex libssl-dev kmod
cd linux-raspberrypi-kernel_1.20200512-2
make bcm2711_defconfig
make prepare
make scripts
cd ../wireguard-linux-compat/src/
make -C /linux-raspberrypi-kernel_1.20200512-2 M=$PWD modules
exit
EOT
sudo chmod +x build.sh
}
post_chroot
wget http://cdimage.ubuntu.com/ubuntu-base/daily/current/groovy-base-arm64.tar.gz
tar -xzf groovy-base-arm64.tar.gz
wget https://github.com/raspberrypi/linux/archive/raspberrypi-kernel_1.20200512-2.zip
unzip raspberrypi-kernel_1.20200512-2.zip
git clone https://git.zx2c4.com/wireguard-linux-compat
cat /etc/resolv.conf > etc/resolv.conf
sudo mount -B /dev dev
sudo mount -B /proc proc
sudo mount -B /sys sys
sudo mount -t tmpfs tmp tmp
sudo chroot . ./build.sh
sudo cp wireguard-linux-compat/src/wireguard.ko /lib/modules/4.19.118-v8+/wireguard.ko
modprobe wireguard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment