OpenWrt Buildroot – インストール
OpenWrt Buildroot は、OpenWrtをビルドするための ツールチェイン です。ツールチェインをインストールする際には、スタンドアローン環境か、VMwareやQemuなどの仮想環境上に構築したGNU/Linux ディストリビューションにインストールすることをおすすめします。Cygwin環境では恐らく動作しません。また、~BSDやMacOSX 環境ではイメージのビルドを行うことができますが、動作は保証されていません。自由にトライして結果をdevlistに報告してみてください。また、トラブルシューティングも忘れずにお読みください。
前提条件
- ソースコードをダウンロードする際に、350 MBのディスクスペースが必要になります。
- OpenWrtをクロスコンパイルする際に、3-4 GBのディスクスペースが必要になります。
手順
| 1. 全ての作業を non-root ユーザーで行ってください! 2. 全てのコマンドは <buildsystem root> ディレクトリで実行してください。例えば、<buildsystem root>は~/openwrt/trunk/になります。3. フルパスにスペースを含んだディレクトリ内でビルドを行わないでください。 |
- OpenWrtのソースコードをダウンロードするために、
subversion(次回よりsvnと略)をインストールします。また、コンパイル環境を整えるために、build toolsのインストールも行います。:sudo apt-get install subversion build-essential
- for information about the subversion tool see
svnand subversion documentation (multiple languages) - for information about the build tools see
makeand build-essential
svn経由でOpenWrtのソースコードをダウンロードします。mkdir ~/openwrt cd openwrt svn co svn://svn.openwrt.org/openwrt/trunk/ cd trunk
- 上記の作業により、'trunk'ディレクトリが作成され、これがOpenWrtソースコードのメインディレクトリになります。
- trunk リビジョン R27988の時点で14,382個のファイルがあり、合計サイズは約150MiBです。
- これはOpenWrt Buildroot systemも含みます。
- for more information about Downloading Sources.
- feeds スクリプトを使用して、ソフトウェア・フィードのダウンロードおよびインストールを行います。(オプション)
./scripts/feeds update -a ./scripts/feeds install -a
- リビジョン 7367の場合、この時点で
trunk-ディレクトリは 26,650 ファイル、合計サイズ 302 MiBになります。(もし個別にパッケージをインストールする場合は右記のコマンドを実行してください:./scripts/feeds install PACKAGENAME)
- 以下のコマンドのいづれかを実行することで、OpenWrtをビルドしている環境上で足りないパッケージが列挙されます。:
make defconfig make prereq make menuconfig
- 上記の作業を行うことで、buildrootを使用してOpenWrtをビルドするために、足りないパッケージが列挙されます。
- package management commandsを使用して、足りないパッケージのインストールを行います。詳細は以下のテーブルと例を参照してください。
- ビルド または Build OpenWrt on Mac OS X 10.7 Lion に進んでください。
設定およびmake実行後、(このページで説明されています), trunk-ディレクトリは244,451 ファイル、合計サイズ約3.2GiBになるでしょう!
ディストリビューション別の前提パッケージリスト
以下は、Linux ディストリビューション別に記載された、ビルドするための必要条件になる各パッケージ名の一覧表です。
| Prerequisite | Debian | Suse | Red Hat | OS X (via MacPorts) | Fedora | NetBSD |
|---|---|---|---|---|---|---|
| asciidoc | asciidoc | asciidoc | asciidoc | asciidoc | asciidoc | ? |
| 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 | ? |
| g++ | g++ | gcc-c++ | gcc-c++ | ? | gcc-c++ | ? |
| gcc | gcc | gcc | gcc | ? | gcc | ? |
| getopt | 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 | ? | ? | 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 | ? |
残念ながら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 (64-bit Lionでテスト済):
- MacPorts .pkg インストーラをダウンロードし、インストールします。 (horizontal scroll for entire second command):
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 osso-uuid
- 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)
ソースコードのダウンロード
右記に省略した説明書きがあります: https://dev.openwrt.org/wiki/GetSource
2つの選択肢があります:
- 最新の安定版 (stable) をダウンロードする
- 開発版のスナップショット (bleeding edge) をダウンロードする (正式には "Attitude Adjustment"と呼んでいますが、ほとんどの場合、単に"trunk"と呼びます)。
オフィシャルのリポジトリはsvnとして管理されていますが、trunk版を使用するのであれば、git経由でも取得することができます。 ソースコードの取得を参照して、記事の内容に従ってください。
リリース版ソースコードを使用する (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
開発版ソースコードを使用する (bleeding edge)
開発版ブランチ (trunk) は、ドキュメントから実験的なパッチまで全てを含みます。
- 最新のコードを取得する
svn checkout svn://svn.openwrt.org/openwrt/trunk/
- 特定のバージョンを取得する
svn checkout -r XXXX svn://svn.openwrt.org/openwrt/trunk/
トラブルシューティング
- 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.)
jp/doc/howto/buildroot.exigence.txt · Last modified: 2012/03/29 08:27 by matsuk
