Newcomer build questions about target-specific init script and config files

Hi, i'm newly getting into OpenWRT and have a bunch questions about using the build system. I searched around but can't find good answers and i'm hoping someone here might know.

  1. How can i set target-specific init scripts? For instance, say i'm building target A and B, and i want them to do slightly different things when populating the default config; could be say different WiFi SSIDs. What'd be a place to do that?
    I read the wiki has mention to arch-specific preinit, but that won't distinguish different targets within the same arch, right?

  2. Also target-specific, where to override default "/etc" files? Say if i want a fstab entry that'd mount a NFS share from my computer but different path for different target. Also say i want target-specific config/network. What are the places to put those files in the source?

  3. how to change default build config file for each target? Say i want to, by default, to have make menuconfig to always start with something already with vim-fuller and tmux included when building target A; but only vim-full for target B. best way to do that?

Thanks!

uci-defaults,and query the device or a system file (i.e. /etc//os-release).

Nice, thanks! Checked wiki page and it does look like would achieve what i want.

Also check out the env script, that lets you manage various configurations:

$ scripts/env help
Usage: scripts/env [options] <command> [arguments]
Commands:
        help              This help text
        list              List environments
        clear             Delete all environment and revert to flat config/files
        new <name>        Create a new environment
        switch <name>     Switch to a different environment
        delete <name>     Delete an environment
        rename <newname>  Rename the current environment
        diff              Show differences between current state and environment
        save [message]    Save your changes to the environment, optionally using
                          the given commit message
        revert            Revert your changes since last save