Question

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?

Was it helpful?

Solution 2

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.

OTHER TIPS

Building a cross compiler/binutils is often very hard, and it doesn't allow you to test your programs.
Virtual machines are very slow and create a strong separation which make hard to share files between the host an the VM.

The easiest solution is Qemu-User-static : system-calls and instructions are wrapped in user mode to the native kernel.

Download or extract a rootfs.
Copy it to a sub-folder of you real root directory.
Copy qemu-user-(the name of your mips arch)-static to the root of the target directory.
copy /etc/resolv.conf to /your_path_to_target/etc/resolv.conf Chroot to it by executing /bin/bash.
Use the rootfs as if you were using a real mips based. machine.

Things became very simple : Many libraries aren't compiled because of things like hard-coded paths (you'll face many; many problems like the one you have with cross-compiling). Here all happen as if you build packages natively.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top