Linux kernel defconfig options not in resulting .config using BuildRoot - linux

I am building kernel version 2.6.39.4 via BuildRoot for an arm target.
I am using a custom defconfig file, into which I added the following 3 options:
CONFIG_WIRELESS=y
CONFIG_WEXT_PRIV=y
CONFIG_WIRELESS_EXT=y
In the resulting .config file for the kernel, the only option that I see out of the 3 I added to my defconfig is CONFIG_WIRELESS=y
Is this normal? I know some kernel config options are "hidden", but will that keep them from showing up in the final .config for the kernel?

Both WEST_PRIV and WIRELESS_EXT are blind options (i.e. they have no prompt, they are not visible in menuconfig/xconfig).
So you cannot simply set their value in a .config (or defconfig) file.
They are only enabled when another option selects them.
So you have to enable some relevent option that is visible, which will then automatically select WEXT_PRIV and WIRELESS_EXT.

I had the same issue, I solved it by just setting CONFIG_HOSTAP=y. This option causes the following option to be set as well:
CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
CONFIG_WLAN=y
CONFIG_LIB80211=y
CONFIG_LIB80211_CRYPT_WEP=y
CONFIG_LIB80211_CRYPT_CCMP=y
CONFIG_LIB80211_CRYPT_TKIP=y
I have verified that just setting CONFIG_HOSTAP=y in defconfig does indeed cause the above options to be enabled in .config when using buildroot.

here is the solution for some kernel versions :
https://lkml.org/lkml/2019/9/6/787
This patch adds parent that selects the wext_* configs.
later you need to go to your board config ie:
arch/arm/configs/imx_v7_android_defconfig
and add line:
CONFIG_WIRELESS_ALLCONFIG=y
then recompile the kernel , ie: on Android you do:
make -j32 kernelimage

Related

Adding an entry to the Linux Kernel .config file

How can I manually add the line CONFIG_XILINX_FIXED_DEVTREE_ADDR=y to the linux config file? It keeps getting overwritten when I build the kernel
You can build by make CONFIG_XILINX_FIXED_DEVTREE_ADDR=y without adding it into .config. But if you gonna add it to .config, you should use make menuconfig to select it and save it into .config.
If the config variable you're trying to add is new (as in, not in .config at all and not showing up in make menuconfig), then you should add it to the relevant Kconfig file. For instance, if you look at fs/proc/Kconfig, you can see how different proc config options are laid out. Follow their example and add your config variable, its variable type, the default, and its description. Then you should see it in make menuconfig.
Here's an example of a config variable definition in fs/proc/Kconfig:
config PROC_VMCORE
bool "/proc/vmcore support"
depends on PROC_FS && CRASH_DUMP
default y
help
Exports the dump image of crashed kernel in ELF format.

how to save .config to ./arch/arm/configs/ in linux kernel configuration

I have configuring the linux kernel 3.4. I have the defconfig file supplied by the chip vendor. I have applied the defconfig and then changed some more configuration using the menuconfig. Now i have the updated .config file.
I need to save this .config file into ./arch/arm/configs/ so that in future no need to redo the configurations I already did.
Thanks and Regards,
Giri
You can copy the .config manually to ./arch/arm/configs/(and probably add it to your version control also)
cp .config ./arch/arm/configs/CUSTOM_defconfig
And when you need to load this configuration just use:
make CUSTOM_defconfig
You can use buildroot utility to save your defconfig file using :
$> make savedefconfig
Then, you can find a file named "defconfig" in the same location of your .config file.

Linux kernel configuration - enabling CONFIGURE_LOCALVERSION_AUTO

I have recently git cloned the kernel of Linus Torvalds. I want to build and install this kernel in my laptop. But because I want to use "kernel-of-the-day" I want to enable CONFIGURE_LOCALVERSION_AUTO option. But how should I enable this option I don't know that. Where to find this option?
Use menuconfig or xconfig, to configure Linux kernel these interfaces are used. Modifying .config file directly is discouraged. Inside your kernel source tree do make menuconfig or make xconfig - use anyone you like. On kernel configuration menu you'll find General Setup Option, inside this option you'll find Automatically append version information to the version string, toggle it to enable/disable.
After you have cloned the Linus repository repository. You would need to either create a fresh .config file in the ./linux folder or copy the existing config file from your /boot and later modify it. Then edit the .config file and set CONFIG_LOCALVERSION_AUTO=y
`cp /boot/config-`uname -r` .config`

How do I get the correct .config file for compiling the Linux kernel source specific to my hardware?

