Git - Track Linux kernel .config file.

Is there a convenient way to track the kernel .config file? Every time I run make menuconfig , .config is edited and changed, even if I do not change any value.

When I execute diff, .config seems different, but it just messed up with the lines:

 same lines, but at different position 

From the point of view of make , the same file. From a git point of view, this is a completely different file with lots of new / edited lines.

I feel like I'm missing something. This should be the right way to track the .config file :)

thanks

+4
source share
2 answers

A foolish (but simple) way to always distinguish only missing / added lines (and not lines located somewhere else) would be to sort .config the file before comparing and adding to the repository and having a β€œbase” sorted .config for compare with.

Note that this will keep all spaces and empty comment lines at the beginning, but keep (un) commented lines in the appropriate places. This is an example of my .config:

 $ sort /boot/config-2.6.35-24-generic ... CONFIG_TRACING=y CONFIG_TRANZPORT=m # CONFIG_TREE_PREEMPT_RCU is not set # CONFIG_TREE_RCU_TRACE is not set CONFIG_TREE_RCU=y CONFIG_TR=y CONFIG_TTPCI_EEPROM=m CONFIG_TULIP=m # CONFIG_TULIP_MMIO is not set # CONFIG_TULIP_MWI is not set # CONFIG_TULIP_NAPI is not set CONFIG_TUN=y ... 
+1
source

I created a .git/hooks/pre-commit file containing

 #!/bin/sh uname -a > uname.log lspci -k > lspci.log grep -e "^#" -v .config | sort > .config.sorted 

You can git add .config.sorted and compare it with diff. Two log files track changes in the system. For comparison, you can use /usr/src/linux/scripts/diffconfig .config .anotherconfig .

0
source

Source: https://habr.com/ru/post/1391220/


All Articles