Difference between revisions of "Mesh/Build An OpenWRT Image"

From Sudo Room
Jump to navigation Jump to search
(added proxy builds)
Line 44: Line 44:


=Building an OpenWRT image using a proxy=
=Building an OpenWRT image using a proxy=
Those interested in building firmware on the local network, but want all the files to be updated through our specified server (or repository), then here's the process. It allows the code to be lock a specific firmware version, audit that version, compare it to other version, and save bandwidth on the network.


These are the scripts to support using a proxy to build OpenWRT.
These are the scripts to support using a proxy to build OpenWRT.
Line 49: Line 51:
They're ugly and hackish. They do not yet automirror downloaded files, which would be rather important.
They're ugly and hackish. They do not yet automirror downloaded files, which would be rather important.


Assumptions:
Assumptions: User 'sudomesh' builds the firmware.  User 'sudomirror' maintains the mirror. A third user has root.


User 'sudomesh' builds the firmware.  User 'sudomirror' maintains the mirror.
There is an http server on localhost, and ~/public_html/ maps to ~username URLs.
A third user has root.


There is an http server on localhost, and ~/public_html/ maps to ~username
~/bin/ is in your path ahead of system-wide binaries.
URLs.


~/bin/ is in your path ahead of systemwide binaries.
To use the proxy:  
 
Download the build proxy source from... (urls pending)
To use:
copy sudomesh-bin/* into ~sudomesh/bin/
copy sudomesh-bin/* into ~sudomesh/bin/
copy sudomirror-bin/* into ~sudomirror/bin/
copy sudomirror-bin/* into ~sudomirror/bin/
As sudomesh, check out the OpenWRT firmware (before the firewall is up!)
As sudomesh, check out the OpenWRT firmware (before the firewall is up!)
run firewall.sh as root.
run firewall.sh as root.
As sudomirror, mkdir -p ~/public_html/mirror/svn/
As sudomirror, prep-cloneserver.sh
As sudomirror, start ~/bin/build-proxy.py and ~/bin/cloneserver.py
As sudomirror, start ~/bin/build-proxy.py and ~/bin/cloneserver.py
As sudomesh, cd to the openwrt-firmware dir and run ./prepare
As sudomesh, cd to the openwrt-firmware dir and run ./prepare
---
OLD MANUAL CLONE INSTRUCTIONS:
To clone a Git repository into the mirror (we're assuming you're starting
by cloning https://github.com/sudomesh/openwrt-firmware.git and that your umask
is 022)
As the mirror user:
mkdir -p ~/public_html/mirror/https/github.com/sudomesh/openwrt-firmware.git
cd ~/public_html/mirror/https/github.com/sudomesh/openwrt-firmware.git
git --bare init
git --bare fetch https://github.com/sudomesh/openwrt-firmware.git master:master
git update-server-info
)
To clone a Subversion repo into the mirror, as the mirror user:
cd ~/public_html/mirror/svn/ (Create it if needed)
mkdir -p svn.openwrt.org/openwrt/branches/attitude_adjustment
svnadmin create svn.openwrt.org/openwrt/branches/attitude_adjustment
echo '#!/bin/sh' >svn.openwrt.org/openwrt/branches/attitude_adjustment/hooks/pre-revprop-change
chmod 755 svn.openwrt.org/openwrt/branches/attitude_adjustment/hooks/pre-revprop-change
svnsync init file://$PWD/svn.openwrt.org/openwrt/branches/attitude_adjustment svn://svn.openwrt.org/openwrt/branches/attitude_adjustment
svnsync sync file://$PWD/svn.openwrt.org/openwrt/branches/attitude_adjustment


CRITICAL NOTE: These assume that git and svnsync do not ever execute code
CRITICAL NOTE: These assume that git and svnsync do not ever execute code
downloaded from the remote.  I do not know if this is true.
downloaded from the remote.  I do not know if this is true.

Revision as of 23:02, 27 March 2014

Building an OpenWRT image

If you already have a image of the operating system (firmware), then you can skip this step. If your router has the stock software, then you'll probably have to use a factory image, which has information in the header which allows you to install it. Otherwise, you'll be using a sysupgrade image (trx image).

Step One: Install Buildroot

The Buildroot is software which will creates your firmware. The Buildroot has feeds associated with it that allow you to add more to your firmware. The feeds are comparable to repositories in linux. There's a full guide at OpenWRT, this is a shorter version.

  • Install svn and git.
    $ sudo apt-get install subversion build-essential
    $ sudo apt-get install git-core
  • Make a new directory and download the Buildroot.
    $ mkdir ~/openwrt
    $ cd ~/openwrt
    $ git clone git://git.openwrt.org/openwrt.git
  • Update Buildroot and install feeds.
    $ cd ~/openwrt/openwrtt
    $ ./scripts/feeds update -a
    $ ./scripts/feeds install -a (if you want to install all feeds)
  • Update and Install the Buildroot dependencies
    $ make defconfig (build list of dependencies)
    $ make prereq (install dependencies)

If you're still missing software, then you'll have to manually install it.

Step Two: Install Feeds

There are other feeds than the standard that you may want to be available to Buildroot. These are the suggested feeds for nodes:

  • Find the drivers for your device
    Determine drivers for your router based on the chipset (ex. Atheros AR9331)
    Download the driver for the node. (ex. Ath9k)
  • Install the driver feed
    $ ./scripts/feeds install <PACKAGENAME> (ex. kmod-ath9k)

Other feeds for OpenWRT.

Step Three: Build the Firmware

  • Run the Buildroot
    $ make menuconfig
  • Configure the firmware (needs it's own article)
    Kernel Modules > Network Support > kmod-ipsec

Building an OpenWRT image using a proxy

Those interested in building firmware on the local network, but want all the files to be updated through our specified server (or repository), then here's the process. It allows the code to be lock a specific firmware version, audit that version, compare it to other version, and save bandwidth on the network.

These are the scripts to support using a proxy to build OpenWRT.

They're ugly and hackish. They do not yet automirror downloaded files, which would be rather important.

Assumptions: User 'sudomesh' builds the firmware. User 'sudomirror' maintains the mirror. A third user has root.

There is an http server on localhost, and ~/public_html/ maps to ~username URLs.

~/bin/ is in your path ahead of system-wide binaries.

To use the proxy: Download the build proxy source from... (urls pending) copy sudomesh-bin/* into ~sudomesh/bin/ copy sudomirror-bin/* into ~sudomirror/bin/ As sudomesh, check out the OpenWRT firmware (before the firewall is up!) run firewall.sh as root. As sudomirror, prep-cloneserver.sh As sudomirror, start ~/bin/build-proxy.py and ~/bin/cloneserver.py As sudomesh, cd to the openwrt-firmware dir and run ./prepare

CRITICAL NOTE: These assume that git and svnsync do not ever execute code downloaded from the remote. I do not know if this is true.