BusyBox による最小ルートファイルシステムの作成

Last updated 2000-07-04 11:23 pm


ヲ◆ヲ BusyBox 0.45 のソースをホームページから入手

21 June 2000 -- BusyBox 0.45 released

This release has been slow in coming, but is very solid at this point. BusyBox now supports libc5 as well as GNU libc. This release provides the following new apps: cut, tr, insmod, ar, mktemp, ,setkeycodes md5sum, uuencode, uudecode, which , and telnet. There are bug fixes for just about every app as well (see the changelog for details).

ヲ◆ヲ 全ての実行ファイルが /bin に保存されるように busybox.mkll の中のパスを修正

19:40:35 mebius /usr/src/busybox $ diff busybox.mkll busybox.mkll.original
16,17c16,17
< -e 's/_BB_DIR_SBIN/\/bin/g;s/_BB_DIR_USR_BIN/\/bin/g;' \
< -e 's/_BB_DIR_USR_SBIN/\/bin/g;'
---
> -e 's/_BB_DIR_SBIN/\/sbin/g;s/_BB_DIR_USR_BIN/\/usr\/bin/g;' \
> -e 's/_BB_DIR_USR_SBIN/\/usr\/sbin/g;'

ヲ◆ヲ 新たに busybox.links を作成

19:40:46 mebius /usr/src/busybox $ ./busybox.mkll > busybox.links

ヲ◆ヲ make 一発!

20:11:47 mebius /usr/src/busybox $ su
Password:
20:11:51 mebius /usr/src/busybox # make install

プログラムは ./_install以下に格納される。

20:12:00 mebius /usr/src/busybox # ls _install
bin
20:13:28 mebius /usr/src/busybox # ls _install/bin
[ dd grep loadfont mt sfdisk true ar deallocvt gunzip loadkmap mv sh tty basename df gzip logger nc sleep umount busybox dirname halt logname nslookup sort uname cat dmesg head ls ping swapoff uniq chgrp du hostid lsmod poweroff swapon update chmod dutmp hostname makedevs printf sync uptime chown echo id mkdir ps syslogd usleep chroot false init mkfifo pwd tail uudecode chvt fbset insmod mkfs.minix reboot tar uuencode clear fdflush kill mknod rm tee wc cp find killall mkswap rmdir telnet which cut free length mktemp rmmod test whoami date freeramdisk ln more sed touch yes dc fsck.minix loadacm mount setkeycodes tr zcat

全部で104個の実行ファイルが./_install/binに作成される。
実体は busybox のみ(なんと、ファイルサイズ 211KB!)で、他は全て busybox へのリンクである。
shまで入ってこのサイズとは、まさに驚き!

20:15:51 mebius /usr/src/busybox # ls -l busybox
-rwxr-xr-x 1 root root 271100 Jul 4 19:43 busybox

不必要なコマンドがあれば、busybox.def.h ファイルの中で該当するものをコメントアウトする。

ヲ◆ヲ 必要なライブラリーは?

20:16:40 mebius /usr/src/busybox # ldd busybox
libc.so.6 => /lib/libc.so.6 (0x40016000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

実は、libc6だけなんです。