Image Generator (Image Builder)
| → go back to obtain.firmware |
If you do not want to download a prebuilt image or go through the entire compilation process, the alternative is to use Image Generator (formerly called Image Builder). This is a pre-compiled OpenWrt build environment suitable for creating custom images without the need for compiling.
Reasons for using Image Generator are:
- Embedding packages directly into the SquashFS to reduce space requirements on the target
- Preconfigure images by embedding packages and configuration files directly into SquashFS, and save manpower when flashing many devices
- Building minimal images. for example without the web interface
- Learning
Image Generator is the program that creates the OpenWrt firmware image file. In the process of compiling OpenWrt, Image Generator is coercively created (compiled), because it is needed to eventually create the image file. It is located in /openwrt/trunk/xxx and you can use it, to create more image-files from the packages you obtained during compilation.
But you can also simply download an archive which contains Image Generator and a whole load of packages from OpenWrt.
Download
For the release of OpenWrt 10.03.1 'Backfire', Image Generator is compiled along with the target images and available for download on the server. Note that ImageBuilder should be available for stable and for bleeding edge. If not, you have to compile it yourself.
- Browse to the OpenWrt download folder http://backfire.openwrt.org/10.03.1/ or
- to the bleeding edge download folder http://downloads.openwrt.org/snapshots/trunk/
- Click on your architecture, for example ar71xx
- 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
cd ~ wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/OpenWrt-ImageBuilder-ar71xx-for-Linux-i686.tar.bz2 tar -xvjf 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 behavior can be controlled with three variables passed as arguments:
PROFILE- specifies the target image to buildPACKAGES- a list of packages to embed into the imageFILES- directory with custom files to include
See the sections below for an explanation. 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
Pre-defined 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 |
Look for the image in the OpenWrt-ImageBuilder-ar71xx-for-Linux-i686/bin/ directory.
Adding/Modifying Profiles
The location of the profiles for the pre-compiled package for brcm47xx-for-Linux-i686 was target/linux/brcm47xx/profiles/
Remarkably, all that needs to be done to add a new profile, is to add a new file to the profiles directory.
Here is what the profiles/100-Broadcom-b43.mk profile file looks like:
define Profile/Broadcom-b43 NAME:=Broadcom BCM43xx WiFi (default) PACKAGES:=kmod-b43 kmod-b43legacy endef define Profile/Broadcom-b43/Description Package set compatible with hardware using Broadcom BCM43xx cards endef $(eval $(call Profile,Broadcom-b43))
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" |
Backfire 10.03.1-rc5 or later: ImageBuilder now uses opkg on the host to determine packages to install and to resolve their dependencies (which is especially useful if you use External Repositories), so the following warning does not apply!
Backfire 10.03 to 10.03.1-rc4: Using PACKAGES= will not install any of the default packages in your PROFILE. Be sure you include libuci. Without it uci won't work. Your router will boot but none of the interfaces will be configured effectively bricking your router (setting boot_wait first will let you recover via tftp).
Tip: The list of currently installed packages on your router can be obtained with the command below:
echo `opkg list_installed | awk '{ print $1 }'`
Tip: The list of packages present in the official image can be obtained with this command (on a Linux host; you may want to change the architecture):
echo $(wget -qO - http://backfire.openwrt.org/10.03.1/brcm-2.4/config | sed -ne 's/^CONFIG_PACKAGE_\([a-z0-9-]*\)=y/\1/ip')
Tip: If you want to remove some of the default packages (for e.g. you do not need pppoe related packages), consult with the DEFAULT_PACKAGES and DEFAULT_PACKAGES.router section in the include/target.mk file.
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.
External Repositories
Trunk revisions since r22978 support external repositories in Image Generator. This option will be part of the final 10.03.1 release.
To add external package repositories, edit the repositories.conf file in the toplevel directory. Sources are specified in opkg native config format.
For earlier versions of Image Generator, external packages can be downloaded into the packages/ directory. Image Generator will pick them up during index creation.
doc/howto/obtain.firmware.generate.txt · Last modified: 2012/05/06 17:49 by sup