Using build environments
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 "user@email.com"
Git requires some name and email address to work so we set them here.
A short help text with a list of commands:
./scripts/env help
Create a new environment named current:
./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:
./scripts/env diff
If you want to save these changes, run:
./scripts/env save
If you want to revert your changes to the previously saved copy, run:
./scripts/env revert
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:
./scripts/env clear