User Tools

Site Tools


soft:howto-compile-a-stanard-openwrt

How to compile a standard (non-CONFINE image) OpenWRT

The Openwrt web page has a great tutorial on how to compile an openwrt image.

Please find it here: Getting the Source and the build system

Pre-requisites: link.

Note: In our example we build the settings for PC Engines Alix boards.

Quick copy & paste summary

# okay, in this example we stay with :attitude adjustment":
paulf@ssd:~$ git clone git://git.openwrt.org/12.09/openwrt.git
paulf@ssd:~$ cd openwrt

# get the extra packages as well
paulf@ssd:~/openwrt$ scripts/feeds update

# next we select the packages we want

paulf@ssd:~/openwrt$ make menuconfig
# now you have to select the packages. For our selection of packages (our .config) , please look [[XXXhere]]

# okay, we are ready to build... let's check how many CPUs we have:
paulf@ssd:~/openwrt$ cat /proc/cpuinfo | less
# in our case it is 4 CPUs
paulf@ssd:~/openwrt$ time make -j 4

# finished building... let's inspect where the images are
paulf@ssd:~/openwrt$ cd bin/x86

# okay, now you want to have more packages installed?
paulf@ssd:~/openwrt$ scripts/feeds install -a
paulf@ssd:~/openwrt$ make menuconfig
paulf@ssd:~/openwrt$ time make -j 4

How to install this image on an Alix board?

  1. fetch the image from bin/x86/openwrt-x86-alix2-combined-jffs2-128k.img (or a similar filesystem image)
  2. attach a CF card to your laptop
  3. write the image to the CF card (in this example , we assume the CF card is at /dev/sdX)
  4. dd if=openwrt-x86-alix2-combined-jffs2-128k.img of=/dev/sdX bs=128k
  5. insert the CF card into the Alix board
  6. attach a serial console to the Alix board. Usually this works by using a serial program such as minicom:
$ sudo minicom -s
# set it to 38400 Baud, 8N1 (Serial Port setup -> E) and no Hardware Flow Control and your proper serial device name (/dev/ttyUSB0 in our example)
$ sudo minicom 

minicom setup screenshot

  1. power up the Alix board and watch it boot
  2. log in by pressing enter
  3. set a root password
  4. configure the openwrt image:
# cd /etc/config
# vi network
  1. reboot and log in via ssh: root@ip address
  2. set up the other aspects of the image to your liking

If everything worked out you should see something like this:

openwrt booted

Nice tricks

From the things-you-thought-were-not-possible-department:

You can upgrade an openwrt system while it is running by fetching a new disk image via ssh and installing it on the very same hard disk (CF disk) that the system is running on! Then reboot. It works :)

(on the openwrt Alix box):

  ssh myuser@myremoteserver "dd if=openwrt-image-file.img" | dd of=/dev/sda bs=64k 
  sync 
  sync
  sync
  # wait 1 minute
  reboot

More documentation

soft/howto-compile-a-stanard-openwrt.txt · Last modified: 2014/03/16 18:39 by aaron