assarbad / build-asuswrt-merlin

Helpers to build RMerl/asuswrt-merlin without much extra typing
The Unlicense
43 stars 19 forks source link

build-asuswrt-merlin

Helper scripts to build RMerl/asuswrt-merlin without much extra typing.

Summary

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).

Supported distributions

All were amd64 (x86_64).

Syntax

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.

Supported router models

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.

MIPS-based routers

ARM-based routers

Environment variables

Some environment variables influence how the script behaves:

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

Special syntax for prerequisites

In order to have the script install all the prerequisites using apt-get, use the following method:

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.

Usage on Debian, Linux Mint and Ubuntu

Preparation

Building an image

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.

Starting over

Usage with Vagrant

It 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

Contribute

Please contribute by reporting issues and sending pull requests.

Oh and feel free to fork or embed this into your repository.

License

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.

Contact

You can get in touch with me via my contact form (or one of the listed contact options there).