19

I have a situation in which i have two kernel config files (for the same kernel source ). Both of them have a part of the functionality that i need (on one, USB works correctly, on other, the second I2C).

I know that the differences between the two config files, from the perspective of menuconfig, include only a few selected options. (But don't know which ones)

However when the config files are manually compared (meld between two .config files), the differences are not simple to identify. I have tried merging them manually without success. I'm sure I'll succeeded eventually but believe the process could be much more painless if the files were compared in a way they appear in the menuconfig.

Can this be achieved, and if so, how?

5 Answers 5

23

Try using scripts/diffconfig from the Linux kernel source tree.

Usage:

diffconfig config-a config-b

Shows a list of lines removed, modified and added to the config-b file with respect to config-a.

10

There is a script in the kernel source;

scripts/kconfig/merge_config.sh

It will take 2 kernel configs as arguments - it will merge the 2nd on top of the first. Anything in the 2nd config will override the first config - even if it is a line like "# CONFIG_ is not set"

See http://processors.wiki.ti.com/index.php/Quick_start_with_3.14_linux

5

If the two files are generated by make menuconfig, they will have the options in the same order, so a simple diff (via Meld or whatever frontend you like) will give a usable result.

You might get something more readable if you ignore comment lines:

diff -I '^#' old.config new.config

If for some reason the files aren't in the same order, you could sort them. This has the downside of putting related options far apart. Again, remove comments. Use comm to strip off the common lines.

comm -3 <(<old.config grep '^[^#]' | sort) <(<new.config grep '^[^#]' | sort)
4

You could try sorting the files before comparing:

meld <(sort config-a) <(sort config-b)
2

Use kdiff3 to compare two configs.

If anyone wants to compare .config (current configuration) file to some default configuration from kernel tree, first export defconfig from current configuration:

make savedefconfig

This will export defconfig file, which can be easily compared to any other default configuration file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .