How to make a package of linux-headers for BPI-R2 4.14.X kernel


(victors) #1

To compile kernel modules (for example wireguard) needed package linux-headers-$(uname -r). In precompiled and compiled from repository kernels for BPI-R2 headers are absent. Accordingly, the question is how to build and install this package.


(Frank W.) #2

is wireguard checking for the package or source in /usr/src/linux-headers-$(uname -r)?

if you use my github-releases there is a source-package which you can extract to /usr/src/linux-headers-$(uname -r)

maybe you can use this to compile additional modules


(victors) #3

Dear Frank-w, the archive you specified weighs 950 Mb. Package from Armbian 10 Mb. Clearly the whole is not needed, can it be reduced? Is it possible copy to /usr/src/linux-headers-$(uname -r) not all , but only necessary part for compile.


(Frank W.) #4

Wow…950mb are real big for source-package (have not used that)…it seems to be packed after compile (contains binary files and git history too) and maybe already packed files…

I asked travis-team if i can modify this package (it is automaticly created by travis) i have not used it yet…

maybe i can pack sourcecode with build.sh/travis.yml, but both will only work for future releases


(victors) #5

ok, and finally, do you plan to create a repository for R2 kernels ?


(Frank W.) #6

what do you mean with repository for r2-kernels? a apt-mirror? imho i cannot do this with github/gdrive and i cannot do this with my webspace


(victors) #7

I unpacked CI-BUILD-20190327_200914-2582bfe25.tar.gz into /usr/src/linux-headers-$(uname -r) created links to it and have error: root@bpi-r2:~/WireGuard/src# make

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.

WARNING: Symbol version dump ./Module.symvers is missing; modules will have no dependencies and modversions.

CC [M] /root/WireGuard/src/main.o In file included from :0:0: ././include/linux/kconfig.h:5:32: fatal error: generated/autoconf.h: No such file or directory #include <generated/autoconf.h>

can someone tell me. I built the wireguard from source


(Frank W.) #8

go inside /usr/src/linux-headers-xxx/ and run

./build.sh importconfig
./build.sh

maybe you need to say wireguard-make where your kernelsource is located…if the Package is big as you said, the autoconf-file should also be there, maybe wireguard searches in wrong directory (or need a link like /usr/src/linux => /usr/src/linux-headers-$(uname -r))

btw. i took a look in the archive…it seems to be only the source of kernel, no created archive and no binary (.o,.a) files


(victors) #9

ok I’ll try tomorrow


(Frank W.) #10

compiled 4.14.109 and packed the missing/generated files (include/config,include/generated, Module.symvers): generated_4.14.109.tar.gz (187,6 KB)


(victors) #11

Thanks, now the module wireguard is compiled, but it does not load. Is header version error.

root@bpi-r2:/home/victor/WireGuard/src# modprobe wireguard [ 6199.334420] wireguard: version magic '4.14.109-bpi-r2- SMP mod_unload ARMv7 p2v8 ’ should be '4.14.109-bpi-r2-main S’ modprobe: ERROR: could not insert ‘wireguard’: Exec format error

I’ll try tomorrow with generated_4.14.109.tar.gz


(victors) #12

I add generated_4.14.109.tar.gz wireguard is install withou errors but wireguard.ko not load:

root@bpi-r2:/home/victor# modprobe wireguard modprobe: ERROR: could not insert ‘wireguard’: Unknown symbol in module, or unknown parameter (see dmesg)

dmesg:

[  737.074200] wireguard: Unknown symbol udp_tunnel6_xmit_skb (err 0)
[  737.080584] wireguard: Unknown symbol udp_tunnel_sock_release (err 0)
[  737.087048] wireguard: Unknown symbol setup_udp_tunnel_sock (err 0)
[  737.093329] wireguard: Unknown symbol udp_sock_create6 (err 0)
[  737.099222] wireguard: Unknown symbol udp_tunnel_xmit_skb (err 0)

(Frank W.) #13

It seems you need additional modules build into kernel…so call

./build.sh importconfig
./build.sh config

Here add udp-tunnel and ipv6 tunnel options

and build with

./build.sh

if you got it work on x64 host i can include wireguard into my kernel-repo, but i have not much time to integrate it by myself


(victors) #14

Byloby well because the Armbian included wireguard.ko in the kernel

although the ideal solution would be to make linux-headers package


(victors) #15

and in which menu item to find these options ?


(Frank W.) #16

You can use / to search in menuconfig


(victors) #17

There is a number of points … can be a little more detail?


(Frank W.) #18

i don’t have the full menuconfig in my mind :wink: so i need to look…basicly search for “tunnel” and scroll through the options till one is set to =n and look if it can be one for matching the functions above

how about this:

Symbol: NET_UDP_TUNNEL [=n]                                             │  
│ Type  : tristate           

special for inet6 i found no option…but there are ipv6-options in the selected by, so i guess ipv6-support is also in the module if globally enabled


(victors) #19

does not work. mistake:
581.434540] wireguard: version magic '4.14.109-bpi-r2- SMP mod_unload ARMv7 p2v8 ’ should be ‘4.14.109-bpi-r2-main’ ?


(Frank W.) #20

it seems wireguard uses its own version-string which does not match my kernel naming

maybe you can fix this in the wireguard-source

or…

my build.sh adds the “main” (git branchname) to the normal version, but you don’t use git here, maybe you can fix this by setting

export LOCALVERSION="main"

before running make