How to build kernel with scratchbox?
Why not?
It is a lot easier to build the kernel outside the scratchbox, because linux kernel supports cross-compiling in itself. As such, that is the recommended way to build kernels.
How?
You still insist on building the kernel inside scratchbox? It can be done, but there are some issues with it.
ncurses
Do you get something like
/scratchbox/compilers/arm-linux-gcc3.3-glibc2.3/lib/gcc-lib/arm-linux/3.3.4/../../../../arm-linux/bin/ld: cannot find -lncurses collect2: ld returned 1 exit status >> Unable to find the Ncurses libraries. >> >> You must install ncurses-devel in order >> to use 'make menuconfig'
How to reproduce: Run make menuconfig in clean scratchbox.
Explanation: menuconfig scripts is being compiled for target, and there is no ncurses binaries installed (in the target).
How to fix: To use menuconfig, you need to have ncurses libraries installed into scratchbox. For hostside, ncurses libraries are already included, so all you have to do is define HOSTCC and HOSTCXX to host-gcc and host-g++ respectively. Either in make commandline or in the rootlevel Makefile.
Problem with split-include.
Do you get something like
scripts/basic/split-include: find: No such file or directory
How to reproduce: Run make when you have ncurses libraries for target, but HOSTCC is not defined.
Explanation: What hapens here, is that split-include got compiled as target binary and while it is being run on the target,
it tries to refer back to the scratchbox (to look for find) and fails.
How to fix: See ncurses.
Problem with fixdep with foreign toolchain.
Do you get something like
fixdep: /scratchbox/compilers/foreign/bin/../lib/gcc/include/stddef.h : No such file or directory.
How to reproduce: Run make ARCH=arm CROSS_COMPILE=
Explanation: Scratchbox prevents access to compiler headers used by fixdep.c (listed in scripts/basic/.fixdep.d)
The dependency of fixdep on these headers may be due to mis-installing the tool chain.
How to fix: Change fixdep.c::do_config_file() to skip the offending files.
-
if(!strstr(filename, "scratchbox")){ fd = open ....... ................. ................. close(fd); }
-
Problem with split with foreign toolchain.
Do you get something like
scripts/basic/split-include: find: Success make: *** [include/config/MARKER] Error 1
How to reproduce: Run make ARCH=arm CROSS_COMPILE=
Explanation: In this installation the success code returned by scripts/basic/split-include is interpreted by make as a failure.
How to fix: Change the kernel Makefile to ignore the error (and remember to check for the success message!!)
-
include/config/MARKER: scripts/basic/split-include include/linux/autoconf.h @echo ' SPLIT include/linux/autoconf.h -> include/config/*' -@scripts/basic/split-include include/linux/autoconf.h include/config
-