Differences

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

doc:howto:build [2012/12/19 09:29]
tornadox
doc:howto:build [2013/06/12 00:05] (current)
uvray313
Line 6: Line 6:
===== Procedure ===== ===== Procedure =====
-| {{:meta:icons:tango:48px-emblem-important.svg.png?nolink}} | 1. Do everything as //non//-root user\\ 2. Issue all commands in the ''<buildroot dir>'' directory, e.g. ''~/openwrt/trunk/'' |+| {{:meta:icons:tango:48px-emblem-important.svg.png?nolink}} | 1. Do everything as //non//-root user\\ |
-    - Update OpenWrt sources. +==== Download Sources ====
-    - Update and install package feeds. +
-    - Configure the build. +
-    - Start the build. This will automatically compile toolchain, cross-compile sources, package packages, and finally generate an image ready to be flashed. +
-    - Proceed to [[generic.flashing|Installing OpenWrt]]+
-==== Updating Sources ==== +Select a location on your computer where you want your <build directory> installed. ie: home/imagebuild
-Update sources: +
-<code> +
-svn update +
-</code> +
-//OpenWrt sources change frequently. It is recommended that you work with the latest sources.//+
 +[[https://dev.openwrt.org/wiki/GetSource|Download Openwrt Source Code]]
-==== Updating Feeds ====+This will create a build directory with multiple files and subdirectories that provide you with the tools to build a basic binary firmware image.
-  - Update feeds: <code>./scripts/feeds update -a</code> +If you use git: 
-  - Install the downloaded packages: +<code>cd openwrt</code>
-Note that //installing// in context of ''./scripts/feeds'' script means "making package available in ''make menuconfig''" rather than really installing or compiling package.+
-    * To install single package:<code>./scripts/feeds install <PACKAGENAME></code> +or
-    * Alternatively, install all packages:<code>./scripts/feeds install -a</code>+
-===== Image Configuration ===== +If you use svn: 
-Start OpenWrt Buildroot's [[wp&gt;ncurses]] [[wp>Text-based user interface|text-based]] configuration interface:\\+<code>cd <build version></code> 
 + 
 +ie: trunk, attitude_adjustment, backfire, etc... 
 + 
 + 
 + 
 +==== Update Feeds ==== 
 + 
 +<code>./scripts/feeds update</code> 
 + 
 +This command will update the packages that are available at the repositories listed in the feeds.conf.default file 
 + 
 + 
 + 
 +==== Install Packages ==== 
 +&lt;code>./scripts/feeds install -a</code> 
 +Makes all packages available for selection during image configuration. 
 + 
 +<code>./scripts/feeds install <packagename></code> 
 + 
 +Makes a specific package available for selection during image configuration. 
 + 
 +[[doc/devel/feeds|More about feeds]]
 + 
 +==== Image Configuration ==== 
 +The **OpenWrt Buildroot configuration interface** allows you to select the target platform, which version of the toolchain you want to use to build, which packages you want included in the firmware image file and which ones compiled. Start the OpenWrt Buildroot configuration interface by entering:\\
<code> <code>
make menuconfig make menuconfig
</code> </code>
-Similar to the Linux kernel config, almost every option has three choices, **y**, **m**, **n** which are represented as follows: +{{ OpenWrt Buildroot TUI.gif}}
-  * pressing **y** yields to ''<*>'' label \\ This package will be included in the firmware image +
-  * pressing **m** yields to ''<M>'' label \\ This package will be compiled (to be installed with ''[[doc:techref:opkg]]'' after [[doc:howto:generic.flashing|Flashing OpenWrt]]) but the package will **not** be included in the firmware-image +
-  * pressing **n** yields to ''< >'' label \\ This package will not be compiled. +
-When you save your configuration, the file ''~/openwrt/trunk/.config'' will be created according to your configuration.+Similar to the configuration interface of the Linux kernel, almost every option has three choices, **y**, **m**, **n** which are represented as follows: 
 +  * pressing <html><strong><kbd>y</kbd></strong></html> yields to ''**<*>**'' label \\ This package will be compiled and included in the firmware image file. 
 +  * pressing <html><strong><kbd>m</kbd></strong></html> yields to ''**<M>**'' label \\ This package will be compiled, but **not** included in the firmware image file. (To be installed with ''[[doc:techref:opkg]]'' after [[doc:howto:generic.flashing|flashing]] the firmware image file.) 
 +  * pressing <html><strong><kbd>n</kbd></strong></html> yields to ''**< >**'' label \\ This package will not be compiled.   
 + 
 +When you save your configuration, the file **''<buildroot dir>/.config''** will be created according to your configuration. 
 + 
 + 
 +==== Manual editing of files ==== 
 +In case you want to manually alter certain files, you can do that as well: e.g. 
 +  * to alter the vanilla Kernel-Settings, edit the file ''<buildroot dir>**/package/base-files/files/etc/sysctl.conf**'' on your build machine. 
 +  * to alter the [[doc/howto/wireless.hotspot.wifidog|WifiDog]]-configuration file, edit ''<buildroot dir>**/feeds/packages/net/wifidog/files/wifidog.conf**'' on your build machine. 
 +  * etc. 
 + 
 +As you can learn in [[doc/techref/flash.layout]], all the files you edit now, will be located on the  <color magenta>''/rom''</color>-partition, which is formated with the  [[doc:techref:filesystems#SquashFS]] read-only file system. But because OpenWrt utilizes [[doc:techref:filesystems#overlayfs|overlayfs]], you will of course still be able to alter the files again once the image has been flashed to the router. However: 
 + 
 +| {{:meta:icons:tango:48px-dialog-warning.svg.png?nolink}} | <color red>**Warning! Be carefull!**</color> [[doc/howto/generic.failsafe|OpenWrt failsafe]] relies on 100%-working base files on the <color magenta>''/rom''</color>-partition, so in case you misconfigure or misspell something, you will end up with a non-working failsafe and be forced to used more rudimentary methods to [[doc/howto/generic.debrick|debrick]] your device again! | 
 + 
 +| {{:meta:icons:tango:48px-emblem-important.svg.png?nolink}} | To edit source-files,  OpenWrt Buildroot integrates quilt, cf. [[doc/devel/patches]]! |
-The devs offer such a file for OpenWrt 'Backfire' 10.03.1-RC5, e.g. [[http://downloads.openwrt.org/backfire/10.03.1-rc5/ar71xx/config|for ar71xx]].  
-{{ OpenWrt Buildroot TUI.gif}} 
-  * The menu above allows you to select the target platform, which version of toolchain you want to use to build and what packages you want included in the firmware image.  
-  * Run this configuration interface after updating sources and feeds to ensure that the latest packages are included in your configuration.  
Line 143: Line 169:
make -j 3 make -j 3
</code> </code>
-  * Use the standard formula ''<your number of CPUs + 1>''+  * Use the standard formula ''<your number of CPU cores + 1>''
  * If this produces random build errors try compiling again without the ''-j''-option   * If this produces random build errors try compiling again without the ''-j''-option
Line 194: Line 220:
===== Locating Images ===== ===== Locating Images =====
-After a successful build, the freshly built image(s) can be found in the newly created ''<buildroot dir>/bin'' directory. The compiled files are additionally classfied by the target platform, so e.g. a firmware built for an ar71xx device will be located in ''<buildroot dir>/bin/ar71xx'' directory.+After a successful build, the new custom-built image(s) can be found in the ''<buildroot directory>/bin/<target platform>'' directory.  
 + 
 +For example, a custom-built firmware for an ar71xx device may be located in the ''/home/johndoe/openwrt/trunk/bin/ar71xx'' directory. 
 + 
 +| {{:meta:icons:tango:48px-emblem-important.svg.png?nolink}} | If you cannot locate the image, it may simply be too large to flash to the selected hardware target and the image builder will NOT build it. Reduce the number of packages included with your image until it is small enough to fit.|
-E.g. if your <buildroot dir> is /openwrt/trunk, the binaries are in /openwrt/trunk/bin/ar71xx. 
===== Cleaning Up ===== ===== Cleaning Up =====
Line 214: Line 243:
</code> </code>
-deletes contents of ''/bin'' and ''/build_dir'' directories and additionally ''/staging_dir'' and ''/toolchain'' (=the cross-compile tools). 'Dirclean' is your basic "Full clean" operation. +deletes contents of ''/bin'' and ''/build_dir'' directories and additionally ''/staging_dir'' and ''/toolchain'' (=the cross-compile tools) plus ''/logs''. 'Dirclean' is your basic "Full clean" operation.
Line 254: Line 283:
==== I can't find my <package> in menuconfig ==== ==== I can't find my <package> in menuconfig ====
  - Have you run this command? [[doc:howto:build#updating.feeds|See this.]] <code>./scripts/feeds install <package></code>   - Have you run this command? [[doc:howto:build#updating.feeds|See this.]] <code>./scripts/feeds install <package></code>
-  - Maybe you are not looking for it in the right submenu. See ''Makefile'' of the package to find out. <code>cat package/feeds/packages/<package>/Makefile</code> +  - Maybe you are not looking for it in the right submenu. See ''Makefile'' of the package to find out. <code>cat package/feeds/packages/<package>/Makefile</code> You are looking for this: \\ ''define Package/<package>/Default
- +
-You are looking for this: +
-|''define Package/<package>/Default+
  SUBMENU:=**Firewall**   SUBMENU:=**Firewall**
  SECTION:=net   SECTION:=net
-  CATEGORY:=**Network** +  CATEGORY:=**Network**'' 
-''|+ - Menuconfig appears to cache package lists and (especially) profiles. Try deleting the ''trunk/tmp'' directory (in trunk, not your machine's ''/tmp'' directory!) and then running ''make menuconfig'' again. <code>cd trunk 
 +rm -rf tmp 
 +make menuconfig</code> Also try refreshing your package indexes: <code>./scripts/feeds update -i</code> The ''-i'' is important if you're not using the latest revisions of any packages, as this flag prevents updates from the feed sources.
====  Error: No rule to make target... ==== ====  Error: No rule to make target... ====
Line 273: Line 301:
===== Notes ===== ===== Notes =====
-  * [[doc:techref:buildroot|OpenWrt Buildroot – Technical Reference]] +
-  * [[http://downloads.openwrt.org/docs/buildroot-documentation.html]]+
  * [[https://dev.openwrt.org/browser/trunk/docs/working.tex]]   * [[https://dev.openwrt.org/browser/trunk/docs/working.tex]]
  * [[https://forum.openwrt.org/viewtopic.php?id=35323|Compiler Optimization Tweaks]]   * [[https://forum.openwrt.org/viewtopic.php?id=35323|Compiler Optimization Tweaks]]
 +
 +==== Documentation ====
 +* [[http://downloads.openwrt.org/docs/buildroot-documentation.html]] solid docu from 2006. Only minor things are outdated!
 +  - [[doc:about:toolchain|OpenWrt Buildroot – About]]
 +  - [[doc:howto:buildroot.exigence|OpenWrt Buildroot – Installation]]
 +  - OpenWrt Buildroot – Usage
 +  - [[doc:devel:feeds|OpenWrt Buildroot – Feeds]]
 +  - [[doc:techref:buildroot|OpenWrt Buildroot – Technical Reference]] {{:meta:icons:tango:48px-construction.svg.png?nolink&16}} this article needs //your// attention.
 +
 +
 +

Back to top

doc/howto/build.1355905772.txt.bz2 · Last modified: 2012/12/19 09:29 by tornadox