Differences

This shows you the differences between two versions of the page.

doc:howto:obtain.firmware.generate [2013/03/24 22:32]
hcc23 Added how to build the Image Generator from the sources
doc:howto:obtain.firmware.generate [2014/01/18 01:43] (current)
jr Variable name is "FILES", not "Files" as shown in example.
Line 5: Line 5:
Reasons for using **Image Generator** are: Reasons for using **Image Generator** are:
- 
  * Embedding packages directly into the SquashFS to reduce space requirements on the target   * 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   * Preconfigure images by embedding packages and configuration files directly into SquashFS, and save manpower when flashing many devices
Line 17: Line 16:
---- ----
-===== Download ===== +===== Download OpenWrt Attitude Adjustment 12.09 ===== 
-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.+[[http://downloads.openwrt.org/attitude_adjustment/12.09/]] 
 +  * Click on your architecture, for example //ar71xx// 
 +  * Download the ImageBuilder archive. 
 +  * Extract the archive and change into the ImageBuilder directory 
 +Example: Attitude Adjustment for ar71xx architecture 
 +<WRAP prewrap 1000px> 
 +<code> 
 +cd ~ 
 +mkdir openwrt && cd openwrt 
 +wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2 
 +tar -xvjf OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2 
 +cd OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486 
 +</code> 
 +</WRAP> 
 +===== Download OpenWrt Barrier Breaker (Bleeding Edge Snapshots) EXPERIMENTAL ===== 
 +|{{:meta:icons:tango:48px-dialog-warning.svg.png?nolink&24}}|**WARNING** The link below is for bleeding edge snapshots of OpenWrt. Development snapshots include experimental changes to OpenWrt that are considered unstable. The current stable release is OpenWrt Attitude Adjustment 12.09. |
-  * Browse to the OpenWrt download folder [[http://backfire.openwrt.org/10.03.1/]] or +[[http://downloads.openwrt.org/snapshots/trunk/]]
-  * to the bleeding edge download folder [[http://downloads.openwrt.org/snapshots/trunk/]]+
  * Click on your architecture, for example //ar71xx//   * 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+  * Download the ImageBuilder archive.
  * Extract the archive and change into the ImageBuilder directory   * Extract the archive and change into the ImageBuilder directory
 +Example: Barrier Breaker for ar71xx architecture
 +<WRAP prewrap 1000px>
<code> <code>
cd ~ cd ~
-wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/OpenWrt-ImageBuilder-ar71xx-for-Linux-i686.tar.bz2 +mkdir openwrt && cd openwrt 
-tar -xvjf OpenWrt-ImageBuilder-ar71xx-for-Linux-i686.tar.bz2 +wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_64.tar.bz2 
-cd OpenWrt-ImageBuilder-ar71xx-for-Linux-i686/+tar -xvjf OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_64.tar.bz2 
 +cd OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_64
</code> </code>
 +</WRAP>
===== Usage ===== ===== Usage =====
Line 39: Line 56:
  * //''FILES''// - directory with custom files to include   * //''FILES''// - 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.+Syntax:
 +<WRAP prewrap 1000px>
<code> <code>
-ls bin/ +$ make image PROFILE=XXX PACKAGES="pkg1 pkg2 pkg3 -pkg4 -pkg5 -pkg6" FILES=files/
-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+
</code> </code>
 +</WRAP>
 +See the sections below for an explanation. After the make command is finished, the generated images are stored in the bin///architecture// directory.
-==== Profiles =====+|{{:meta:icons:tango:dialog-information.png?nolink&24}}|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''| 
 +<WRAP prewrap 1000px> 
 +<code> 
 +user@linux:~/openwrt/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_64$ ls -aR bin 
 +bin: 
 +.  ..  ar71xx
-=== Pre-defined Profiles === +bin/ar71xx: 
-Run ''make info'' to obtain a list of defined profiles:+.                                        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 
 +</code> 
 +</WRAP>
 +==== PROFILE Variable =====
 +Syntax:
 +<WRAP prewrap 1000px>
<code> <code>
-make info +$ make image PROFILE=NAMEOFPROFILE
-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 ...+
</code> </code>
 +</WRAP>
-... and pass the appropriate profile to the //make// command:+=== Pre-defined Profiles === 
 +Run ''make info'' to obtain a list of defined profiles. 
 +Example output from ''make info'' is listed below.
-| ''make image **PROFILE=WL500GP**'' |+== brcm47xx Profiles == 
 +[[http://pastebin.com/5L7Pzq7N|brcm47xx Image Generator Profiles]] 
 + 
 +== ar71xx Profiles == 
 +[[http://pastebin.com/WbudpBDJ|ar71xx Image Generator Profiles]] 
 + 
 +After you find the appropriate profile pass it to the ''make image'' command: 
 + 
 +**EXAMPLE:** Attitude Adjustment 12.09 for WNDR3700 (Atheros ar71xx architecture). 
 + 
 +|{{:meta:icons:tango:dialog-information.png?nolink&24}}|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 [[obtain.firmware.generate#PACKAGES Variable]] | 
 +<WRAP prewrap 1000px> 
 +<code> 
 +$ make image PROFILE=WNDR3700 
 +</code> 
 +</WRAP>
-Look for the image in the OpenWrt-ImageBuilder-ar71xx-for-Linux-i686/bin/ directory.+Then you would look for the image in the ''OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486/bin/'' directory.
=== Adding/Modifying Profiles === === Adding/Modifying Profiles ===
-| :!: | 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. |+|{{:meta:icons:tango:48px-emblem-important.svg.png?nolink&24}}|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. | 
 +|{{:meta:icons:tango:48px-emblem-important.svg.png?nolink&24}}|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/// The location of the profiles for the pre-compiled package for //brcm47xx-for-Linux-i686// was //target/linux/brcm47xx/profiles///
Line 113: Line 131:
Here is what the //profiles/100-Broadcom-b43.mk// profile file looks like:  Here is what the //profiles/100-Broadcom-b43.mk// profile file looks like: 
 +<WRAP prewrap 1000px>
<code> <code>
define Profile/Broadcom-b43 define Profile/Broadcom-b43
Line 124: Line 143:
$(eval $(call Profile,Broadcom-b43)) $(eval $(call Profile,Broadcom-b43))
</code> </code>
 +</WRAP>
-==== Packages ==== +==== PACKAGES Variable ==== 
-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.+The ''PACKAGES'' variable specifies a list of packages to include and/or exclude when building an image with Image Generator.
-| ''make image PROFILE=WL500GP **PACKAGES="nano openvpn -ppp -ppp-mod-pppoe"**'' |+Syntax:
-**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!+**NOTE:** If the package name is prefixed with ''-'' then the corresponding package will be excluded from being built during ''make image''.
-**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).+The example below will include pkg1, pkg2, pkg3, and exclude pkg4, pkg5, pkg6. 
 +<WRAP prewrap 1000px> 
 +<code> 
 +$ make image PROFILE=XXX PACKAGES="pkg1 pkg2 pkg3 -pkg4 -pkg5 -pkg6" 
 +</code> 
 +</WRAP> 
 +|{{:meta:icons:tango:48px-emblem-important.svg.png?nolink&24}}|**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! | 
 + 
 +|{{:meta:icons:tango:48px-dialog-warning.svg.png?nolink&24}}|**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:+**Tip:** The list of currently installed packages on your router running OpenWrt can be obtained with the command below:
 +<WRAP prewrap 1000px>
<code> <code>
-echo `opkg list_installed | awk '{ print $1 }'`+echo $(opkg list_installed | awk '{ print $1 }')
</code> </code>
 +</WRAP>
-**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):+**Tip:** The list of packages present in the current release of OpenWrt, Attitude Adjustment 12.09, can be obtained with this Linux command:
 +**NOTE:** Example is for ar71xx. Change the architecture and name of the config file as necessary.
 +<WRAP prewrap 1000px>
<code> <code>
-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')+echo $(wget -qO - http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/config.ar71xx_generic | sed -ne 's/^CONFIG_PACKAGE_\([a-z0-9-]*\)=y/\1/ip')
</code> </code>
 +</WRAP>
**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:** 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.
Line 150: Line 183:
**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. **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.
-==== Files ==== +==== FILES Variable ==== 
-A directory with custom files to add can be specified using the ''FILES'' variable. Custom files will replace default ones if necessary.+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.
-| ''mkdir -p files/etc/config+Syntax: 
 +<WRAP prewrap 1000px> 
 +<code> 
 +$ make image PROFILE=XXX PACKAGES="XXX" FILES=files/ 
 +</code> 
 +</WRAP> 
 + 
 +The following example shows: 
 + 
 +  -Creating the directory for the configuration files 
 +  -Using ''scp'' to transfer ''uci'' configuration files from an OpenWrt router to the ''files/etc/config'' directory 
 +  -Generating an image for WL500GP with custom packages and ''uci'' configuration files 
 + 
 + 
 +<WRAP prewrap 1000px> 
 +<code> 
 +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/network files/etc/config/
scp root@192.168.1.1:/etc/config/wireless 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/ 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/**'' | +make image PROFILE=WL500GP PACKAGES="nano openvpn -ppp -ppp-mod-pppoe" FILES=files/ 
 +</code> 
 +</WRAP>
===== Cleanup ===== ===== Cleanup =====
Line 172: Line 222:
It is possible to build the Image Generator from the sources from scratch: It is possible to build the Image Generator from the sources from scratch:
-<code>+<WRAP prewrap 1000px> 
 +<code bash>
:~/openwrt/trunk> svn up :~/openwrt/trunk> svn up
:~/openwrt/trunk> rm .config :~/openwrt/trunk> rm .config
:~/openwrt/trunk> make menuconfig :~/openwrt/trunk> make menuconfig
</code> </code>
 +</WRAP>
In the graphical configuration, select ''Global Build Settings -> Select all packages by default'', exit and save. 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. Then build the image, including ''IGNORE_ERRORS=1'' as there might be unmaintained packages that fail to compile.
 +<WRAP prewrap 1000px>
<code> <code>
:~/openwrt/trunk> make IGNORE_ERRORS=1 :~/openwrt/trunk> make IGNORE_ERRORS=1
</code> </code>
 +</WRAP>
**Note:** Don't call ''make defconfig'' or leave an old ''.config'' file in the path as 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//.) **Note:** Don't call ''make defconfig'' or leave an old ''.config'' file in the path as 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//.)
- 
- 
- 
- 

Back to top

doc/howto/obtain.firmware.generate.1364160736.txt.bz2 · Last modified: 2013/03/24 22:32 by hcc23