[HOME] [戻る]

玄箱インストールmemo(busybox)

目次

busybox-1.00

busyboxは1つのバイナリに多くのコマンドを詰め込んだものです。 サイズに制限がある環境 (インストール用のFDなど) でよく利用されています。

ソースファイルの取得

玄箱に入ってるbusyboxの状態

$ which busybox
/bin/busybox

$ ls -l /bin/busybox
-rwxr-xr-x    1 root     root       293164 Mar  8  2004 /bin/busybox

$ file /bin/busybox
/bin/busybox: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1
            , dynamically linked (uses shared libs), stripped

$ busybox
BusyBox v0.60.2 (2002.04.30-03:39+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, cp,
        cut, date, dd, df, dirname, dmesg, du, echo, env, expr, false,
        free, grep, gunzip, gzip, halt, head, id, ifconfig, init, insmod,
        kill, killall, klogd, linuxrc, ln, logger, ls, lsmod, mkdir, mkfifo,
        mknod, mkswap, modprobe, more, mount, mv, pidof, ps, pwd, reboot,
        reset, rm, rmdir, rmmod, route, sed, sh, sleep, sort, stty, swapoff,
        swapon, sync, syslogd, tail, tar, test, touch, tr, true, umount,
        uname, uniq, uptime, wc, which, whoami, xargs, yes, zcat

コンパイル

ソースの展開

$ tar vxzf busybox-1.00.tar.gz
$ cd busybox-1.00

コンフィグ

試行1

$ make config

「make menuconfig」でも可。

$ date
Sun Jan 23 10:25:21 JST 2005
$ make && date
.....
.....
Sun Jan 23 10:38:22 JST 2005
$ ls -l ./busybox
-rwxr-xr-x    1 odin     users     3585177 Jan 23 10:37 ./busybox
$ file ./busybox
./busybox: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1
         , dynamically linked (uses shared libs), not stripped
$ strip -p ./busybox
$ ls -l ./busybox
-rwxr-xr-x    1 odin     users     1342444 Jan 23 10:37 ./busybox
$ file ./busybox
./busybox: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1
         , dynamically linked (uses shared libs), stripped
$ ./busybox
BusyBox v1.00 (2005.01.23-01:01+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:
        [, addgroup, adduser, adjtimex, ar, arping, ash, awk, basename, bunzip2, 
        busybox, bzcat, cal, cat, chgrp, chmod, chown, chroot, chvt, clear, cmp,
        cp, cpio, crond, crontab, cut, date, dc, dd, deallocvt, delgroup, deluser, 
        devfsd, df, dirname, dmesg, dos2unix, dpkg, dpkg-deb, du, dumpkmap,
        dumpleases, echo, egrep, env, expr, false, fbset, fdflush, fdformat, fdisk,
        fgrep, find, fold, free, freeramdisk, fsck.minix, ftpget, ftpput, getopt,
        getty, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname,
        httpd, hush, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod,
        install, ip, ipaddr, ipcalc, iplink, iproute, iptunnel, kill, killall, klogd,
        lash, last, length, linuxrc, ln, loadfont, loadkmap, logger, login, logname,
        logread, losetup, ls, lsmod, makedevs, md5sum, mesg, mkdir, mkfifo,
        mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, msh, mt, mv, nameif,
        nc, netstat, nslookup, od, openvt, passwd, patch, pidof, ping, ping6,
        pipe_progress, pivot_root, poweroff, printf, ps, pwd, rdate, readlink,
        realpath, reboot, renice, reset, rm, rmdir, rmmod, route, rpm, rpm2cpio,
        run-parts, rx, sed, seq, setkeycodes, sh, sha1sum, sleep, sort,
        start-stop-daemon, strings, stty, su, sulogin, swapoff, swapon, sync, sysctl,
        syslogd, tail, tar, tee, telnet, telnetd, test, tftp, time, top, touch, tr,
        traceroute, true, tty, udhcpc, udhcpd, umount, uname, uncompress, uniq,
        unix2dos, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock,
        watch, watchdog, wc, wget, which, who, whoami, xargs, yes, zcat

遊んでみる

./busybox wget https://210.81.150.5/
Connecting to 210.81.150.5[210.81.150.5]:80
index.html           100% |*******************| 40316       --:-- ETA

試行2

26: # CONFIG_STATIC is not set
26: CONFIG_STATIC=y
$ date
Sun Jan 23 11:12:51 JST 2005
$ make && date
Sun Jan 23 11:13:30 JST 2005
$ ls -l ./busybox
-rwxr-xr-x    1 odin     users     4565112 Jan 23 11:13 ./busybox
$ file ./busybox
./busybox: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1
         , statically linked, not stripped
$ strip -p ./busybox
$ ls -l ./busybox
-rwxr-xr-x    1 odin     users     2220108 Jan 23 11:13 ./busybox
$ file ./busybox
./busybox: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1
         , statically linked, stripped

インストール

$ make install
/bin/sh applets/install.sh "./_install"
applets/install.sh: dirname: command not found
Unknown installation directory:
make: *** [install] Error 1
$ su
# ln -s /bin/busybox /bin/dirname
$ make install
CONFIG_INSTALL_NO_USR=y
PREFIX="/usr/sbin/busybox"
$ su
# mkdir /usr/sbin/busybox
# make install

2005/01/25
ご意見・ご感想は,こちらの掲示板 まで.