→ 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.
Image Generator will not run on 32bit platform such as i686. You need 64bit linux such as amd64, see ticket. You can however run amd64 in VM (i.e. virtualbox) even from 32bit windows.
Reasons for using Image Generator are:
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. This archive containes binaries running on amd64 linux.
https://downloads.openwrt.org/chaos_calmer/15.05.1/
Example: Chaos Calmer for ar71xx architecture
cd ~ mkdir openwrt && cd openwrt wget https://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/OpenWrt-ImageBuilder-15.05.1-ar71xx-generic.Linux-x86_64.tar.bz2 tar -xvjf OpenWrt-ImageBuilder-15.05.1-ar71xx-generic.Linux-x86_64.tar.bz2 cd OpenWrt-ImageBuilder-15.05.1-ar71xx-generic.Linux-x86_64
The Image Generator has to be configured for downloading missing packages from official or custom repositories. Otherwise the image generation fails with an error of a missing package. The package sources are configured in the repositories.conf
file in the toplevel directory. Sources are specified in opkg native config format. This can be either the official package repositories or custom generated repositories.
As of May/17 The luci, routing, telephony & management repositories for 15.05.01 packages repositories are empty. A workarround is to use paths to equivalent 15.05 repositories.
EXAMPLE: To use all official package repositories for ar71xx the repositories.conf should look like:
## Place your custom repositories here, they must match the architecture and version. # src/gz chaos_calmer http://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/packages # src custom file:///usr/src/openwrt/bin/ar71xx/packages src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/packages/base src/gz chaos_calmer_luci http://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/packages/luci src/gz chaos_calmer_management http://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/packages/management src/gz chaos_calmer_packages http://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/packages/packages src/gz chaos_calmer_routing http://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/packages/routing src/gz chaos_calmer_telephony http://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/packages/telephony ## This is the local package repository, do not remove! src imagebuilder file:packages
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 includeDependencies for "make"
Debian/Ubuntu
apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc wget
CentOS/RHEL
yum install subversion git gawk gettext ncurses-devel zlib-devel openssl-devel libxslt wget yum group install "Development Tools"
Syntax:
$ make image PROFILE=XXX PACKAGES="pkg1 pkg2 pkg3 -pkg4 -pkg5 -pkg6" FILES=files/
See the sections below for an explanation. After the make command is finished, the generated images are stored in the bin/architecture directory.
The example below shows the contents of bin/ directory after successfully generating an OpenWrt Barrier Breaker image for WNDR3700. The architecture for WNDR3700 is ar71xx, so the exact location of the image is bin/ar71xx |
user@linux:~/openwrt/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_64$ ls -aR bin bin: . .. ar71xx bin/ar71xx: . openwrt-ar71xx-generic-vmlinux-lzma.elf .. openwrt-ar71xx-generic-wndr3700-squashfs-factory.img md5sums openwrt-ar71xx-generic-wndr3700-squashfs-factory-NA.img openwrt-ar71xx-generic-rootfs.tar.gz openwrt-ar71xx-generic-wndr3700-squashfs-sysupgrade.bin openwrt-ar71xx-generic-root.squashfs openwrt-ar71xx-generic-wndr3700v2-squashfs-factory.img openwrt-ar71xx-generic-root.squashfs-64k openwrt-ar71xx-generic-wndr3700v2-squashfs-sysupgrade.bin openwrt-ar71xx-generic-uImage-gzip.bin openwrt-ar71xx-generic-wndr3800-squashfs-factory.img openwrt-ar71xx-generic-uImage-lzma.bin openwrt-ar71xx-generic-wndr3800-squashfs-sysupgrade.bin openwrt-ar71xx-generic-vmlinux.bin openwrt-ar71xx-generic-wndrmac-squashfs-factory.img openwrt-ar71xx-generic-vmlinux.elf openwrt-ar71xx-generic-wndrmac-squashfs-sysupgrade.bin openwrt-ar71xx-generic-vmlinux.gz openwrt-ar71xx-generic-wndrmacv2-squashfs-factory.img openwrt-ar71xx-generic-vmlinux.lzma openwrt-ar71xx-generic-wndrmacv2-squashfs-sysupgrade.bin
Syntax:
$ make image PROFILE=NAMEOFPROFILE
Run make info
to obtain a list of defined profiles.
Example output from make info
is listed below.
After you find the appropriate profile pass it to the make image
command:
EXAMPLE: for WNDR3700 (Atheros ar71xx architecture).
This will build OpenWrt for WNDR3700 with a bare-minumum feature set due to PACKAGES variable not being defined. For information on how to include or exclude packages, see PACKAGES Variable |
$ make image PROFILE=WNDR3700
Then you would look for the image in the OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486/bin/
directory.
Note that at least for the ar71xx architecture the image generation is tied to the profile names. If you add a new profile without also adding an appropriate macro to the image Makefile, no suitable firmware file will get generated when using the custom profile. | |
Make sure to remove the /tmp directory to get modified package selection from profiles to work. |
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))
The PACKAGES
variable specifies a list of packages to include and/or exclude when building an image with Image Generator.
Syntax:
NOTE: If the package name is prefixed with -
then the corresponding package will be excluded from being built during make image
.
The example below will include pkg1, pkg2, pkg3, and exclude pkg4, pkg5, pkg6.
$ make image PROFILE=XXX PACKAGES="pkg1 pkg2 pkg3 -pkg4 -pkg5 -pkg6"
Backfire 10.03.1-rc5 or later: Image Generator 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 running OpenWrt can be obtained with the command below:
echo $(opkg list_installed | awk '{ print $1 }')
Tip: The list of packages present in the current release of OpenWrt, Barrier Breaker 14.07, can be obtained with this Linux command:
NOTE: Example is for ar71xx. Change the architecture and name of the config file as necessary.
echo $(wget -qO - http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/config.ar71xx_generic | 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.
Tip: External packages compatible with a given build (if you cannot use images from http://downloads.openwrt.org/ because you have compiled from trunk and trunk has changed since you compiled your image) can be found in packages
directory.
The FILES
variable allows custom configuration files to be included in images built with Image Generator. This is especially useful if you need to change the network configuration from default before flashing.
Syntax:
$ make image PROFILE=XXX PACKAGES="XXX" FILES=files/
The following example shows:
scp
to transfer uci
configuration files from an OpenWrt router to the files/etc/config
directoryuci
configuration files
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/
Note: The files/
folder must be in the same folder where you issue the make command.
To clean up temporary build files and generated images, use the make clean
command.
1. Create file 'files_remove' with full filenames:
/lib/modules/3.10.49/ts_bm.ko /lib/modules/3.10.49/nf_nat_ftp.ko /lib/modules/3.10.49/nf_nat_irc.ko /lib/modules/3.10.49/nf_nat_tftp.ko
2. Patch Makefile
ifneq ($(USER_FILES),) $(MAKE) copy_files endif + +ifneq ($(FILES_REMOVE),) + @echo + @echo Remove useless files + + while read filename; do \ + rm -rfv "$(TARGET_DIR)$$filename"; \ + done < $(FILES_REMOVE); +endif + $(MAKE) package_postinst $(MAKE) build_image
3. Rebuild firmware
# make image \ PROFILE=TLWR841 \ PACKAGES="igmpproxy ip iptraf kmod-ipt-nathelper-extra openvpn-polarssl tcpdump-mini -firewall -ip6tables -kmod-ip6tables -kmod-ipv6 -odhcp6c -ppp -ppp-mod-pppoe" \ FILES_REMOVE="files_remove"
It is possible to build the Image Generator from the sources from scratch:
:~/openwrt/trunk> svn up :~/openwrt/trunk> rm .config :~/openwrt/trunk> make menuconfig
In the graphical configuration, select Global Build Settings → Select all packages by default
, exit and save.
Then build the image, including IGNORE_ERRORS=1
as there might be unmaintained packages that fail to compile.
:~/openwrt/trunk> make IGNORE_ERRORS=1
Note: Don't call make defconfig
or leave an old .config
file in the path as Select all packages by default
will only set the package selection to [m]
for packages that are not already configured otherwise!(make defconfig
will set most packages to [n]
, i.e. do not build.)