nextvod - build minimal busybox linux

[2012/10/25 更新]
ref: build minimal busybox linux

以原始 kernel + busybox 測試

# boot from sda1 by reset machine, and enter telnet environment

# 先以原始的 kernel & busybox 開機看看(以裝在 /dev/sda4為例)
mount /dev/sda2 /mnt_system
mount /dev/sda3 /mnt_user
mount /dev/sda4 /mnt_game
# copy kernel & libs & /devs
cp /vmlinux.ub /mnt_game
cd  /lib; cp  ld-linux.so.2  libc.so.6 libcrypt.so.1  libm.so.6 /mnt_game/lib/
tar -C /mnt_system -czf /mnt_user/dlin/devs.tar.gz dev
tar -C /mnt_game -xzf /mnt_user/dlin/devs.tar.gz

# 重新在 console 設定開機磁區為 /dev/sda4
setenv bootargs "console=ttyAS0,115200 root=8:4  rootfstype=ext3 rw rootflags=data=journal nwhwconf=device:eth0,hwaddr:10:08:E2:00:00:00 phyaddr:0,watchdog:5000 mem=120M bigphysarea=2048 init=/bin/sh"

# 開機訊息如下
... 略 ...

Freeing unused kernel memory: 124k freed

BusyBox v1.8.2 (2009-07-09 11:25:08 CST) built-in shell (ash)                
Enter 'help' for a list of built-in commands.                                
/bin/sh: can't access tty; job control turned off    # 怪怪的
reboot # 第2怪, 沒效

以原始 kernel + 自編 busybox 測試

# 更換自己的 busybox v1.20.2 (under stlinux 2.3)
mkdir -p sys proc /etc/init.d
vi /etc/init.d/rcS
 mount -t tmpfs mdev /dev
 mount -t sysfs none /sys
 mount -t tmpfs mdev /dev

chmod +x /etc/init.d/rcS

/bin/busybox busybox  # 似乎成功了
BusyBox v1.20.2 (2012-10-25 11:45:17 UTC) multi-call binary.

以自編 kernel + 自編 busybox 測試

# 更換自己編的 kernel (under stlinux 2.3)
uname -a # 似乎成功囉!                             
Linux (none) #1 PREEMPT Wed Oct 24 23:47:32 UTC 2012 sh4 GNU/Linux