OpenWrt provides a means of building images for multiple configurations which can use multiple targets in one single checkout. These environments store a copy of the .config file generated by make menuconfig and the contents of the ./files folder. The script ./scripts/env is used to manage these environments, it uses git (which needs to be installed on your system) as backend for version control.
Setting up git
git config --global user.name "Your Name" git config --global user.email "firstname.lastname@example.org"
Git requires some name and email address to work so we set them here.
produces a short help text with a list of commands.
To create a new environment named current, run the following command
./scripts/env new current
This will move your .config file and ./files (if it exists) to the env/ subdirectory and create symlinks in the base folder.
After running make menuconfig or changing things in files/, your current state will differ from what has been saved before. To show these changes, use:
If you want to save these changes, run:
If you want to revert your changes to the previously saved copy, run:
If you want, you can now create a second environment using the new command. It will ask you whether you want to make it a clone of the current environment (e.g. for minor changes) or if you want to start with a clean version (e.g. for selecting a new target).
To switch to a different environment (e.g. test1), use:
./scripts/env switch test1
To rename the current branch to a new name (e.g. test2), use:
./scripts/env rename test2
If you want to get rid of environment switching and keep everything in the base directory again, use: