Using the Image Builder

The Image Builder is a precompiled OpenWrt build environment suitable to create custom images without compiling everything from scratch.

Reasons for using the Image Builder are:

  • Building minimal images for example without the web interface
  • Embedding packages directly into the squashfs to reduce space requirements on the target
  • Preconfigure images by embedding configuration files directly into squashfs

Download

For the release of OpenWrt 10.03 'Backfire', the ImageBuilder is built along with the target images and available for download on the server.

  • Browse to the OpenWrt download folder http://backfire.openwrt.org/10.03/
  • Click on your architecture, for example ar71xx when making an image for the WR1043ND
  • Download the ImageBuilder archive. Use i686 on 32 bit host systems or x86_64 for systems with 64 bit CPU
  • Extract the archive and change into the ImageBuilder directory
$ wget http://backfire.openwrt.org/...-for-Linux-i686.tar.bz2 $ tar -xjf OpenWrt-ImageBuilder-ar71xx-for-Linux-i686.tar.bz2 $ cd OpenWrt-ImageBuilder-ar71xx-for-Linux-i686/

Usage

The make image command will create a minimal image with just essential packages included, the behaviour can be controlled with three variables passed as arguments:

  • PROFILE - specifies the target image to build
  • PACKAGES - a list of packages to embed into the image
  • FILES - directory with custom files to include

See the sections below for an explaination.

After the make command is finished, the generated images are stored in the bin directory.

$ ls bin/ md5sums openwrt-wrt350n_v1-squashfs.bin openwrt-brcm-2.4-squashfs.trx openwrt-wrt54g-squashfs.bin openwrt-usr5461-squashfs.bin openwrt-wrt54g3g-em-squashfs.bin openwrt-wa840g-squashfs.bin openwrt-wrt54g3g-squashfs.bin openwrt-we800g-squashfs.bin openwrt-wrt54gs-squashfs.bin openwrt-wr850g-squashfs.bin openwrt-wrt54gs_v4-squashfs.bin openwrt-wrt150n-squashfs.bin openwrt-wrtsl54gs-squashfs.bin openwrt-wrt300n_v1-squashfs.bin

Profiles

Run make info to obtain a list of defined profiles:

$ make info Current Target: "brcm-2.4" Default Packages: base-files libgcc … kmod-switch kmod-diag nvram Available Profiles: Broadcom: Generic, Broadcom WiFi (default) Packages: kmod-brcm-wl wlc nas kmod-wlcompat BroadcomMimo: Generic, Broadcom WiFi (MIMO) Packages: kmod-brcm-wl-mimo wlc nas kmod-wlcompat None: Generic, No WiFi Packages: USBGeneric: Generic USB Packages: kmod-brcm-wl kmod-usb-core kmod-usb-ohci kmod-usb2 … WL500G: ASUS WL-500g Packages: kmod-brcm-wl kmod-usb-core kmod-usb-ohci kmod-lp … WL500GD: ASUS WL-500g Deluxe Packages: kmod-brcm-wl kmod-usb-core kmod-usb-uhci kmod-usb2 … WL500GP: ASUS WL-500g Premium Packages: kmod-brcm-wl kmod-usb-core kmod-usb-uhci-iv … WL700GE: WL-700gE Packages: -ppp -ppp-mod-pppoe -kmod-ipt-nathelper -iptables … WLHDD: WL-HDD Packages: kmod-brcm-wl kmod-usb-core kmod-usb-ohci … WRT54G3G: Linksys WRT54G3G Packages: kmod-brcm-wl kmod-usb-core kmod-usb-ohci kmod-usb2 …

… and pass the appropriate profile to the make command:

$ make image PROFILE=WL500GP

Packages

The PACKAGES variable specifies a list of packages to include when building an image. If a name is prefixed with - then the corresponding package will be excluded from the image.

$ make image PROFILE=WL500GP PACKAGES="nano openvpn -ppp -ppp-mod-pppoe"

Tip: The list of currently installed packages can be obtained with the command below:

root@OpenWrt:~# echo `opkg list_installed | awk '{ print $1 }'`

Files

A directory with custom files to add can be specified using the FILES variable. Custom files will replace default ones if necessary.

$ mkdir -p files/etc/config $ scp root@192.168.1.1:/etc/config/network files/etc/config/ $ scp root@192.168.1.1:/etc/config/wireless files/etc/config/ $ scp root@192.168.1.1:/etc/config/firewall files/etc/config/ $ make image PROFILE=WL500GP PACKAGES="nano openvpn -ppp -ppp-mod-pppoe" FILES=files/

Cleanup

To clean up temporary build files and generated images, use the make clean command.

Back to top

doc/howto/imagebuilder.txt · Last modified: 2010/06/30 17:56 by orca