User Tools

Site Tools

This wiki is read only and for archival purposes only. >>>>>>>>>> Please use the new OpenWrt wiki at <<<<<<<<<<

amb script



This script was only tested by its author.


The amb script has a similar purpose as the env script currently used in OpenWrt. It based on env but adds new features to make it possible to track a whole OpenWrt configuration. env does only track changes to the .config file and the files/ directory. The amb script permits to track arbitrary files in git. It also implements SVN support (it saves the current revision and url of the core checkout and the feeds when you do "amb save" and restores the environment to the saved state if you do "amb switch"). So you can save a coherent and reproducible state of the environment.


You can download the script here: The downloaded file should be copied into the scripts directory of the OpenWrt checkout.

A patch for OpenWrt is also available:


For example with amb it is possible to track a adm5120 configuration like this:

Create of new branch

amb new adm5120

This creates a new git branch and adds the .config, feeds.conf and files/ to it. It also adds information about the svn revisions used for the OpenWrt base directory and the configured feeds.

Add files

Add configuration for an adm5120 router

amb add target/linux/adm5120/Makefile
amb add target/linux/adm5120/router_le/config-2.6.32

Add build images

amb add bin/adm5120/openwrt-adm5120-br-6104kp-squashfs-xmodem.bin
amb add bin/adm5120/openwrt-adm5120-rootfs.tgz

Clone environment

Like in the env script you can also base you new configuration on the old one by anwsering "y" to "Do you want to clone the current environment"

amb new adm5120-
(respond "y" when ask to clone)
(edit KERNEL_VERSION to in target/linux/adm5120/Makefile)
evn2 save

Now you have two branches, one configured for the default kernel, one for the kernel.

Create another branch

If you now want to work on another router, say an ar71xxx you would do the following:

amb new ar71xx
amb add target/linux/ar71xx/Makefile
amb add target/linux/ar71xx/config-2.6.32

Switch braches

To switch back to the adm5120 configuration you can do

amb switch adm5120

The switch command in amb does remove the symlinked files of the current branch from the OpenWrt base directory, switches to the new branch and symlinks the files of the new branch to the OpenWrt base directory.

After that it checks if the new SVN URL differs from the old one and performs a "svn switch" if necessary. If the SVN Revision differs a "svn update -r $REV" is also peformed. After that it runs "scripts/feeds/update -i" and "make package/symlinks". Finally it deletes all unwanted files that came along with the svn update (see "amb unwanted").

Information about branch

To see information the current branch (SVN URL and Revision, branch name)

amb info

Remove files from branch

To remove a file from the branch (AND the environment)

amb remove target/linux/ar71xx/Makefile

GIT diff wrapper

The amb script also wraps "git diff", so you can do:

amb gdiff adm5120 adm5120- --summary

Disable amb script

amb symlinks like env all files from the amb directory to the OpenWRT base directory. To remove the symlinks and copy all files from you current branch to the OpenWrt base directory do

amb disable

Keep unwanted files from being restored

Because the script restores automatically SVN revisions there might be some files you have deleted. For example patches you do not want to apply. With amb you can automatically remove these files using the following commands

amb unwanted package/opkg/patches/009-remove-upgrade-all.patch

This will delete the patch everytime when a SVN update pulls it in. If you decide that you want this file again you can do:

amb rewanted package/opkg/patches/009-remove-upgrade-all.patch

To list all files you added to the unwanted list, execute:

amb listunwanted

(Note: there might be a more general, better way to do this in the implementation. This is just a quick hack to also permit keeping track of deletions.)

The rest of the commands are the same as in you know them from the env script.

Files missing after switch/new

It may occur that files you added to one branch are missing in another branch after doing a switch (or new). This is because amb deletes all files from the current branch before switching to the new one. Usually a svn update brings back all the deleted files. A special case is the .config file which is not restored by the svn update. Because of this the script removes the symlink to amb/.config and copies the amb/.config file to .config.

Path independence

The amb assumes that it is located in the scripts/ directory below the OpenWrt base directory. By doing so it is possible to call it independently from the current $(PWD). So you might just add the scripts directory to you $PATH and amb should work from anywhere.


You can uncomment DISABLE_SVN in the script if you do not want to use the SVN revision tracking mechanism. The amb script uses the amb directory in the OpenWrt checkout as working directory. The list of unwanted files is kept in amb/.unwanted. The information about the current SVN state is kept in amb/.svninfo and for each of the enabled feeds in amb/feeds/$FEEDNAME/.svninfo

inbox/amb.script.txt · Last modified: 2010/04/27 10:54 (external edit)