Helper scripts to build RMerl/asuswrt-merlin without much extra typing.
Last tested on master
from RMerl/asuswrt-merlin as of 2015-02-11. The script takes care of the steps mentioned above for Ubuntu 13.10 and newer. In addition it does fixups to the source tree which ensure that it can run without superuser rights as long as the user makes sure all the packages are installed. It will also check for the packages being installed and bail out with a meaningful error message if not.
It can be run in two modes: with or without sudo
involved. With sudo
it will use the symbolic link method inside /opt
, whereas without it will modify the files in the source tree to adjust hardcoded paths.
If you are running inside a tmux
pane, this will also pipe the output into a log file (see Environment variables).
All were amd64 (x86_64).
./debian-build-image <router-model> [path-to-asuswrt-merlin]
sudo
: USE_SUDO=1 ./debian-build-image <router-model> [path-to-asuswrt-merlin]
You can leave out the path-to-asuswrt-merlin
argument and the script will check the folder it resides in for a marker file (README-merlin.txt
) to see whether this is the expected source tree.
The *R and *W variants of the routers are also supported. R is for retail versions and W for white models. The firmware is the same. The router name can be given in upper or lower case and you can leave out the trailing U, R or W.
Some environment variables influence how the script behaves:
USE_SUDO
will cause the image creation process to assume that sudo
is available to symlink the toolchain into /opt
. This is useful if for some reason the unprivileged method fails or if you simply prefer to stick closer to the process explained on the RMerl/asuswrt-merlin wiki.FORCE_UNSUPPORTED
can be used to run the script on otherwise not explicitly supported Debian flavors.TMUX_PANE
is used to sense the presence of a tmux
session and will turn on logging. To inhibit this behavior, make sure to either unset
this variable or to give it an empty value during invocation (i.e. TMUX_PANE= ./debian-build-image
...).You can either set the environment variable globally by exporting it prior to the invocation, e.g.:
export USE_SUDO=1
./debian-build-image RT-N66U
... or by passing it on the command line like so:
USE_SUDO=1 ./debian-build-image RT-N66U
In order to have the script install all the prerequisites using apt-get
, use the following method:
./debian-build-image -p <router-model>
(or --prereq
instead of -p
)Please note that this requires you to be a sudoer. Usually that means you need to be a member of the group sudo
on .deb
-based distros or wheel
on .rpm
-based distros.
NOTE: Strictly speaking the command should also work without the router model given, but it may miss some model-specific prerequisites in such a case. As an example: ARM routers require libelf1:i386
because the gcc
of the ARM toolchain depends on it.
git
installed, otherwise do sudo apt-get --no-install-recommends install git git-man
.~
).git clone git@github.com:RMerl/asuswrt-merlin.git
git clone https://github.com/RMerl/asuswrt-merlin.git
debian-build-image
script:
git clone git@github.com:assarbad/build-asuswrt-merlin.git
git clone https://github.com/assarbad/build-asuswrt-merlin.git
wget https://raw.githubusercontent.com/assarbad/build-asuswrt-merlin/master/debian-build-image && chmod +x debian-build-image
debian-build-image
into the clone of RMerl/asuswrt-merlin (e.g. ~/asuswrt-merlin
).~/asuswrt-merlin
) and invoke ./debian-build-image --prereq
there.
sudo
command to install all prerequisites. This command does not check before whether some packages are missing, though. Remember that this requires you to be a sudoer!Well, the syntax has been explained above. Running the script is as easy as invoking (from our previous example):
~/asuswrt-merlin/debian-build-image RT-N66U
The name of the router is case-insensitive. Also, it handles the models with their U, R, and W prefixes.
At this point you'll probably want to take a break and come back later. This will take quite a while.
git reset --hard
inside the cloned repository to undo all the changes debian-build-image
doesIt should be easiest way to build firmware in virtual machine using Vagrant.
First run a virtual machine:
vagrant up
Second look for some firmware release version on releases page and build an image for desired router model:
vagrant ssh -- compile-image -m RT-N66U -r 378.55
Then wait for cloning sources from GitHub into VM, building an image and copying it to release/
directory.
You can build firmware from any Git branch, for example 'master':
vagrant ssh -- compile-image -m RT-N66U -r master
At the end, stop VM:
vagrant halt
or remove it completely:
vagrant destroy
Please contribute by reporting issues and sending pull requests.
Oh and feel free to fork or embed this into your repository.
This work is released into the public domain. See LICENSE. If public domain is not a recognized legal concept in your jurisdiction, treat as CC0; which should have the proper wording for many jurisdictions. The disclaimer from LICENSE
(second to last paragraph) still applies.
If neither of these suite your needs, please ask by opening a ticket.
You can get in touch with me via my contact form (or one of the listed contact options there).