I have a custom Linux kernel modified by a hardware vendor based on version 2.6.18. I need to generate a new toolchain for it using the latest version of uClibc for the MIPS arch.
I've chosen the tool crosstool-ng to ease the process, but it is failing during the generation process. Here is the log of the error part:
[INFO ] =================================================================
[INFO ] Installing kernel headers
[DEBUG] Using kernel's headers_install
[EXTRA] Installing kernel headers
[DEBUG] ==> Executing: 'make' '-C' '/home/myuser/sources/custom-linux/toolchain/.build/src/linux-custom' 'O=/home/myuser/sources/custom-linux/toolchain/.build/mipsel-unknown-linux-uclibc/build/build-kernel-headers' 'ARCH=mips' 'INSTALL_HDR_PATH=/home/myuser/x-tools/mipsel-unknown-linux-uclibc/mipsel-unknown-linux-uclibc/sysroot/usr' 'V=0' 'headers_install'
[ALL ] make[1]: Entering directory `/home/myuser/sources/custom-linux/stblinux-2.6.18'
[ALL ] CHK include/linux/version.h
[ALL ] UPD include/linux/version.h
[ALL ] *** Error: Headers not exportable for this architecture (mips)
[ERROR] make[2]: *** [headers_install] Error 1
[ERROR] make[1]: *** [headers_install] Error 2
[ALL ] make[1]: Leaving directory `/home/myuser/sources/custom-linux/stblinux-2.6.18'
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Installing kernel headers'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR] >> called from: do_kernel_install[scripts/build/kernel/linux.sh@112]
[ERROR] >> called from: do_kernel_headers[scripts/build/kernel/linux.sh@91]
[ERROR] >> called from: main[scripts/crosstool-NG.sh@632]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> '/home/myuser/.local/share/doc/crosstool-ng/ct-ng.hg+default-20f2459b97bf/B - Known issues.txt'
[ERROR]
[ERROR] (elapsed: 41:41.63)
The problem seems related to the *headers_install* rule. I think it was introduced with that specific version of the kernel. The funny fact is that if I run
make ARCH=mips INSTALL_HDR_PATH=... headers_install
the headers will be installed just fine. The problem seems to happen with the usage of the O= parameter. Does anyone knows what is it for? Is there a workaround to this issue?
The problem was that the headers_install rule doesn't exist in this Linux Kernel version. It was included in 2.6.19.1:
Modern Linux kernels (based on 2.6.19.1 and newer) export kernel headers via the "make headers_install" command.
https://www.kernel.org/doc/index-old.html#3.2.2.3.1
Since buildroot expects this rule to exist, I'd guess that it doesn't work without custom patching.