User Tools

Site Tools


ru:doc:howto:buildroot.exigence

OpenWrt Buildroot – Установка

OpenWrt Buildroot - наиболее предпочтительный набор инструментов для сборки OpenWrt. Рекомендуется использовать GNU/Linux Distribution, либо автономную установку или отдельную систему в виртуальной среде (VMware или Qemu). Cygwin вероятно, не корректно работает, и хотя возможно собрать образ OpenWrt на ~BSD или MacOSX системах, успех не гарантирован. Не стесняйтесь попробовать и поделиться результатами. Не забудьте прочитать Troubleshooting.

Требования к системе

  • 350 MB места на жестком диске для загрузки исходных кодов;
  • 3-4 GB места на жестком диске для сборки (кросс-компиляции) OpenWrt.

Процедура

1. Все команды выполнять из под обычного пользователя (не root)!
2. Все команды OpenWrt Buildroot выполнять в директории <buildsystem root>, т.е. ~/openwrt/trunk/
3. Не собирать в директории имеющей в названии пути пробелы
  1. Установите subversion (коротко: svn), для загрузки исходного кода OpenWrt, и build tools для компиляции:
    sudo apt-get install subversion build-essential
  2. Загрузка исходного кода OpenWrt с помощью svn.
    mkdir ~/openwrt
    cd openwrt
    svn co svn://svn.openwrt.org/openwrt/trunk/
    cd trunk
    • эта команда создаст директорию 'trunk', которая является основной директорией OpenWrt
    • для trunk ревизии R27988, объем исходного кода составляет 14,382 файлов, суммарный размер которых 150 MiB
    • включает в себя OpenWrt Buildroot system.
    • более подробно о процессе загрузки исходного кода Downloading Sources.
  3. Download and install feeds using feeds script. (optional)
    ./scripts/feeds update -a
    ./scripts/feeds install -a
    • after this, Revision 7367, the trunk-dir contained 26,650 files with an overall size of 302 MiB (to install individual packages: ./scripts/feeds install PACKAGENAME)
  4. 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 buildroot.
  5. Install the missing packages using package management commands. See the examples and table below for more details.

:!: After configuring and running make (as described here), trunk-dir 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
binutils binutils binutils binutils binutils binutils ?
bzip2 bzip2 bzip2 bzip2 bzip2 bzip2 ?
fastjar fastjarfastjar libgcj fastjar libgcj ?
flex flexflex ? flex flex ?
git git-core git-core ? ? ? ?
g++ g++ gcc-c++ gcc-c++ ? gcc-c++ ?
gcc gcc gcc gcc ? gcc ?
getopt util-linux util-linux ? getopt ? 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 ? ?
rsync rsync rsync ? rsync rsync ?
ruby ruby ruby ? ruby ruby ?
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 zlib1g-dev 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 ? ? ? ? ?

Примеры

Debian 5.0 Lenny:

# aptitude install gawk ncurses-dev unzip zlib1g-dev

Debian 6.0 Squeeze:

# aptitude install libncurses5-dev zlib1g-dev gawk flex libssl-dev sdcc-nf

Fedora 11:

# yum install binutils bzip2 gawk gcc gcc-c++ gettext make ncurses-devel patch unzip wget zlib-devel flex git-core

openSuSE 11.1

# zypper install binutils bzip2 gawk gcc gcc-c++ gettext make ncurses-devel patch unzip wget zlib-devel flex git-core

Ubuntu:

$ sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk flex

Ubuntu 9.10, I needed also these (30-03-2011):

$ sudo apt-get install 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 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):

  1. Download MacPorts .pkg Installer, and install (horizontal scroll for entire second command):
  2. sudo port -v selfupdate
  3. 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 osso-uuid
  4. 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)

Загрузка исходных кодов

Short version: https://dev.openwrt.org/wiki/GetSource
You have two choices:

  • Download the latest stable release, or
  • Download the bleeding edge development snapshot (currently named "Attitude Adjustment", but often called "trunk").

The official repository is in svn but you can also choose to use git if you're building trunk. Refer to the GetSource for the URLs and amend the following commands appropriately.

Using Release Sources (stable)

As of this writing, the latest stable release is OpenWrt 10.03 "Backfire". There is a Backfire branch in SVN repository, which is still slowly being updated with verified patches. Using it will most likely produce a stable and working OpenWrt installation, but all the newest features and patches might not be there. As an example, this will check out the source code that the backfire release is built from (plus the latest backported fixes from trunk):

svn checkout svn://svn.openwrt.org/openwrt/branches/backfire

You could alternatively download a 'tagged' version of the backfire sources. For instance, if you insist on using the pristine release sources (no backported fixes applied after the last release), you could use:

svn checkout svn://svn.openwrt.org/openwrt/tags/backfire_10.03

You can check out a certain revision:

svn checkout --revision=24045 svn://svn.openwrt.org/openwrt/branches/backfire/ ./build_dir

As for the packages copy feeds.conf.default in ./build_dir to feeds.conf and add "@24045" at the end of the line that checks out the package feed:

src-svn packages svn://svn.openwrt.org/openwrt/packages@24045

Using Development Sources (bleeding edge)

The development branch (trunk) contains everything from documentation to experimental patches.

  • get latest
    svn checkout svn://svn.openwrt.org/openwrt/trunk/
  • get certain revision

Примечания

  • Beware of unusual environment variables such as
    • GREP_OPTIONS which should not have –initial-tab or other options affecting its output
    • SED should not be set. If it is, run `unset SED` before compiling. (See Ticket 10612.)
ru/doc/howto/buildroot.exigence.txt · Last modified: 2014/02/12 05:59 (external edit)