Make defconfig in OpenWrt vs rest of the world

Hello,
Yesterday I started playing with building OpenWRT and I am completely confused by its make defconfig.

SInce 2011 I've built my fair share of Linux kernels and embedded Linux system images using Buildroot. In both the Linux and the Buildroot the defconfig meant erasing the .config and replacing it with default configuration.

After some experiments with OpenWRT it seems to me though that the OpenWRT's make defconfig does what Linux's make olddefconfig does which is:

olddefconfig - Same as oldconfig but sets new symbols to their default value without prompting

And for a reference the mentioned olddefconfig does:

oldconfig - Update current config utilising a provided .config as base

Am I right?

Kinda, defconfig will generate a default config if no .config is present and otherwise will expand a existing one.

I think the idea is to simply expand a diff-config, at least that's how i use the system.

After i do a fresh setup or mayor update i run:
scripts/diffconfig.sh > mydiffconfig
Now i can compare the diffconfig and also use it as base like this, while retaining my specific changes but get the upstream changes.

cp mydiffconfig .config
make defconfig
make

This way you can also use the config.buildinfo of the releases, so you get the exact same starting point.

2 Likes

Kinda, defconfig will generate a default config if no .config is present and otherwise will expand a existing one.

Then from the definition of Linux's make olddefconfig it is not just kinda but exactly the same as OpenWRT's make defconfig because the olddefconfig in absence of .config just fills default values.

Btw. the whole scripts/diffconfig.sh seems to be exactly what make savedefconfig is in both Linux and Buildroot i.e. extract only minimal nondefault values so they can be expanded again after and update etc..

I'm kinda sad that there is not only different (savedefconfig vs diffconfig.sh) but also colliding (the defconfig) terminology/nomenclature used across across these opensource projects.

FWIW, it confused the h*** out of me recently for exactly the same reason.

1 Like