User Tools

Site Tools


doc:faq:development

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:faq:development [2013/11/02 22:56]
theoradicus write about random build fails in VM
doc:faq:development [2016/01/19 18:30] (current)
tmomas alte Version wieder hergestellt (2016/01/18 15:12)
Line 1: Line 1:
 +====== Development FAQ ======
 +See also the OpenWrt [[http://​dev.openwrt.org/​|development center]] website. There you can browse the source code and send reproducible bugs with the ticket system (in trac).
  
 +other articles worth reading:
 +  - about the [[about:​toolchain|Toolchain]]
 +  - about it's installation [[doc:​howto:​buildroot.exigence|OpenWrt Buildroot – Installation]]
 +  - about it's usage [[doc:​howto:​build|OpenWrt Buildroot – Usage]]
 +
 +===== What system can I build OpenWrt on? =====
 +
 +OpenWrt Buildroot needs a case sensitive file system. It should work on almost any Linux distribution.
 +
 +  * Tested: Debian (6, 7, Unstable(2014)),​ Ubuntu, Fedora 19,20 , Arch Linux, OpenSuse 13.3
 +  * Exotic Linux variants might have some bugs regarding headers (Alpine Linux).
 +  * BSD (FreeBSD), MacOSX are somewhat untested.
 +  * Cygwin (Windows) has possible issues with file system being not case sensitive.
 +
 +Recommended:​ Build older versions with older Linux versions in a VM.
 +
 +===== Where is the source code? =====
 +
 +Almost every software in OpenWrt is available as a package. OpenWrt *downloads* code (using archive, git ...) compiles it and includes in the final image.
 +Every archive lands in "​dl"​ directory"​.
 +Every code (from archive or git) is available in build_dir.
 +
 +A mirror of package sources is maintained at [[http://​mirror2.openwrt.org/​sources/​]].
 +
 +===== How much disk space is needed for compiling? =====
 +
 +Approximately required disc space for compiling OpenWrt:
 +^ Branch ​             ^   ​Min. ​  ^ Max.     ^
 +| typical, Stable ​    ​| ​  1.5 GB |   3.5 GB |
 +| Development ​        ​| ​       ? |   3.8 GB |
 +| Development+feeds ​  ​| ​       ? |    >5 GB |
 +| all feeds/​pkgs ​     |        x |   ~45 GB |
 +| all feeds+debug ​    ​| ​         |  FIXME   |
 +
 +Typical: Compile an Image that is working on typical consumer routers that have 4MB or 8MB flash.
 +
 +Compiling also tested on some Windows OS under [[http://​wiki.gp2x.org/​wiki/​AndLinux|AndLinux]] ([[http://​www.colinux.org|coLinux]] + Ubuntu)
 +
 +===== How much time is needed for compiling? =====
 +
 +Build-time is highly dependable on the number of Cores/Jobs and can be shrunk to less than 30 minutes (from 90 minutes). ​
 +**Build time with single core can take several hours.**
 +
 +^ make jobs                     ^ time needed ​  ^ source ​                                              ^
 +| 1, typical ​                   | ?             ​| ​                                                     |
 +| 1, all                        | 10h48min ​     | [[http://​buildbot.openwrt.org:​8010/​grid|buildbot]] ​  |
 +| 2, all, local feed mirrors ​   | 3h40min ​      ​| ​                                                     |
 +| 4, typical ​                   | 45min         ​| ​                                                     |
 +| 4, all, local feed mirrors ​   | 2h17min ​      ​| ​                                                     |
 +
 +Typical: Select packages fitting into 8MB flash, build on HDD, ar71xx or brcm47xx target
 +
 +FIXME Test SSD vs. HDD
 +
 +===== How can I speed up build process? =====
 +
 +  * Use -j switch to enable parallel builds
 +
 +  * Use local mirror to avoid downloads (advanced build options)
 +<​code>​
 +
 +CONFIG_LOCALMIRROR="​file:///​home/​username/​mirror"​
 +
 +</​code>​
 +
 +  * use local feeds ( src-link ) instead of downloading with git
 +
 +=== Building on multi-core CPU ===
 +:!: **Build may FAIL**
 +
 +The build process can be accelerated by running multiple concurrent job processes using the ''​-j''​-option:​
 +<​code>​
 +make -j 3
 +</​code>​
 +  * Use the standard formula ''<​your number of CPU cores + 1>''​
 +  * If this produces random build errors try compiling again without the ''​-j''​-option
 +
 +==== Errors building gcc ====
 +If the build fails with errors that include ''​[s-attrib] Killed''​ and ''​[all-gcc] Error 2''​ while compiling gcc, this indicates you are out of disk space or RAM. This could be likely if you are building within a virtual machine with < 1 Gb RAM allocated and no swap.
 +
 +===== I built an image and it's too large! My rootfs is too small! My router does not remember settings! =====
 +
 +**Root cause:**
 +  * You selected too many packages in ''​menuconfig'':​ Packages selected with "​y"​ or shown as "​*"​ get included in //​squashfs//​ instead of installing them later to //jffs2//.
 +
 +**Solutions:​**
 +  * Delete unused base packages: :!: be very careful :!:\\ Example **ppp**: luci automatically selects ppp. This is not always needed. In ''​menuconfig'',​
 +     - de-select ''​luci''​
 +     - pick the components manually: ''​luci-base'',​ ''​luci-mod-admin-full'',​ ''​luci-theme-bootstrap''​
 +  * Use [[doc:​howto:​extroot|extroot]]
 +  * Disable busybox features
 +  * Hardware mod your router with larger flash ( :!: possible bootloader modification )
 +
 +===== How do I create a package? =====
 +See [[doc:​devel:​packages|Creating packages]].
 +
 +===== 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>​
 +  - Maybe you are not looking for it in the right submenu. See the ''​Makefile''​ of the package to find out. <​code>​cat feeds/<​feedname>/<​package>/​Makefile</​code>​ You are looking for this: \\ ''​define Package/<​package>/​Default
 +  SUBMENU:​=**Firewall**
 +  SECTION:​=net
 +  CATEGORY:​=**Network**''​
 +  - Menuconfig appears to cache package lists and (especially) profiles. Try deleting the ''<​buildroot_dir>/​tmp''​ directory and then running ''​make menuconfig''​ again. <​code>​
 +cd ~/​openwrt/​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.
 +
 +===== I can't find my router in menuconfig =====
 +
 +Some platforms dont offer specialized single targets per router because most routers use almost the same configuration and do not require special packages for USB, ethernet or wireless. ​
 +Selecting the default generic target will build images for all single targets.
 +Examples: Ralink/​Mediatek (ramips) devices
 +===== Common errors =====
 +
 +**Unclean buildroot**
 +
 +- Files inside the buildroot are specific to host systems.
 +
 +<​code>​
 +Build dependency: Please install GNU find
 +
 +# old files in staging_dir/​host
 +</​code>​
 +
 +- **remove untracked files** with the help of svn or git
 +
 +- use make targets depending on what you don't want
 +<​code>​
 +make clean
 +make dirclean
 +make distclean
 +make target/​linux/​clean *
 +rm -rf tmp/
 +rm .config .config.old
 +
 +</​code>​
 +* Kernel Config change is not triggering rebuild, see: [[https://​lists.openwrt.org/​pipermail/​openwrt-devel/​2013-September/​021587.html | openwrt-devel ]]
 +
 +
 +
 +If you are running a buildroot inside a VM with many threads you might experience random build failures.
 +
 +Setup:
 +Host: i7 16GB RAM, VM on Harddisk, Win 7 64bit, VMWare Player
 +Guest: Lubuntu 13.04 64bit 4GB RAM ext4 partition make -j 8
 +
 +Errors: Build fails like
 +<​code>​
 +mv: cannot stat '​.deps/​dlog.Tpo':​ No such file or directory
 +
 +or 
 +
 +../libtool: line 46: -c: command not found
 +libtool: Version mismatch error. ​ This is libtool 2.4, but the
 +libtool: definition of this LT_INIT comes from libtool 2.2.6.
 +libtool: You should recreate aclocal.m4 with macros from libtool 2.4
 +libtool: and run autoconf again.
 +</​code>​
 +
 +Cleaning up buildroot helps sometimes, reduce concurrency.
 +
 +===== Should I report bugs related to the OpenWrt Buildroot? =====
 +Yes, of course. If you find any bugs, please use our [[http://​dev.openwrt.org/​report|ticket system]] or send a report to openwrt-devel@openwrt.org . You can send patches for the bugs as well.
 +
 +/!\ **NOTE:** Changes to the buildroot system or the associated ''​Makefiles''​ could break the compile process. Please do not submit bug reports against //modified copies of buildroot//​. Thanks!
 +
 +===== How can I help or contribute? =====
 +
 +see: [[about:​start#​how_can_i_contribute|How can I contribute?​]]
 +
 +**Development**
 +
 +The OpenWrt build bots provide a list of broken packages: [[http://​buildbot.openwrt.org:​8010/​broken_packages/​]]
 +
 +There is a comparison of OpenWrt and upstream package versions available: http://​sdwalker.github.io/​uscan/​
 +
 +**Testing/​Review**
 +
 +The mailing list: https://​lists.openwrt.org/​pipermail/​openwrt-devel/​
 +generates Patchwork entries: http://​patchwork.ozlabs.org/​project/​openwrt/​list/​