2011-07-18

[Linux][kernel][DM368] Cannot Change Kernel Config Variable

After changing variables in the (default)config file, davinci_dm368_ipnc_defconfig, "make sys" generates .config but the .config file doesn't match the changes in davinci_dm368_ipnc_defconfig.

turning on USB_STORAGE at defconfig for example

# may also be needed; see USB_STORAGE Help for more information
#
# CONFIG_USB_STORAGE is not set
# CONFIG_USB_LIBUSUAL is not set
CONFIG_USB_STORAGE=m
CONFIG_USB_LIBUSUAL=y 
the .config will be still
# CONFIG_USB_STORAGE is not set
# CONFIG_USB_LIBUSUAL is not set
check steps:
1. track what's performed after executing "make sysall"  (make -n)
make sysall -> make lspall -> make lspclean, make lsp
make lsp -> make lspcfg
make lspcfg->
make lspbuild MAKE_TARGET=davinci_dm368_ipnc_defconfig => make ARCH=arm davinci_dm368_ipnc_defconfig   <==== I after this, .config is generated with incorrect config variables
make lspbuild MAKE_TARGET=checksetconfig

2.  locate potential trouble maker:
"make ARCH=arm davinci_dm368_ipnc_defconfig" executes "scripts/kconfig/conf -D arch/arm/configs/davinci_dm368_ipnc_defconfig arch/arm/Kconfig" to generate .config

suspicious screen output
arch/arm/configs/davinci_dm368_ipnc_defconfig:1037:warning: trying to reassign symbol USB_STORAGE
arch/arm/configs/davinci_dm368_ipnc_defconfig:1038:warning: trying to reassign symbol USB_LIBUSUAL
3. first, check if the variable USB_STORAGE has dependency problem.
the variable is defined at driver/usb/storage/Kconfig
config USB_STORAGE
    tristate "USB Mass Storage support"
    depends on USB
    select SCSI
but I am sure that CONFIG_USB is enabled in the generated .config file.

4. find more information about making kernel.

kernel 移植笔记(从omap linux-02.01.03.11 到 fred 版本kernel 学习)

史上最经典的Linux内核学习方法论

 "make ${PLATFORM}_defconfig"
     Create a ./.config file by using the default
     symbol values from
     arch/$ARCH/configs/${PLATFORM}_defconfig.
     Use "make help" to get a list of all available
     platforms of your architecture.

however, it seems not to have any problem. even I wasted couple hour to compare with the latest kernel.... no luck though

  5. back to fundamental, why "scripts/kconfig/conf -D arch/arm/configs/davinci_dm368_ipnc_defconfig arch/arm/Kconfig" outputs incorrect value.

[PATCH] Allow kconfig to accept overrides - Kernel

inspired me. so trace confdata.c
at conf_read_simple( )
    while (fgets(line, sizeof(line), in)) {
        conf_lineno++;
        sym = NULL;
        switch (line[0]) {
        case '#':
            if (memcmp(line + 2, "CONFIG_", 7))
                continue;
            p = strchr(line + 9, ' ');
            if (!p)
                continue;
            *p++ = 0;
            if (strncmp(p, "is not set", 10))
                continue;
it is surprised me that the line starting with "#" is not a comment !!

Solution
use double hash (##) as comment to "CONFIG_xxx is not set"


## CONFIG_USB_STORAGE is not set
## CONFIG_USB_LIBUSUAL is not set
CONFIG_USB_STORAGE=m
CONFIG_USB_LIBUSUAL=y  



Followups
in montavista releases, there is "Base Configuration for MontaVista Linux" file (scripts/kconfig/baseconfig), which will be compared with .config generated by make xxx_defconfig. The rules are

# If an option is marked as "m", the .config will only
# be modified if the option is turned off.
#
# If an option is marked as "y", the .config will be modified
# if the options in the "m" or the off states.
#
# If an option is marked as "n", the .config will be modified
# if the option is in the "m" or "y" states.
It could influence the final .config for making kernel.

No comments:

Post a Comment