Building a .config file

I have several .config files, each for different targets. Is there any way to just say make myconf.config instead of have to load it, save it as .config then make?

I have RTFM and I just want to clarify my understanding:

Creating diff file

This file is created using the ./scripts/diffconfig.sh script.

./scripts/diffconfig.sh > diffconfig # write the changes to diffconfig

Note: Since r2752 LEDE firmware make process automatically creates the configuration diff file config.seed file to the target image directory.

Using diff file

These changes can form the basis of a config file ( <buildroot dir>/.config ). By running make defconfig these changes will be expanded into a full config.

cp diffconfig .config # write changes to .config make defconfig # expand to full config

These changes can also be added to the bottom of the config file ( <buildroot dir>/.config ), by running make defconfig these changes will override the existing configuration.

cat diffconfig >> .config # append changes to bottom of .config make defconfig # apply changes

Does this mean we can have several diffconfig files, such as target1_diffconfig target2_diffconfig, and to use them we just need to say

cp target1_diffconfig .config   # write changes to .config
make defconfig   # expand to full config
make

Can't you make symbolic links to the proper file(s)?

1 Like

Do you mean just turn .config into a symlink which points to whatever file I want to use at the time? I guess that's a good idea too.

1 Like

So simple, and so perfect. Thanks for the tip!

1 Like

I split my config into a target specific part and a generic part, concatenating it as needed when I build an image, e.g.:

$ cat /path/from/{ath79-tiny.init,config.init} >.config
$ make defconfig oldconfig

ath79-tiny.init:

##### ath79.init: start #####

### Use "make defconfig oldconfig" to expand this to a full .config

CONFIG_TARGET_ath79=y
CONFIG_TARGET_ath79_tiny=y
CONFIG_TARGET_DEVICE_ath79_tiny_DEVICE_tplink_tl-wr941-v2=y
CONFIG_TARGET_DEVICE_PACKAGES_ath79_tiny_DEVICE_tplink_tl-wr941-v2="-opkg -ppp-mod-pppoe -ppp -kmod-pppoe -kmod-pppox -kmod-ppp -kmod-ipt-offload -kmod-nf-flow -swconfig -wpad-basic wpad-mini -wpad -wpad-openssl"

### Debugging options
# CONFIG_KERNEL_KALLSYMS is not set

### Minify lua
CONFIG_LUCI_SRCDIET=y

### don't build deprecated ciphers for openssl
# CONFIG_OPENSSL_WITH_DEPRECATED is not set

##### ath79.init: stop #####

config.init:

##### config.init: start #####

### Enable per device rootfs
CONFIG_TARGET_MULTI_PROFILE=y
CONFIG_TARGET_PER_DEVICE_ROOTFS=y

[…]

##### config.init: stop #####

Doing it this way takes a little more effort beforehand, minifying the diffconfig.sh even further, but is very flexible across multiple targets afterwards. Obviously using =m (instead of =y) as much as possible in config.init and including it dynamically into the different devices I'm building for a given target (taking ath79-tiny as the most simple example, ath79, bcm47xx, ipq40xx, ipq806x or lantiq are a lot more complex, building for multiple devices with different feature sets each).

1 Like

@biangbiangmian Different configuration profiles is exactly what the 'env' helper script is intended for.

You call it with ./scripts/env and it will allow you to save multiple profiles and rotate between them. I have e.g.:

./scripts/env list
apu2
ath79_generic
ath79_tiny
ipq40xx
ramips

You can name the profiles whatever you want.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.