This report applies to NanoPi-4 RK3399 boards (NanoPC T4, NanoPi M4, NanoPi NEO4) running Armbian Bionic (Friendlyarm-based legacy 4.4.y kernel). In other words, boards targeted by Armbian rk3399.conf and Friendlyarm kernel but *NOT* baords using rockchip64.conf and Ayufan kernel.
There is a bug in the friendlyarm linux 4.4 version of /scripts/package/builddeb that causes the linux-headers package to be incomplete. Attempts to build out-of-tree kernel modules to fail with errors of the form "fatal error: ../../arm/include/asm/opcodes.h: No such file or directory". For example here is the output trying to build a simple kernel module from this tutorial:
Spoiler
$ make
make -C /lib/modules/4.4.172-rk3399/build M=/home/ross/Documents/lkm_example modules
This is a known bug that has been encountered in other kernel header distributions, for example here and here.
The fix was applied to mainline in 2016 and is a one line change to the scripts/package/builddeb script. The fix was posted to LKML in March 2016 and was committed to mainline here:
Please could this patch be applied to the Armbian build process?
I have no experience with Armbian build but if you need me to generate the patch in the correct format and submit a pull request I can do so, just let me know that you'd like me to do it.
Update: my system information
NanoPC T4
Ubuntu 18.04.1 LTS bionic
4.4.172-rk3399
header package installed: linux-headers-rk3399
Update: steps to reproduce
Using a NanoPi-4 RK3399 board (NanoPC T4, NanoPi M4, NanoPi NEO4) running Armbian Bionic (Friendlyarm-based legacy 4.4.y kernel)
First install the linux-headers package:
$ sudo apt-get install linux-headers-rk3399
Then, place the attached files lkm_example.c and Makefile into a directory (e.g. named lkm_example). cd to that directory, and type `make`. You should then get the error in the spoiler above.
The expected behavior is for the make to succeed without error (which should happen if you are running any other board with the appropriate linux-headers-... package, e.g. the same board with the dev kernel, and linux-headers-dev-rk3399 package installed.
Question
s_frit
This report applies to NanoPi-4 RK3399 boards (NanoPC T4, NanoPi M4, NanoPi NEO4) running Armbian Bionic (Friendlyarm-based legacy 4.4.y kernel). In other words, boards targeted by Armbian rk3399.conf and Friendlyarm kernel but *NOT* baords using rockchip64.conf and Ayufan kernel.
There is a bug in the friendlyarm linux 4.4 version of /scripts/package/builddeb that causes the linux-headers package to be incomplete. Attempts to build out-of-tree kernel modules to fail with errors of the form "fatal error: ../../arm/include/asm/opcodes.h: No such file or directory". For example here is the output trying to build a simple kernel module from this tutorial:
$ make
make -C /lib/modules/4.4.172-rk3399/build M=/home/ross/Documents/lkm_example modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.172-rk3399'
CC [M] /home/ross/Documents/lkm_example/lkm_example.o
In file included from ./arch/arm64/include/asm/sysreg.h:25:0,
from ./arch/arm64/include/asm/cputype.h:99,
from ./arch/arm64/include/asm/cachetype.h:19,
from ./arch/arm64/include/asm/cache.h:19,
from include/linux/cache.h:5,
from include/linux/printk.h:8,
from include/linux/kernel.h:13,
from include/linux/list.h:8,
from include/linux/module.h:9,
from /home/ross/Documents/lkm_example/lkm_example.c:2:
./arch/arm64/include/asm/opcodes.h:5:10: fatal error: ../../arm/include/asm/opcodes.h: No such file or directory
#include <../../arm/include/asm/opcodes.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
scripts/Makefile.build:283: recipe for target '/home/ross/Documents/lkm_example/lkm_example.o' failed
make[2]: *** [/home/ross/Documents/lkm_example/lkm_example.o] Error 1
Makefile:1499: recipe for target '_module_/home/ross/Documents/lkm_example' failed
make[1]: *** [_module_/home/ross/Documents/lkm_example] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.172-rk3399'
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2
@hbmaennchen encountered the same problem when compiling an existing module here: https://forum.armbian.com/topic/8693-headers-44162/
This is a known bug that has been encountered in other kernel header distributions, for example here and here.
The fix was applied to mainline in 2016 and is a one line change to the scripts/package/builddeb script. The fix was posted to LKML in March 2016 and was committed to mainline here:
https://github.com/torvalds/linux/commit/962475ac2f9662fe69a9f86220ab31bbbf3911d2#diff-03db9657e7716d9ca27a586068430b37
Please could this patch be applied to the Armbian build process?
I have no experience with Armbian build but if you need me to generate the patch in the correct format and submit a pull request I can do so, just let me know that you'd like me to do it.
Update: my system information
NanoPC T4
Ubuntu 18.04.1 LTS bionic
4.4.172-rk3399
header package installed: linux-headers-rk3399
Update: steps to reproduce
Using a NanoPi-4 RK3399 board (NanoPC T4, NanoPi M4, NanoPi NEO4) running Armbian Bionic (Friendlyarm-based legacy 4.4.y kernel)
First install the linux-headers package:
$ sudo apt-get install linux-headers-rk3399
Then, place the attached files lkm_example.c and Makefile into a directory (e.g. named lkm_example). cd to that directory, and type `make`. You should then get the error in the spoiler above.
The expected behavior is for the make to succeed without error (which should happen if you are running any other board with the appropriate linux-headers-... package, e.g. the same board with the dev kernel, and linux-headers-dev-rk3399 package installed.
Makefile
lkm_example.c
Link to comment
Share on other sites
10 answers to this question
Recommended Posts