How to add a subtarget in openwrt style

There are a few documents related to adding subtarget on openwrt. But I am still not very clear about that. For a subtarget we need to have different settings of:

  1. uci config in /etc/config/ of some packages
  2. init script of some packages
  3. kernel configs
  4. openwrt package configs

It looks like that openwrt has a well design of 3 and 4. But how about 1 and 2?

Should I put uci config and init scripts in target/linux/target/subtarget/base-files? It will be overridden by package installation(if it has config and init script) right?

There should be plenty of examples in the existing (sub-)targets for most of these questions, as well as in the git history adding those (sub-)targets.

As is, your questions are a bit vague - in a way it depends on what's needed and why.

Actually, I have checked many of the subtargets in the OpenWrt source, but I didn't find the solution for customizing config files and init scripts.

Let's take a specific example. Suppose my platform has a customized config 'firewall'. I searched in the target/linux directory and found an example at at91/base-files/etc/config/firewall. It appears that the subtarget at91 uses this config as its customized one. However, from the package firewall Makefile, I found that the package will copy its own config 'firewall' to /etc/config when installing. Therefore, the one in base-files will be overridden.

What's the standard way to add customized configs?

Thanks remittor. It's a solution, but not for subtargets. Suppose I have subtarget1 and subtarget2, how can I place the config files?