I tried using make defconfig to compile the kernel, but as expected, it failed to boot. I was wondering what .config file do kernel vendors like Canonical for Ubuntu use, that the kernel is able to boot right out-of-the-box. Of course, I am still a beginner and configuring the various parameters, is a little out of my league currently.
Specifically,I am looking to load a basic "hello, world!" module to my running kernel 2.6.32.41. For that, I would need to compile kernels source against the same .config file that was used for the running kernel.
If your running kernel was compiled with the CONFIG_IKCONFIG_PROC option, you can get the config in /proc/config.gz:
$ zcat /proc/config.gz >my_config
Copy my_config into your kernel build directory as .config and run make config to be prompted for configuration options that are absent from your config file (this will only happen if you are using a kernel source that is newer than your running kernel). You should then be able to compile a new kernel with the same features as your current one.
Distros typically use their own kernel configuration, where most of the drivers are compiled as modules to be dynamically loaded when the corresponding hardware is requested. Also the kernel needs to be booted with relevant boot options (like the one specifying the root filesystem). Your defconfig kernel probably failed to boot because of that.
I don't know about getting the one that's "correct for your hardware", but you can use the config that Ubuntu gives you by looking in /boot/ for a file starting with the name config. There may be more than one, in which case use the command uname -r to tell which kernel you're currently running, and then you can use the appropriate config.
option1:
source code of your booted system
cd /usr/src/linux-headers-3.2.0-29;
this will generate .config
sudo make oldconfig;
vi .config
option2:
zcat /proc/config.gz > my_config
option3:
echo /boot/config* > my_config
"defconfig" is usually pegged at the commonly used hardware - x86, or x86_64, and perhaps not so recent chipset or motherboard. Sometimes, like my Lenovo laptop, only the latest kernel source, and with enabling some config option, after googling through the bugzilla database, will it work.
Like what Jeff Welling said, to get the config in use, u can look under /boot directory. Same for my Fedora Core too. But if u want to compile a basic program as a "kernel module", and by that it simply means "loadable kernel module", u don't need to compile the kernel source. U just need the kernel headers for that current version. For example, "apt-cache search" in Ubuntu 10.04 returns several possible option:
linux-headers-2.6.38 - Header files related to Linux kernel, specifically,
linux-libc-dev - Linux Kernel Headers for development
Ubuntu normally patched the stock kernel (from kernel.org) to have their own kernel. If u have downloaded the stock kernel, and attempt to use the /boot's config file (or sometimes u can find the currently loaded config as /proc/config.gz, like the Backtrack's Ubuntu, which is based on 10.04 LTS), then u may need to do a "make oldconfig" with the current config file named as ".config". "make oldconfig" will then use the .config to generate a new .config that is compatible with the kernel source.

How do I configure the Linux kernel within Buildroot?

I'm trying to build a rootfs for an x86 target, which is all simple enough. However I can't figure out how I configure the kernel that buildroot produces. The first run through came up with menuconfig, but it's cached the .config since then and I can't see where to change it.
~650MB of kernel modules don't do good things to an embedded target :P
Is there an easy way to configure the kernel within buildroot? Something like the uclibc-menuconfig target would be perfect.
I always do the following:
configure Linux kernel: make linux-menuconfig
After leaving menuconfig your configuration will be stored in file: output/build/linux-XYZ/.config where XYZ is your kernel version.
After that you can copy file output/build/linux-*XYZ*/.config to board/your_kernel_config/.config
later in Buildroot menuconfig you can under kernel settings configure to use custom kernel config file and enter path: board/your_kernel_config/.config
Do not forget to set also defconfig to i386 in menuconfig:
Kernel —>
[*] Linux Kernel
(i386) Defconfig name
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES
Adds extra configs to your existing one.
E.g., if you are using buildroot as a submodule, the directory tree looks like:
.git/
buildroot/
.gitmodules
kernel-config-frag
E.g. to turn on CONFIG_DEBUG_FS, do:
echo 'CONFIG_DEBUG_FS=y' > kernel-config-frag
and then configure buildroot with:
cd buildroot
make qemu_x86_64_defconfig
echo 'BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES=../kernel-config-frag' >> buildroot/.config
make
This way you can git track just a diff between qemu_x86_64_defconfig and your extra configs.
I believe this uses scripts/kconfig/merge_config.sh form the kernel as mentioned at: How do you non-interactively turn on features in a Linux kernel .config file?
After you change the config fragment, just remember to do:
rm -rf buildroot/output/build/linux-*.*.*/
before the next build.
Minimal runnable example at: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/bb8f4eb79565c9771356c80e0964c8fefc163e11/kernel-config-frag
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
Selects the full .config to be used.
For some reason I have to nuke the kernel's .config for this to take effect? Why when I change BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE and run make linux-reconfigure the kernel .config does not change?
And the answer is:
make linux26-menuconfig
The steps are as follows:
cd buildroot/
make menuconfig
Kernel -> Linux Kernel -> Kernel version

Resources