初代玄箱のEMモードのお話です。
玄箱は、EM化モードで起動するとbusyboxが使えます。
# /bin/busybox
BusyBox v0.60.5 (2003.07.30-12:03+0000) multi-call binary
Usage: busybox [function] [arguments]...
or: [function] [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use, and BusyBox
will act like whatever it was invoked as.
Currently defined functions:
[, ash, basename, busybox, cat, chgrp, chmod, chown, chroot, chvt,
clear, cp, cpio, cut, date, dd, df, dirname, dmesg, du, echo,
env, expr, false, find, free, getopt, grep, gunzip, gzip, kill,
killall, ln, logread, ls, md5sum, mkdir, mkswap, more, mount,
mv, pidof, ps, pwd, reset, rm, rmdir, sed, sh, sleep, sort, stty,
swapoff, swapon, sync, syslogd, tail, tar, test, time, top, touch,
true, tty, umount, uname, uptime, usleep, vi, wc, which, yes,
zcat
このEMモードは、busyboxを使ってdebian化したOSなどをバックアップ
出来たりと、 便利なモードなんですが、busyboxが古くtarコマンドに
問題※があったりします。 tarコマンドは、busyboxとは別の単体バイナリでした。
(busyboxにシンボリックリンクされていない)
※圧縮オプションが使用出来ない、Permissionが保存されないなど。
これを改善する為に、Debian化した玄箱でBusyboxのコンパイルし、
このコンパイル済みのbusyboxで代用する事にしてみました。
■busyboxのインストール
1.busyboxのソースとパッチをダウンロード
http://www.busybox.net/から、今回はBusyBox 1.13.2をダウンロード。
# tar jxvf busybox-1.13.2.tar.bz2
tarコマンドのパッチが出ているようなのでダウンロード。
# cd busybox-1.13.2
# wget http://busybox.net/downloads/fixes-1.13.2/busybox-1.13.2-tar.patch
その後、パッチ適用。
# patch -p1 < busybox-1.13.2-tar.patch
2.デフォルトの内容でconfig
# make defconfig
今回はtarコマンドを使いたいだけなので、このままの設定にしました。
含まれるコマンドを変更したい場合は、make menuconfigで行えます。
tar (TAR) [Y/n/?] y
Enable archive creation (FEATURE_TAR_CREATE) [Y/n/?] y
Autodetect gz/bz2 compressed tarballs (FEATURE_TAR_AUTODETECT) [Y/n/?] y
Enable -X (exclude from) and -T (include from) options) (FEATURE_TAR_FROM) [Y/n/?] y
Support for old tar header format (FEATURE_TAR_OLDGNU_COMPATIBILITY) [Y/n/?] y
Enable untarring of tarballs with checksums produced by buggy Sun tar (FEATURE_TAR_OLDSUN_COMPATIBILITY) [Y/n/?] y
Support for GNU tar extensions (long filenames) (FEATURE_TAR_GNU_EXTENSIONS) [Y/n/?] y
Enable long options (FEATURE_TAR_LONG_OPTIONS) [Y/n/?] y
Enable use of user and group names (FEATURE_TAR_UNAME_GNAME) [Y/n/?] y
3.スタティックにライブラリをリンクする
.configに、「CONFIG_STATIC=y」を追記。
4.make
ここまできたら普通にmakeすれば完了です
# make
scripts/kconfig/conf -s Config.in
#
# using defaults found in .config
#
.config:51:warning: trying to reassign symbol STATIC
SPLIT include/autoconf.h -> include/config/*
GEN include/bbconfigopts.h
HOSTCC applets/usage
GEN include/usage_compressed.h
/mnt/busybox-1.13.2/applets/usage_compressed: line 27: bzip2: command not found
HOSTCC applets/applet_tables
GEN include/applet_tables.h
#bzip2が入ってないエラーが出てますが気にしない
この後は、本当ならmake install・・と続けるんですが、
今回は、busyboxのバイナリが欲しいだけだったので、
ここまでコンパイル終了です。
fileコマンドで中身を確認。
# file ./busybox
./busybox: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV),
statically linked, stripped
# ./busybox
BusyBox v1.13.2 (2009-02-18 16:26:50 JST) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.
Usage: busybox [function] [arguments]...
or: function [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as!
Currently defined functions:
[, [[, addgroup, adduser, adjtimex, ar, arp, arping, ash, awk,・・・・・
このバイナリ(busybox)を、EMモード時にFTPなどで持って来ることで、
/mnt2/busybox tar zcvf ホニャララなどのように、新しいbusyboxとして
使う事が出来るようになります。