This repo contains a bunch of semi-raw scripts I crafted in process
of converting CONFIG_BOOTARGS
option to Kconfig
. In simpler cases it is
enough to just run tools/moveconfig.py
for automatic transition.
WARNING: those scripts must be used with caution, as sometimes they give incorrect results (because of their simplicity).
In addition to those scripts, one can find useful my another tool called find-ifdefs.
Also, to check the final value of config option, you can use hack patch from Tom Rini here.
- Run
gen-configs.sh all
- Run
find-target.sh
for header frominclude/configs/
you are interested in - Run
find-configs.sh
for found target - Fix found files from
configs/
and related header - Repeat above items for all headers you need to convert
git commit
your patch- Run
gen-defconfigs.sh head
and replace configs/ with generated defconfigs
For example we want to migrate CONFIG_USB_GADGET_VBUS_DRAW
option to Kconfig.
- Add some option to corresponding Kconfig (
drivers/usb/gadget/Kconfig
) - Generate .config files from defconfig files:
$ ./gen-configs.sh
- Find all headers with option of interest:
$ grep -sIrHn USB_GADGET_VBUS_DRAW include/configs/*
- For each found header:
4.1
./find-target.sh am335x_evm.h
4.2 For each found target: 4.2.1./find-configs.sh TARGET_AM335X_EVM
4.2.2 For each found config: Add corresponding config option to corresponding defconfig; e.g. addCONFIG_USB_GADGET_VBUS_DRAW=2
to the end ofconfigs/am335x_boneblack_defconfig
, etc. 4.3 Remove option from header 4.3.1 Pay attention to#ifdefs
4.4 Be sure to handle common header files properly (they are usually included in other files, but pay attention to#ifdefs
) - For
sunxi-common.h
use next method:
$ grep-all configs_generated/ 'USB_MUSB_GADGET=y' 'SUNXI=y' | \
sed 's/configs_generated/configs/g'
- Once all options moved to defconfigs, recreate them using:
$ ./gen-defconfigs.sh
to keep correct order of options.
5.1 Explore changes using kdiff3
(for 2 directories)
(disable "Show Files only in A" or "... only in B" for convenience)
5.2 Replace old defconfigs with new ones
6. Check everything using buildman tool
7. Send a patch
To check if the option was converted correctly, it's very convenient to use
tools/buildman
tool.
You can run it for some boards like this:
$ ./tools/buildman/buildman -b master --force-build -SCdvel board1 board2
where board1, board2 -- boards from configs/
(without _defconfig
suffix).
Or for the whole architecture:
$ ./tools/buildman/buildman -b master -T 2 --force-build -SCdvel arm
To check results, just run:
$ ./tools/buildman/buildman -b master -sSdBevK
- Sam Protsenko
This project is licensed under the GPLv2.