2010-07-06 NetBSD/netwalker #3.1
NetBSD単体でのNetWalkerのbootable SDカードの作成。とりあえず2GのSDカードで試した。
> disklabel -Ii sd1 (Wしておく) > disklabel -e sd1 (以下のように書く) > disklabel sd1 # /dev/rsd1d: type: SCSI disk: SD/MMCReader label: fictitious flags: removable bytes/sector: 512 sectors/track: 32 tracks/cylinder: 64 sectors/cylinder: 2048 cylinders: 1938 total sectors: 3970048 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 6 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 3970047 1 Linux Ext2 0 0 # (Cyl. 0*- 1938*) d: 3970048 0 unused 0 0 # (Cyl. 0 - 1938*) > newfs_ext2fs -O 1 /dev/rsd1a /dev/rsd1a: 1938.5MB (3970047 sectors) block size 4096, fragment size 4096 using 16 block groups of 128.0MB, 32768 blks, 15520 inodes. super-block backups (for fsck_ext2fs -b #) at: 32768, 98304, 163840, 229376, 294912, > mount /dev/sd1a /mnt > mkdir /mnt/boot > echo /boot/netbsd.bin > /mnt/boot/boot.conf > cp /usr/src/sys/arch/evbarm/compile/IMX51NETWALKER/netbsd.bin /mnt/boot/netbsd.bin > umount /mnt
で boot するSDカードができた。(※)
大事な点は、Linux ext2fs の開始 offset を 1 にするのと、newfs_ext2fs -O 1 にしなければならない所。でないとbootしなかった。(内蔵flashから起動してしまう)
/boot/boot.conf に書くファイル名は場所さえ合ってればどこでもいいと思われ。試してないけどELF直接は無理かな
メモ。オリジナルのboot.conf
/boot/zImage quiet noinitrd root=/dev/mmcblk0p1 rw rootfstype=ext2 rootdelay=3 console=ttymxc0,115200
デバッグ用
/boot/zImage debug noinitrd root=/dev/mmcblk0p1 rw rootfstype=ext2 rootdelay=3 console=mxcuart,0x73fbc000,115200
(※)2015-04-24追記
newfsのblocksizeは4096でないとダメのようです。上では偶然4kになってますが、サイズの違うSDカードを使う場合は newfs_ext2fs -O 1 -b 4096 のようにしないといけないので注意。(参考: http://d.hatena.ne.jp/nonakap/20150424 )
EOF