[Rock64] Cannot install wireguard module on Ubuntu 18.04

Recommended Posts



I've built the Ubuntu 18.04 image with legacy kernel (4.4) and tried to install wireguard.

The problem was the kernel module which seems to be build by dkms.

I've installed kernel headers from the linux-headers-rk3328_5.44_arm64.deb (built by armbian's build procedure) and tried to install wireguard-dkms package.

It fails:

Unpacking wireguard-dkms (0.0.20180513-wg1~bionic) over (0.0.20180513-wg1~bionic) ...
Setting up wireguard-dkms (0.0.20180513-wg1~bionic) ...
Loading new wireguard-0.0.20180513 DKMS files...
Building for 4.4.131-rk3328
Building initial module for 4.4.131-rk3328
Error! Bad return status for module build on kernel: 4.4.131-rk3328 (aarch64)
Consult /var/lib/dkms/wireguard/0.0.20180513/build/make.log for more information.

The content of make.log

DKMS make.log for wireguard-0.0.20180513 for kernel 4.4.131-rk3328 (aarch64)
Thu May 17 21:24:11 UTC 2018
make: Entering directory '/usr/src/linux-headers-4.4.131-rk3328'
Makefile:643: arch//Makefile: No such file or directory
make: *** No rule to make target 'arch//Makefile'.  Stop.
make: Leaving directory '/usr/src/linux-headers-4.4.131-rk3328'

The line 643 is

include arch/$(SRCARCH)/Makefile

so SRCARCH is not set for some reason. Any suggestions how to fix it?


Also I've tired to build wireguard module manually with dkms and/or from source. In both cases it fails because of absent scripts/recordmcount.

I've tried to build that stuff with 'make scripts' in the /usr/src/linux-headers-4.4.131-rk3328 and this fails too:

  HOSTCC  scripts/selinux/genheaders/genheaders
scripts/selinux/genheaders/genheaders.c:13:10: fatal error: classmap.h: No such file or directory
 #include "classmap.h"

This classmap.h exists in the kernel source tree, but was not included into kernel-headers deb. Do I need to fix something in kernel makefiles?

Share this post

Link to post
Share on other sites

I've managed to build/install kernel headers correctly and build the wireguard manually. 

Here the is patch I've added to include absent headers (created a userpatches/kernel/rk3328-default/add_more_headers.patch), borrowed from https://github.com/armbian/build/commit/98fca07d8906555ebd419e2cd3eb2a5c0af80298

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index b3ed160b..b776402f 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -323,6 +405,7 @@ fi
 # Build kernel header package
 (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
 (cd $srctree; find arch/*/include include scripts -type f) >> "$objtree/debian/hdrsrcfiles"
+(cd $srctree; find security -type f -name \*.h) >> "$objtree/debian/hdrsrcfiles"
 (cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
 (cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
 (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"

This unfortunately does not fix the issue with dkms build (empty $SRCARCH), but build from sources is successful.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now