Giter Site home page Giter Site logo

openwrt-vagrant's Introduction

Creating OpenWRT images with Vagrant

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

Getting Started

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

Building an existing configuration

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.

Install Option 1: Copying to an SD card

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

Install Option 2: TFTP

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 of 255.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

Updating OpenWRT

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

openwrt-vagrant's People

Contributors

tamsky avatar

Watchers

 avatar  avatar  avatar

openwrt-vagrant's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.