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

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.

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

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.

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

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

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

1 Like

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

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

ok Iā€™ll try tomorrow

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)

1 Like

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

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)

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

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

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

and in which menu item to find these options ?

You can use / to search in menuconfig

There is a number of points ā€¦ can be a little more detail?

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

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ā€™ ?

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