User Tools

Site Tools


doc:howto:obtain.firmware.generate

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
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/10/11 13:42] (current)
claudius
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 14: Line 13:
 **Image Generator** is the program that creates the OpenWrt firmware image file. In the process of [[build|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. **Image Generator** is the program that creates the OpenWrt firmware image file. In the process of [[build|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.+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.
 ---- ----
  
-===== Download ===== +===== Download ​OpenWrt Barrier Breaker 14.07 ===== 
-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/​barrier_breaker/14.07/]]
- +
-  * 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//   * 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>​
 <​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/​barrier_breaker/14.07/ar71xx/generic/​OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2 
-cd OpenWrt-ImageBuilder-ar71xx-for-Linux-i686/+tar -xvjf OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2 
 +cd OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486
 </​code>​ </​code>​
 +</​WRAP>​
 +
 +===== Configure Package Repositories =====
 +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.
 +
 +**EXAMPLE:​** To use all official package repositories for ar71xx the repositories.conf should look like:
 +<​WRAP>​
 +<​code>​
 +src/gz barrier_breaker_base http://​downloads.openwrt.org/​barrier_breaker/​14.07/​ar71xx/​generic/​packages/​base
 +src/gz barrier_breaker_luci http://​downloads.openwrt.org/​barrier_breaker/​14.07/​ar71xx/​generic/​packages/​luci
 +src/gz barrier_breaker_management http://​downloads.openwrt.org/​barrier_breaker/​14.07/​ar71xx/​generic/​packages/​management
 +src/gz barrier_breaker_oldpackages http://​downloads.openwrt.org/​barrier_breaker/​14.07/​ar71xx/​generic/​packages/​oldpackages
 +src/gz barrier_breaker_packages http://​downloads.openwrt.org/​barrier_breaker/​14.07/​ar71xx/​generic/​packages/​packages
 +src/gz barrier_breaker_routing http://​downloads.openwrt.org/​barrier_breaker/​14.07/​ar71xx/​generic/​packages/​routing
 +src/gz barrier_breaker_telephony http://​downloads.openwrt.org/​barrier_breaker/​14.07/​ar71xx/​generic/​packages/​telephony
 +## This is the local package repository, do not remove!
 +src imagebuilder file:​packages
 +</​code>​
 +</​WRAP>​
 +
  
 ===== Usage ===== ===== Usage =====
Line 39: Line 58:
   * //''​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>​
 <​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>​ 
 +<​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>​
 <​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:** 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>​ 
 +<​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 133:
 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>​
 <​code>​ <​code>​
 define Profile/​Broadcom-b43 define Profile/​Broadcom-b43
Line 124: Line 145:
 $(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>​ 
 +<​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>​
 <​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, 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.
 +<​WRAP>​
 <​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/​barrier_breaker/14.07/​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 185:
 **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>​ 
 +<​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>​ 
 +<​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>​
  
 +**Note:** The ''​files/''​ folder must be in the same folder where you issue the make command.
  
 ===== Cleanup ===== ===== Cleanup =====
 To clean up temporary build files and generated images, use the ''​make clean''​ command. To clean up temporary build files and generated images, use the ''​make clean''​ command.
- 
-===== External Repositories ===== 
-Trunk revisions since [[https://​dev.openwrt.org/​changeset/​22978|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. 
  
 ===== Building the Image Generator ===== ===== Building the Image Generator =====
 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>​ 
 +<​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>​
 <​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 ''​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//.)
- +
- +
- +
doc/howto/obtain.firmware.generate.1364160736.txt.bz2 · Last modified: 2013/03/24 22:32 by hcc23