2008年8月8日金曜日

KURO-BOX/PRO with Debian GNU/Linux

まず、i386なマシンで debootstrap を行いベースを作成する。
# mkdir kuroroot
# debootstrap --foreign --arch arm etch kuroroot http://cdn.debian.or.jp/debian/
...
# cd kuroroot
# tar zcf ../kuroroot.tgz *

次に上で作成した kuroroot.tgz をKURO-BOX/PROに転送する。
ちなみに、KURO-BOX/PRO のHDDは以下の構成

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 1217 9775521 83 Linux
/dev/sda2 1218 1340 987997+ 82 Linux swap
/dev/sda3 1341 1706 2939895 83 Linux
/dev/sda4 1707 60801 474680587+ 5 Extended
/dev/sda5 1707 2923 9775521 83 Linux
/dev/sda6 2924 5356 19543041 83 Linux
/dev/sda7 5357 17515 97667136 83 Linux
/dev/sda8 17516 60801 347694763+ 83 Linux

~ # mkswap /dev/sda2
~ # mount /dev/sda1 /mnt/disk1/
~ # mkdir /mnt/disk1/tmp
~ # mkdir /mnt/disk1/var
~ # mkdir /mnt/disk1/usr
~ # mkdir /mnt/disk1/home
~ # mkdir /mnt/disk1/srv
~ # mount /dev/sda3 /mnt/disk1/tmp
~ # mount /dev/sda5 /mnt/disk1/var
~ # mount /dev/sda6 /mnt/disk1/usr
~ # mount /dev/sda7 /mnt/disk1/home
~ # mount /dev/sda8 /mnt/disk1/srv

# cd /mnt/disk1/
i386なマシンで作成した、ベースを展開。
# tar zxvf kuroroot.tgz

# mount -t proc proc /mnt/disk1/proc
# chroot /mnt/disk1

debootstrapの続きを実行
# /debootstrap/debootstrap --second-stage --no-resolve-deps
I: Validating Packages
...
I: Base system installed successfully.
sh-3.1#

残りの設定を行う
sh-3.1# passwd
sh-3.1# adduser HOGE
sh-3.1# aptitude install ssh
sh-3.1# echo "kurobox-pro" > /etc/hostname
sh-3.1# echo "127.0.0.1 localhost" > /etc/hosts
sh-3.1# cat /etc/fstab

# /etc/fstab: static file system information.
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
/dev/sda3 /tmp ext3 defaults 0 2
/dev/sda5 /var ext3 defaults 0 2
/dev/sda6 /usr ext3 defaults 0 2
/dev/sda7 /home ext3 defaults 0 2
/dev/sda8 /srv ext3 defaults 0 2

sh-3.1# diff /etc/default/rcS.orig /etc/default/rcS
13c13
< UTC=yes
> UTC=no


sh-3.1# tzconfig
sh-3.1# diff /etc/inittab.orig /etc/inittab
63c63
< #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
---
> T0:12345:respawn:/sbin/getty -L ttyS0 115200 vt100

sh-3.1# diff /etc/default/halt.orig /etc/default/halt
2c2
< HALT=poweroff
---
> HALT=halt


sh-3.1# cat /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

# The loopback network interface
auto lo eth0
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

sh-3.1# cd /dev/
sh-3.1# ./MAKEDEV sda
sh-3.1# ./MAKEDEV ttyS0
sh-3.1# ./MAKEDEV ttyS1
sh-3.1# ./MAKEDEV rtc

ここまできたら chroot から抜けて。。。
/mnt/disk1/ に uImage.buffalo をコピー
(u-bootがhda1直下にあることを期待するのでココに置く)

モジュールもコピー
cp -air /lib/modules/2.6.12.6-arm1 /mnt/disk1/lib/modules/

