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:

    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:



    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

    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


    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


    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