OpenWrt Buildroot – Installation
OpenWrt Buildroot is the preferred toolchain to build OpenWrt. It is recommended that you use a GNU/Linux Distribution (Debian is recommended), either a standalone installation or one running in a virtual environment (VMware or Qemu).
- Suse 12.3 uses the rpm package manager. Please note that Suse 12.3 may work to compile, but has not been tested by OpenWRT Community
Cygwin will probably not work correctly, and while it is possible to build OpenWrt images on a ~BSD or on MacOS X system, success is not guaranteed. Feel free to try and then report back with your results. Don't forget to read Troubleshooting. Build OpenWrt on Mac OS X 10.7 Lion
Prerequisites
- 350 MB of hard disk space for the source files to be downloaded.
- 3-4 GB of available hard disk space to build (i.e. cross-compile) OpenWrt.
Procedure
| 1. Do everything as non-root user! 2. Issue all OpenWrt Buildroot commands in the <buildsystem root> directory.ie: ~/openwrt/trunk/3. Do NOT build in a directory that has spaces in its full path |
Install subversion (svn) to download the OpenWrt source code. Some feeds (LuCI, openwrt-routing and telephony) are not available over svn but only using git. If you want to obtain their source-code, install git as well:
sudo apt-get update sudo apt-get install subversion git-core
- for information about the subversion tool see
svnand subversion documentation (multiple languages) - for information about git see
git(7)
Install build tools to do the cross-compilation:
sudo apt-get install build-essential
- for information about the build tools see
makeand build-essential
Use one of the following commands to check for missing packages on the system you want to build OpenWrt on:
make defconfig make prereq make menuconfig
- this will list missing system packages needed to successfully build OpenWrt using OpenWrt Buildroot.
- Install the missing packages. On a fresh Debian 7 Wheezy 32/64Bit these are:
libncurses5-dev zlib1g-dev gawk
- Proceed with build (i.e. cross-compile the downloaded sources to binaries)
After the cross-compilation process (as described here), the trunk-directory contained 244,451 files with a total size of 3.2GiB!
Table of known prerequisites and their corresponding packages
Here's a table with the package name for each prerequisite separated for different Linux distributions.
| Prerequisite | Debian | Suse | Red Hat | OS X (via MacPorts) | Fedora | NetBSD |
|---|---|---|---|---|---|---|
| asciidoc | asciidoc | asciidoc | asciidoc | asciidoc | asciidoc | ? |
| bash | bash | bash | ? | bash | bash | bash |
| binutils | binutils | binutils | binutils | binutils | binutils | ? |
| bzip2 | bzip2 | bzip2 | bzip2 | bzip2 | bzip2 | ? |
| fastjar | fastjar | fastjar | libgcj | fastjar | libgcj | ? |
| flex | flex | flex | ? | flex | flex | ? |
| git | git-core | git-core | ? | ? | git | ? |
| g++ | g++ | gcc-c++ | gcc-c++ | ? | gcc-c++ | ? |
| gcc | gcc | gcc | gcc | ? | gcc | ? |
| getopt | util-linux | util-linux | ? | getopt | util-linux | getopt |
| GNU awk | gawk | gawk | gawk | gawk | gawk | ? |
| gtk2.0-dev | libgtk2.0-dev | ? | gtk2-devel | gtk2 | gtk2-devel | ? |
| intltool-update | intltool | intltool | intltool | intltool | intltool | ? |
| jikes | — | jikes | ? | jikes | — | ? |
| libz, libz-dev | zlib1g-dev | zlib-devel | zlib-devel | zlib | zlib-devel | ? |
| make | make | make | ? | gmake | make | gmake |
| ncurses | libncurses5-dev | ncurses-devel | ncurses-devel | ncurses | ncurses-devel | ? |
| openssl/ssl.h | libssl-dev | libopenssl-devel | openssl-devel | openssl | openssl-devel | ? |
| patch | patch | patch | ? | patchutils | patch | ? |
| perl-ExtUtils-MakeMaker | perl-modules | perl-ExtUtils-MakeMaker | perl-ExtUtils-MakeMaker | p5-extutils-makemaker | perl-ExtUtils-MakeMaker | ? |
| python2.6-dev | python2.6-dev | python-devel | ? | python26 | python-devel | ? |
| rsync | rsync | rsync | ? | rsync | rsync | ? |
| ruby | ruby | ruby | ? | ruby | ruby | ? |
| sdcc | sdcc | sdcc | sdcc | sdcc | sdcc | ? |
| unzip | unzip | unzip | ? | unzip | unzip | ? |
| wget | wget | wget | wget | wget | wget | ? |
| working-sdcc | — | ? | ? | ? | — | ? |
| xgettext | gettext | ? | ? | gettext | gettext | ? |
| xsltproc | xsltproc | libxslt | ? | libxslt | libxslt | ? |
| zlib, zlib-static | zlib1g-dev | zlib-devel | ? | ? | zlib-devel | ? |
Unfortunately not all dependencies are checked by make config:
| Package | Prerequisite | Debian | Suse | Red Hat | OS X | Fedora | NetBSD |
|---|---|---|---|---|---|---|---|
| intltool | [Perl] XML::Parser | libxml-parser-perl | ? | perl-XML-Parser | ? | perl-XML-Parser | ? |
Examples of Package Installations
Debian 5 Lenny:
apt-get install gawk ncurses-dev unzip zlib1g-dev
Debian 6 Squeeze:
apt-get install libncurses5-dev zlib1g-dev gawk flex libssl-dev sdcc-nf
Debian 7 Wheezy:
apt-get install libncurses5-dev zlib1g-dev gawk
Fedora 17:
yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex libz-dev flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker mkdir ~/openwrt cd openwrt svn co svn://svn.openwrt.org/openwrt/trunk/ cd trunk ./scripts/feeds update -a ./scripts/feeds install -a make prereq make menuconfig ionice -c 3 nice -n 20 make -j 3 #always put nproc +1
Fedora 18 - 64Bit (Maybe also for lower versions, some packages seem to be missing above):
yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker \ glibc glibc-devel glibc-static quilt ncurses-lib sed sdcc intltool sharutils bison
#Maybe you need glibc.i686 glibc-static.i686 glibc-devel.i686 libgcc.i686 too
openSuSE 11.1
zypper install binutils bzip2 gawk gcc gcc-c++ gettext make ncurses-devel patch unzip wget zlib-devel flex git-core
Ubuntu 9.10:
sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib bison autoconf screen gcc g++ binutils patch bzip2 flex make gettext unzip libc6 git-core
Ubuntu 11.10:
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt
Ubuntu 12.04LTS:
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl
Ubuntu 64bit:
sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext
Mac OS X (tested on 64-bit Lion & Mountain Lion):
- Download & useMacPorts .pkg Installer, and install the following packages with the help of Mac-Ports:
sudo port -v selfupdate
sudo port install coreutils asciidoc bzip2 fastjar flex getopt gtk2 intltool jikes zlib openssl p5-extutils-makemaker \ python26 rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget gmake ncurses e2fsprogs ossp-uuid gawk findutils
- Required for 64-bit OS X: After checking out the source tree via svn above, we need to edit trunk/tools/Makefile
- On line 17, erase the instance of "e2fsprogs" but leave the rest of the line
- Comment out line 22, line 50, line 52, line 58 with the hash symbol, by putting # at the beginning of each line. They are the lines that issue qemu to be built, followed by the build dependancies for mtd-utils (dep: e2fsprogs), qemu (dep: e2fsprogs), and e2fsprogs respectively.
- Then copy the required headers and libraries to compile tools/mtd-utils
cd trunk; mkdir -p staging_dir/host/include/e2fsprogs; cp -R /opt/local/include/ossp staging_dir/host/include/e2fsprogs/; cp /opt/local/lib/libuuid* staging_dir/host/lib
See thread: [HOWTO] Build OpenWRT Trunk from svn on Mac OS X 10.7 Lion for more details
Notes:
- In Debian or Ubuntu use
apt-cache search ""
to find prerequisite packages. Naming is sometimes different - In openSuSE some packages require additional repositories. Search on http://packages.opensuse-community.org and add repositories like that:
zypper ar "http://download.opensuse.org/repositories/devel:/languages:/perl/openSUSE_11.1/devel:languages:perl.repo"
- To build your images on a Mac OS X Machine all you need is the package "fileutils" from the fink project. (Tested on Leopard 10.5.3)
Troubleshooting
- Beware of unusual environment variables such as
GREP_OPTIONSwhich should not have–initial-tabor other options affecting its outputSEDshould not be set. If it is, run `unset SED` before compiling. (See Ticket 10612.)
Documentation
* http://downloads.openwrt.org/docs/buildroot-documentation.html solid docu from 2006. Only minor things are outdated!
- OpenWrt Buildroot – Installation
- OpenWrt Buildroot – Technical Reference
this article needs your attention.
doc/howto/buildroot.exigence.txt · Last modified: 2013/06/09 05:12 by uvray313
This text is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
