buildrootについて †buildrootは組み込みLinux環境を作成するためのツールです。Makefileといくつかのpatchのセットから構成されています。
ビルド環境構築手順について †ビルド環境構築に使用するホストOSはUbuntu 10.04(64bit)です。 追加導入パッケージ †ビルド環境構築のために以下の各パッケージを導入します。 ssh vim git-core build-essential curl ia32-libs diffstat cvs subversion chrpath texi2html texinfo libncurses5-dev bison flex gettext dashからbashへの変更 †Ubuntuデフォルトのshellはdashで、そのままmakeを実行するとエラーが起こるため、 $ sudo dpkg-reconfigure dash 「dash を /bin/sh インストールしますか?」と聞かれるので「No」or 「いいえ」を選択します。 buildrootの取得 †gitコマンドを使用しbuildrootを取得します。
$ cd ${HOME}
$ mkdir work_router
$ cd work_router
$ git clone https://github.com/MaxGalemin/buildroot.git
Toolchainのインストール †TIのWebサイトからToolchainを適当なディレクトリにダウンロードしインストールします。 $ wget http://software-dl.ti.com/dsps/dsps_public_sw/am_bu/sdk/BeagleBoardSDK/latest/exports/ti-sdk-beagleboard-05.05.01.00-Linux-x86-Install $ chmod +x ti-sdk-beagleboard-05.05.01.00-Linux-x86-Install consoleでインストールするため --mode consoleオプションを付けて実行します。 $ ./ti-sdk-beagleboard-05.05.01.00-Linux-x86-Install --mode console インストールしたToolchainのPATHをbashrcの末尾に設定します。 $ vi ${HOME}/.bashrc
PATH=${HOME}/ti-sdk-beagleboard-05.05.01.00/linux-devkit/bin:$PATH
$ source ${HOME}/.bashrc
Toolchainについて †本稿で使用しているbuildroot(2011.05をベースに調整されたもの)のデフォルトToolchainはCodeSourceryの2011.03ですが、 bc10用のconfig配置 †bc10用のconfigファイルは があります。それぞれ適当なディレクトリにダウンロードしてください。 work_router/
`- buildroot/
|- board/
| `-bc10/
| |- kernel-patches/
| `- linux-3.2.8.config
|- configs/
| `- bc10_defconfig
`-package/
`- busybox/
`- busybox-1.19.x.config (bc10用編集済みbusyboxのconfigファイル)
配置ファイルの設定確認 †配置完了後、make bc10_defconfig、make menuconfigコマンドを実行して $ cd ~/work_router/buildroot
$ make bc10_defconfig
$ make menuconfig
Toolchain --->
|- Toolchain type(External toolchain)
|- Toolchain (Custom toolchain)
|- (${HOME}/ti-sdk-beagleboard-05.05.01.00/linux-devkit) Toolchain Path
|- ($(ARCH)-arago-linux-gnueabi) Toolchain prefix
|- External toolchain C library (glibc)
...
|- [*] Toolchain has C++ support?
...
Package Selection for the target --->
...
|- (package/busybox/busybox-1.19.x.config) BusyBox configuration file to use?
...
Kernel --->
...
|- (board/bc10/kernel-patches) Custom kernel patches
...
|- (board/bc10/linux-3.2.8.config) Configuration file path
...
buildrootの修正、変更について †TIのToolchainを使用した際、CodeSourcery2011.03のToolchainとは libtoolのバージョン変更 †buildrootのlibtoolのバージョンを2.2.10からbc10-router/arago-projectで $ cd ${HOME}/work_router/buildroot
$ vi package/libtool/libtool.mk
- LIBTOOL_VERSION = 2.2.10
+ # LIBTOOL_VERSION = 2.2.10
+ LIBTOOL_VERSION = 2.2.6b
LIBTOOL_SOURCE = libtool-$(LIBTOOL_VERSION).tar.gz
ncursesのバージョン変更 †ncursesのバージョンを5.7から5.9に変更します。 $ cd ${HOME}/work_router/buildroot
$ vi package/ncurses/ncurses.mk
--- ncurses.mk_orig 2012-12-21 17:10:01.570116798 +0900
+++ ncurses.mk 2012-12-21 15:30:30.220956375 +0900
@@ -23,27 +23,52 @@
# USA
# TARGETS
-NCURSES_VERSION = 5.7
+#NCURSES_VERSION = 5.7
+NCURSES_VERSION = 5.9
NCURSES_SITE = $(BR2_GNU_MIRROR)/ncurses
NCURSES_INSTALL_STAGING = YES
NCURSES_DEPENDENCIES = host-ncurses
+HOSTCPPFLAGS += "-D_GNU_SOURCE"
+
NCURSES_CONF_OPT = \
+ --enable-widec \
+ --without-progs \
--with-shared \
- --without-cxx \
- --without-cxx-binding \
--without-ada \
- --without-progs \
- --without-tests \
+ --enable-hard-tabs \
+ --enable-xmc-glitch \
+ --enable-colorfgbg \
--disable-big-core \
- --without-profile \
- --disable-rpath \
- --enable-echo \
- --enable-const \
- --enable-overwrite \
- --enable-broken_linker \
+ --disable-rpath-hack \
+ --with-ticlib \
+ --with-termlib=tinfo \
+ --enable-sigwinch \
+ --enable-pc-files \
+ --with-build-cc="${HOSTCC}" \
+ --with-build-cpp="${HOSTCPP}" \
+ --with-build-ld="${HOSTLD}" \
+ --with-build-cflags="${HOSTCFLAGS}" \
+ --with-build-cppflags='${HOSTCPPFLAGS}' \
+ --with-build-ldflags='${HOSTLDFLAGS}' \
--disable-static
+#NCURSES_CONF_OPT = \
+# --with-shared \
+# --without-cxx \
+# --without-cxx-binding \
+# --without-ada \
+# --without-progs \
+# --without-tests \
+# --disable-big-core \
+# --without-profile \
+# --disable-rpath \
+# --enable-echo \
+# --enable-const \
+# --enable-overwrite \
+# --enable-broken_linker \
+# --disable-static
+
ifneq ($(BR2_ENABLE_DEBUG),y)
NCURSES_CONF_OPT += --without-debug
endif
@@ -99,7 +124,7 @@ endif
define NCURSES_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/usr/lib
- cp -dpf $(NCURSES_DIR)/lib/libncurses.so* $(TARGET_DIR)/usr/lib/
+ cp -dpf $(NCURSES_DIR)/lib/* $(TARGET_DIR)/usr/lib/
$(NCURSES_INSTALL_TARGET_PANEL)
$(NCURSES_INSTALL_TARGET_FORM)
$(NCURSES_INSTALL_TARGET_MENU)
@@ -120,6 +145,32 @@ define NCURSES_INSTALL_TARGET_CMDS
$(NCURSES_INSTALL_TARGET_DEVFILES)
endef # NCURSES_INSTALL_TARGET_CMDS
+
+
+
+# define NCURSES_INSTALL_TARGET_CMDS
+# mkdir -p $(TARGET_DIR)/usr/lib
+# cp -dpf $(NCURSES_DIR)/lib/libncurses.so* $(TARGET_DIR)/usr/lib/
+# $(NCURSES_INSTALL_TARGET_PANEL)
+# $(NCURSES_INSTALL_TARGET_FORM)
+# $(NCURSES_INSTALL_TARGET_MENU)
+# ln -snf /usr/share/terminfo $(TARGET_DIR)/usr/lib/terminfo
+# mkdir -p $(TARGET_DIR)/usr/share/terminfo/x
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm $(TARGET_DIR)/usr/share/terminfo/x
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-color $(TARGET_DIR)/usr/share/terminfo/x
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-xfree86 $(TARGET_DIR)/usr/share/terminfo/x
+# mkdir -p $(TARGET_DIR)/usr/share/terminfo/v
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt100 $(TARGET_DIR)/usr/share/terminfo/v
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt102 $(TARGET_DIR)/usr/share/terminfo/v
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt200 $(TARGET_DIR)/usr/share/terminfo/v
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt220 $(TARGET_DIR)/usr/share/terminfo/v
+# mkdir -p $(TARGET_DIR)/usr/share/terminfo/a
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/a/ansi $(TARGET_DIR)/usr/share/terminfo/a
+# mkdir -p $(TARGET_DIR)/usr/share/terminfo/l
+# cp -dpf $(STAGING_DIR)/usr/share/terminfo/l/linux $(TARGET_DIR)/usr/share/terminfo/l
+# $(NCURSES_INSTALL_TARGET_DEVFILES)
+# endef # NCURSES_INSTALL_TARGET_CMDS
+
udev-181のpatch追加 †udev-181でもTIのToolchain使用時にエラーが起こります、またbc10-router/arago-projectで $ vi package/udev/udev-181-define-trigger-happy.patch diff -Naur udev-181.orig/src/udev-builtin-input_id.c udev-181/src/udev-builtin-input_id.c --- udev-181.orig/src/udev-builtin-input_id.c 2012-03-05 11:41:10.000000000 -0500 +++ udev-181/src/udev-builtin-input_id.c 2012-03-05 11:46:31.000000000 -0500 @@ -30,6 +30,10 @@ #include "udev.h" +#ifndef BTN_TRIGGER_HAPPY +#define BTN_TRIGGER_HAPPY 0x2c0 +#endif + /* we must use this kernel-compatible implementation */ #define BITS_PER_LONG (sizeof(unsigned long) * 8) #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) イメージの作成 †上記の手順まで完了後ビルドを実行します。 $ make ビルド完了後、work_router/buildroot/output/imagesに以下の各ファイルが MLO rootfs.tar u-boot.img uEnv.txt uImage uEnv.txtの編集 †uboot用環境設定ファイルuEnv.txtは上記までの手順で作成されますが、 --- __uEnv.txt_orig 2012-12-18 15:20:53.344986130 +0900 +++ uEnv.txt 2012-12-18 15:21:06.901053349 +0900 @@ -1,3 +1,2 @@ -mpurate=1000 -dvimode=1024x768MR-16@60 -uenvcmd=mmc init; run loaduimagefat; run mmcboot +mmcroot=/dev/mmcblk0p2 rw +uenvcmd=run loaduimagefat; run mmcboot SDへの書き込み †bc10/booting 起動用SDカードの作成の手順で作成されたSDカードを 上記までで作成したファイルをそれぞれのディレクトリにコピー、展開をします。 $ cp MLO /media/FAT $ cp u-boot.img /media/FAT $ cp uImage /media/FAT $ sudo tar xvf rootfs.tar -C /media/EXT3 以上で、SDへの書き込みは完了です。 bc10起動後の設定について †本buildrootを用いてbc10を起動した際の幾つかのトピックを記載します。 dropbear の login について †本buildrootではデフォルトのshell は bash 、sshdは dropbear を使用しています。 authpriv.warn dropbear[780]: User 'root' has invalid shell, rejected これはdropbear/svr-auth.c内のshellをチェックする箇所が/bin/shに固定されているために $ vi dropbear-2012.55/svr-auth.c
254行目~
/* check that the shell is set */
usershell = ses.authstate.pw_shell;
if (usershell[0] == '\0') {
/* empty shell in /etc/passwd means /bin/sh according to passwd(5) */
usershell = "/bin/sh";
}
...<略>
endusershell();
TRACE(("no matching shell"))
dropbear_log(LOG_WARNING, "User '%s' has invalid shell, rejected",
ses.authstate.pw_name);
send_msg_userauth_failure(0, 1);
return DROPBEAR_FAILURE;
[root@bc10-router ~]# vi /etc/passwd root:x:0:0:root:/root:/bin/sh ... 無線LANモジュールの読込 †起動に無線LANモジュールを読み込まないため、ログイン後以下のように # modprobe rt2800usb
[ 38.027832] cfg80211: Calling CRDA to update world regulatory domain
[ 38.291656] usb 1-2.4: reset high-speed USB device number 4 using ehci-omap
[ 38.486846] usbcore: registered new interface driver rt2800usb
# ifconfig -a
...<略>
wlan0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
更新記録 †2012/12/21 初稿掲載 syariten
|