Setup buildroot for old kernels

2019-07-19 18:26发布

问题:

I'm trying to setup buildroot for cross-compiling a custom app.

/ # uname -a
Linux Venus 2.6.12.6-VENUS #323634 Wed May 25 13:40:36 CST 2011 mips unknown

So far I chose kernel version 2.6.12.6 in buildroot. Now I've got the problem that the make command fails yelling that the rule headers_install is unknown.

Here is the compleat output:

~/buildroot-2011.11$ make
(cd /root/buildroot-2011.11/output/toolchain/linux-2.6.12.6; \
         /usr/bin/make -j2 ARCH=mips \
                HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" \
                HOSTCXX="/usr/bin/g++" \
                INSTALL_HDR_PATH=/root/buildroot-2011.11/output/toolchain/linux headers_install; \
        )
make[1]: Entering directory `/root/buildroot-2011.11/output/toolchain/linux-2.6.12.6'
Makefile:485: .config: Datei oder Verzeichnis nicht gefunden
make[1]: *** Keine Regel, um »headers_install« zu erstellen.  Schluss.
make[1]: Leaving directory `/root/buildroot-2011.11/output/toolchain/linux-2.6.12.6'
make: *** [/root/buildroot-2011.11/output/toolchain/linux/.configured] Fehler 2

I think the problem is that this old kernel doesn't have this option in its makefile.

My next try was to use the Makefile and the scripts directory of the new kernel 3.2.6 by replacing the old one.

Here is the output:

# make
(cd /root/buildroot-2011.11/output/toolchain/linux-2.6.12.6; \
         /usr/bin/make -j2 ARCH=mips \
                HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" \
                HOSTCXX="/usr/bin/g++" \
                INSTALL_HDR_PATH=/root/buildroot-2011.11/output/toolchain/linux headers_install; \
        )
make[1]: Entering directory `/root/buildroot-2011.11/output/toolchain/linux-2.6.12.6'
  CHK     include/linux/version.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/unifdef
Makefile:1059: *** Headers not exportable for the mips architecture.  Schluss.
make[1]: Leaving directory `/root/buildroot-2011.11/output/toolchain/linux-2.6.12.6'
make: *** [/root/buildroot-2011.11/output/toolchain/linux/.configured] Fehler 2

No idea what I can try now. What should I do?

回答1:

All modern tools that build cross-compilation toolchains rely on the kernel implementing the headers_install target. So as suggested by Shawn, you can try with an older Buildroot version, but I think we have been using exclusively headers_install since quite a long time, so you would have to go way back in the past, and face many other problems.

What about upgrading your kernel instead?



回答2:

If you use toolchain from scratch with buildroot, you may custom the header files of toolchain, then custom kernel to match the toolchain, that's would be fine.



回答3:

You must replace headers_install with install in file:

package/linux-fusion/linux-fusion.mk

There is line

$(TARGET_CONFIGURE_OPTS) $(MAKE) $(LINUX_FUSION_MAKE_OPTS) INSTALL_MOD_PATH=$(STAGING_DIR) -C $(@D) headers_install

Found here.