Adding an entry to the Linux Kernel .config file - linux

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.

Related

The easiest way to extend Linux version in Yocto

I'm trying to extend Linux version in my project on a tag from git repository. I manged to pass tag value to Linux-*.bb and looking for the best solution to add it to kernel version so I can see it in /etc/kernel-version file and as an output after typing "uname -r" e.g: 3..11.67-my-tag.
I know that there is something like LINUX_KERNEL_EXTENSION but I didn't mange to make it working.
What is the easiest way to do it and how can I test it without flashing my board?
Thanks,
There is a dedicated configuration option, name CONFIG_LOCALVERSION, which can be found under General Setup -> Local version - append to kernel release. You can add it by simply using bitbake -c menuconfig or directly adding following lines in your kernel configuration file:
CONFIG_LOCALVERSION="+mycustomboard"
CONFIG_LOCALVERSION_AUTO=y
If you need to add your tag value as extension, you have to add these following lines in your kernel recipe:
LOCALVERSION = "+mycustomboard-${LINUX_VERSION_EXTENSION}"
LINUX_VERSION_EXTENSION = "1.2.3"
In that way, uname -r output shall contain +mycustomboard-1.2.3 as you expect.

Linux kernel defconfig options not in resulting .config using BuildRoot

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

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`

when I run make menuconfig or make config how it works?

In a new kernel package there is two config files inside arch/x86/configs :
i386_defconfig 2. x86_64_defconfig
when I did make menuconfig, it generate .config file. But It has some default setting also. From where, it take these default setting ? Is it used one of these files or used from /boot directory or from some where else
same question for make config.
No, It won't pick the config file from /boot
It first determines the processor/OS architecture from $MACHTYPE of your system unless you explicitly mention "ARCH=" variable like in "make ARCH=arm menuconfig",
say
echo $MACHTYPE
x86_64-pc-linux-gnu
Then based on the found architecture, it gets the apt defconfig file from arch/found_arch/configs/apt_def_config_file
The default settings are present as files in the filesystem.
Execute: find . -name \*_defconfig inside your kernel sources.
The config files present in in /boot were most likely created by one of the packages you installed and not by the kernel build process itself.

Resources