User Tools

Site Tools


docs:guide-developer:env

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.

The command

  ./scripts/env help

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:

  ./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 
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/guide-developer/env.txt · Last modified: 2018/02/17 17:22 by bobafetthotmail