This repository allows you to create your own OpenWRT images using Debian running in a Virtual Machine (VM).
The VM is configured automatically using Vagrant (https://vagrantup.com).
Download and install Vagrant for your operating system.
Download and install VirtualBox for your operating system.
Open the Vagrantfile
with a text editor. Update the following VM parameters depending on the number of CPU cores and RAM you have. Do not assign all RAM to the VM or your computer may become very unresponsive.
vb.cpus = 4
vb.memory = "6144"
(6 GB)
Open a terminal and go to the directory containing the Vagrantfile
, then type:
vagrant up
This should download a Debian VM and download the OpenWRT git repository. When finished, the next steps are shown:
==> default: openwrt setup complete. now type:
==> default: vagrant ssh
==> default: cd openwrt.git
==> default: make menuconfig
==> default: make -j4 V=99
==> default:
==> default: after compilation has finished, copy the result to the host machine:
==> default: cp bin/*/*.{bin,img} /vagrant_data/build
==> default: cp .config /vagrant_data/build/config
The above commands allow you to configure all OpenWRT options using menuconfig. If you already have an OpenWRT config file, you can use this method to build it directly, with no configuration necessary:
Name the config file to openwrt.config.autobuild
and place it next to the Vagrantfile
.
In the build logs, look for using configuration file openwrt.config.autobuild
to be sure the config file is used.
Some platforms, like Raspberry Pi, require to copy the OpenWRT image to an SD card.
On OS X, this can be done with the following commands:
- Show available hard disks before adding the SD card:
diskutil list
- Attach empty 4 GB micro SD card to OSX
- Show available hard disks after adding the SD card:
diskutil list
- In this example, the SD card showed up as /dev/disk4. Change disk number in the following commands to match your setup. IMPORTANT: don't mix up disk numbers, you could delete all your data!
- Unmount the SD card:
diskutil unmount /dev/disk4s1
- Copy the openwrt image to the SD card:
sudo dd if=openwrt-*.img of=/dev/disk4 bs=1m
- Press ctrl-t to get the status. If it says
156+0 records out
this means that 156 MB have been copied. - Unmount the sd card, again:
diskutil unmount /dev/disk4s1
Some platforms require to flash the OpenWRT to the router using TFTP.
On OS X, this can be done like this:
-
Disconnect from all Wifi and Ethernet networks
-
Set a static IP to your Ethernet device in systems settings. Look up the exact IP depending on your model in the OpenWRT wiki. This example will use
192.168.3.2
with a netmask of255.255.255.0
-
Change to the directory containing your OpenWRT image
-
Start tftp with the IP of the router, in this example
192.168.3.1
:tftp 192.168.3.1
binary trace put openwrt-*.trx
You only have to use this section if you want to change the OpenWRT version used.
Lookv up latest OpenWRT version on http://wiki.openwrt.org/about/history
Current (as of April 2016):
chaos calmer 15.05.1, svn r48532
The corresponding svn commit for the 15.05.1 release:
https://dev.openwrt.org/changeset/48532
Search for the above svn commit by entering "48532" in the search box on:
http://git.openwrt.org/?p=15.05/openwrt.git;a=summary
After searching for "48532", press on the link called "commit" to see the git commit hash:
commit 87e9837a818a71f39c445ee33569279bd78451de
In the Vagrantfile of this repository, update the variable called GIT_HASH
:
export GIT_HASH=87e9837a818a71f39c445ee33569279bd78451de