Problem compiling with custom kernel configuration in buildroot V2.1

      Problem compiling with custom kernel configuration in buildroot V2.1

      Hi

      I have configured buildroot to use a custom kernel configuration setting the following in buildroot configuration file:

      Source Code

      1. # BR2_LINUX_KERNEL_USE_DEFCONFIG is not set
      2. BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
      3. BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL)/board/miros/common/linux-3.0.35.config"


      When compiling I get the following error:

      Source Code

      1. hein@lab4:~/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1$ make linux
      2. /usr/bin/make -j1 HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" silentoldconfig
      3. make[1]: Entering directory `/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1'
      4. BR2_DEFCONFIG='' KCONFIG_AUTOCONFIG=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/buildroot-config/auto.conf KCONFIG_AUTOHEADER=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/buildroot-config/autoconf.h KCONFIG_TRISTATE=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/buildroot-config/tristate.config BR2_CONFIG=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/.config BR2_EXTERNAL=/home/MIROSNETT/hein/develop/SM-140/trunk/buildroot SKIP_LEGACY= /home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/buildroot-config/conf --silentoldconfig Config.in
      5. make[1]: Leaving directory `/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1'
      6. >>> linux localdir Extracting
      7. linux/localdir_cp "/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/../linux-fsimx6" /home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir && PATH="/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/bin:/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/sbin:/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/usr/bin:/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/arm/fs-toolchain-4.7.2-cortexa5-neonvfpv4/bin:/opt/nios2/bin:/opt/node-v0.10.38-linux-x64/bin:/opt/altera/13.0sp1/quartus/bin:/opt/altera/13.0sp1/nios2eds/bin" /usr/bin/make -j1 HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=arm INSTALL_MOD_PATH=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/target CROSS_COMPILE=" /home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/usr/bin/arm-linux-" DEPMOD=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/sbin/depmod -C /home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir distclean
      8. make[1]: Entering directory `/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir'
      9. CLEAN Documentation/spi
      10. CLEAN scripts/basic
      11. CLEAN scripts/kconfig
      12. CLEAN include/config
      13. make[1]: Leaving directory `/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir'
      14. >>> linux localdir Patching
      15. for p in ; do if test -d $p ; then support/scripts/apply-patches.sh /home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir $p \*.patch || exit 1 ; else support/scripts/apply-patches.sh /home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir `dirname $p` `basename $p` || exit 1; fi done
      16. PATH="/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/bin:/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/sbin:/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/usr/bin:/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/arm/fs-toolchain-4.7.2-cortexa5-neonvfpv4/bin:/opt/nios2/bin:/opt/node-v0.10.38-linux-x64/bin:/opt/altera/13.0sp1/quartus/bin:/opt/altera/13.0sp1/nios2eds/bin" BR_BINARIES_DIR=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/images /usr/bin/make -j13 -C /home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=arm INSTALL_MOD_PATH=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/target CROSS_COMPILE=" /home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/usr/bin/arm-linux-" DEPMOD=/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/host/sbin/depmod _defconfig
      17. make[1]: Entering directory `/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir'
      18. HOSTCC scripts/basic/fixdep
      19. make[2]: *** No rule to make target `_defconfig'. Stop.
      20. make[1]: *** [_defconfig] Error 2
      21. make[1]: Leaving directory `/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir'
      22. make: *** [/home/MIROSNETT/hein/develop/armStoneA9/buildroot-2015.05-fsimx6-V2.1/output/build/linux-localdir/.config] Error 2


      This worked well in V2.0 but not in V2.1. It seems that you have done modifications in linux/linux.mk and package/pkg-kconfig.mk that breaks this feature.

      A work-around is to copy my custom configuration to the linux kernel source manually, but it would be nice if this was fixed in the next release.

      Kind regards,
      Hein Gustavsen
      Miros AS
      There is a small problem in Linux' Kconfig, but unfortunately this problem is triggered by our default configuration. Let me explain this.

      Usually the defconfig files that are part of the kernel (in arch/arm/configs) are minimized configs, that were created by calling make savedefconfig. This means these files only contain those settings that differ from their default values. This results in much smaller files with ~350 lines instead of ~4000 lines of a regular .config file, and these files can be more easily compared to each other. To get back from such a minimized defconfig, for example fsimx6_defconfig, to a regular .config file, we have to call

      Source Code

      1. make fsimx6_defconfig

      By doing this, all missing values will be set to their default values and the result is stored as .config. A way of doing this by hand would be to copy the fsimx6_defconfig file to .config and then calling make olddefconfig.

      Now Buildroot has made this concept more generic by defining a pkg-kconfig.mk file. By doing this, the Buildroot makefiles for packages that use Kconfig will get much simpler, for example those for the Linux kernel or for Busybox. However not all those Kconfig based packages support the make olddefconfig variant. But they all know make oldconfig. This is an interactive version where the user is prompted for each undefined setting, if it should be set to Y, N or M. If the user presses Return without giving a value, the default value is used. So for example in a newer kernel, you can use your old config file from the previous kernel, call make oldconfig and then you'll be asked for the handful of new settings that were added in the new kernel.

      In case of Buildroot, we always want the default value for all missing values, so Buildroot pipes this command to yes "", which automatically presses Return for all lines that are given. So theoretically the result should be the same, all given values are taken from the defconfig file and all missing values are set to the default value.

      But unfortunately in Linux this results in a different .config file. So this method using oldconfig is not exactly the same as when using make fsimx6_defconfig or make olddefconfig. I tried to fix this in Kconfig in Linux, but it was rather complicated and after a few hours I gave up.

      So I implemented a modification to Buildroot where the Linux variant directly uses make fsimx6_defconfig and all other Kconfig based packages use the oldconfig variant like before. But as you tell me now, this breaks the possibility of using an external config file in Linux. I haven't thought of this.


      So what can we do now? Actually the solution seems rather simple. Instead of using make ${defconfig}_defconfig, we should use cp ${defconfig} .config; make olddefconfig in case of Linux. This should get the same results for all internal defconfigs and should work for external defconfigs again. I will check this and post a patch if it works.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      OK, bad news. The target olddefconfig was not available in linux-3.0.35 yet. It was added in linux-3.7. So my first idea to use cp ${defconfig} .config; make olddefconfig does not work in this release.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      OK, so here is the patch. I solved the problem by copying the defconfig file to temporary file output/build/linux-localdir/arch/arm/configs/__buildroot_defconfig first. Then I call

      Source Code

      1. make __buildroot_defconfig

      and then remove the temporary file again.

      Apply the patch by going to the top directory of buildroot and then call

      Source Code

      1. patch -p1 < 0001-Fix-handling-of-defconfig-files-for-pkg-kconfig.mk.patch

      Please note the less-than character '<' to redirect the standard input.


      Your F&S Support Team
      Files
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.