Set config parameters depending on target/subtarget

Hello!
Is it possible to change values of parameters in .config depending on chosen target/subtarget ?
Case1 : I want to use another toolchain which path I have in my .config after switching on another target/subtarget.
Case2: I want to use another set of enabled packages for different target/subtarget.

Hi @AncientApparition,
if you just want to change values after having selected the target/subtarget, you can use make menuconfig (and if you want to use a file to keep track of changes for your specific build make defconfig):

https://openwrt.org/docs/guide-developer/build-system/use-buildsystem?s[]=defconfig#image_configuration

Using this way, you can configure the use of an external toolchain as follow:

https://openwrt.org/docs/guide-developer/external_toolchain#step_2build_firmware

Now, if you really want to have all these settings changed when you select the target/subtarget, let us know as it involves quite a bit more changes (and unless you have new hardware specs possibly doesn't make sense).

1 Like
./scripts/env

is probably the closest to what you need... search the forum... there are some posts by jeff explaining it's usage in more detail

1 Like

For example I can use variable PACKAGE in target/linux/<my_target>/<my_subtarget>/<my_profile>.mk
Any < package> which I pointed here appears in .config automatically like "CONFIG_DEFAULT_< package>=y" when i chose this profile in menuconfig, so i don't need enable all this packages manually.
Does such logic exist for enabling CONFIG_PACKAGE_ automatically for non-kernel?

yes, you can create a "seed" .config file with the minimal amount of configuration that you require. Typically, your (SUB)TARGET as well as any package you would have to manually configure using make menuconfig, and the run make defconfig. This will have the same result as the manual editing. See the first link in my previous post for more details.

1 Like