KURO-BOX/PROのコマンドをコピー
/mnt/disk1 # mkdir -p usr/local/kurobox/bin
/mnt/disk1 # mkdir -p usr/local/kurobox/lib
/mnt/disk1 # cp -p /usr/local/sbin/nvram /mnt/disk1/usr/local/kurobox/bin
/mnt/disk1 # cp -p /usr/local/sbin/miconapl /mnt/disk1/usr/local/kurobox/bin/
/mnt/disk1 # cp -p /lib/libc-2.3.6.so /mnt/disk1/usr/local/kurobox/lib/
/mnt/disk1 # cp -p /lib/ld-2.3.6.so /mnt/disk1/usr/local/kurobox/lib/
/mnt/disk1 # cp -p /lib/libgcc_s.so.1 /mnt/disk1/usr/local/kurobox/lib/
/mnt/disk1 # cp -p /usr/local/lib/libbuffalo_bin.so /mnt/disk1/usr/local/kurobox

nvram の設定
/mnt/disk1/boot # nvram -c printenv
1: [baudrate=115200]
2: [loads_echo=0]
3: [ipaddr=192.168.11.150]
4: [serverip=192.168.11.1]
5: [rootpath=/nfs/arm]
6: [cpuName=926]
7: [CASset=min]
8: [MALLOC_len=4]
9: [bootargs_end=:::DB88FXX81:eth0:none]
10: [ethact=egiga0]
11: [ethaddr=00:16:01:A4:DD:D1]
12: [stdin=serial]
13: [stdout=serial]
14: [stderr=serial]
15: [enaMonExt=no]
16: [enaFlashBuf=yes]
17: [enaCpuStream=no]
18: [ethprime=egiga0]
19: [buffalo_ver=BOOTVER=1.091]
20: [build_time=18:10:02]
21: [initrd=initrd.buffalo]
22: [kernel=uImage.buffalo]
23: [bootargs_base=console=ttyS0,115200]
24: [bootargs_root=root=/dev/mtdblock2 rw panic=5]
25: [bootargs=$(bootargs_base) $(bootargs_root) $(buffalo_ver)]
26: [nand_uImage_offset=20000]
27: [default_kernel_addr=0x00100000]
28: [default_initrd_addr=0x02000000]
29: [bootcmd=nboot $(default_kernel_addr) 0 $(nand_uImage_offset) ;setenv bootargs $(bootargs_base) $(bootargs_root) $(buffalo_ver); bootm $(default_kernel_addr)]
30: [def_tftp=tftp $(default_kernel_addr) $(kernel); tftp $(default_initrd_addr) $(initrd); setenv bootargs $(bootargs_base) $(bootargs_root) rw initrd=0x02000040,20M panic=5 $(buffalo_ver); bootm $(default_kernel_addr) $(default_initrd_addr)]
31: [nand_boot=yes]
32: [bootdelay=3]
33: [disaMvPnp=no]
34: [overEthAddr=no]
35: [usb0Mode=host]
36: [usb1Mode=host]

/usr/local/sbin/SetupDevEnv.sh をさんこうに ...
nvram -c set bootargs_root 'root=/dev/sda1 rw panic=5'
nvram -c set bootargs 'console=ttyS0,115200 root=/dev/sda1 rw panic=5 BOOTVER=1.09'
nvram -c set bootcmd 'ide reset; ext2load ide 0:1 $(default_kernel_addr) /$(kernel); bootm $(default_kernel_addr)'

Flashに戻すなら
Marvell>> setenv bootargs_root root=/dev/mtdblock2 rw panic=5
Marvell>> setenv bootargs $(bootargs_base) $(bootargs_root) $(buffalo_ver)
Marvell>> setenv bootcmd 'nboot $(default_kernel_addr) 0 $(nand_uImage_offset) ;setenv bootargs $(bootargs_base) $(bootargs_root) $(buffalo_ver); bootm $(default_kernel_addr)'
Marvell>> saveenv

んー、初回起動時の fsck どうにかならないかなぁ...

0 件のコメント: