Compile Linux Headers for Wireguard


(onon) #1

Hello,

I’m trying to make Wireguard to work on Banana PI R2.

I’ve compiled the Linux kernel with the appropriate kernel modules (https://www.wireguard.com/install/#kernel-requirements) using @frank-w build tool.

However, when installing the wireguard I get the following message: Building for 4.14.69-bpi-r2-main, 4.15.0-34-generic and 4.4.70-BPI-R2-Kernel Module build for kernel 4.14.69-bpi-r2-main was skipped since the kernel headers for this kernel does not seem to be installed.

And my question is how can I get the headers on the kernel? I’ve tried a few variants while compiling, but none seems to work.


(Frank W.) #2

try to clone my github-repo to your r2 and create a link in /lib/modules/$(uname -r)/source to the git-folder


(onon) #3

Thanks. Gonna try it now.


(onon) #4

So, I had to create a symlink to build too instead of just source so that wireguard would stop throwing that error while installing (from the message before) .

But now, I got the following:

ERROR (dkms apport): kernel package linux-headers-4.14.69-bpi-r2-main is not supported
Error! Bad return status for module build on kernel: 4.14.69-bpi-r2-main (armv7l)
Consult /var/lib/dkms/wireguard/0.0.20180910/build/make.log for more information.

The contents for that file are attached.wireguard.log (2.6 KB)

Any help is appreciate


(Frank W.) #5
  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

Try to run build.sh importconfig before running wireguard-buildscript

else it seems your symlink is wrong or not used.


(onon) #6

Yep. I just rebuild the kernel to make sure all wireguard modules needed were added and they are.

I also rechecked the symlinks and they seem OK:

 lrwxrwxrwx  1 root root    19 Sep 18 03:01 build -> /stuff/BPI-R2-4.14/
 lrwxrwxrwx  1 root root    19 Sep 18 03:01 source -> /stuff/BPI-R2-4.14/

Note that I’m not compiling the kernel on the BPI-R2. Could that be the reason for be failing?


(onon) #7

Note that I’m not compiling the kernel on the BPI-R2. Could that be the reason for be failing?

Yeah, after compiling everything on the BPI and then creating the symlink, Wireguard was able to install without error. However, it is still failing (not loading anything) and I’m still investigating…

That’s the only error I’m seeing for now.

root@bpi-iot-ros-ai:/stuff/BPI-R2-4.14# ip link add dev wg0 type wireguard
RTNETLINK answers: Operation not supported

Any help is appreciated.


(Frank W.) #8

anything in dmesg/syslog?


(onon) #9

On dmesg as well on syslog:

[ 347.425411] wireguard: version magic '4.14.70-bpi-r2-main SMP mod_unload ARMv7 p2v8 ’ should be '4.14.69-bpi-r2-main SMP mod_unload ARMv7 p2v8 ’

So, somewhere it is saying 4.14.70???


(Frank W.) #10

Because your code is already 4.14.70,but compiled kernel still 4.14.69

You can get running kernel with “uname -r” and source-version in source-folder via “make kernelversion”


(onon) #11

Yeah, I noticed that after posting the reply and fixed that.

However, I’m still getting

root@bpi-iot-ros-ai:/home/pi# ip link add dev wg0 type wireguard
RTNETLINK answers: Operation not supported

But now nothing on logs. So, any new ideas is appreciated =)

EDIT: I have to reinstall rebuild wireguard. I will come with the results in a few minutes


(onon) #12

You are the genius @frank-w!

After reinstalling wireguard, it worked!!!

Hopefully @sinovoip is paying you enough for being that awesome!


(Frank W.) #13

I don’t get payed for it. I’ve got one of my 2 r2 boards for free and maybe an r64/mt7615-module. Most things i do is to get my r2 running as well as i can and simply share my work.