Saturday, September 09, 2006

Soekris CF image creation

Getting NetBSD on a Soekris, the quick way. (This should become a tech-note at some point.)

*Note: this assumes you don't care about wear and tear on the CF card
*Note: it also assumes you've got another NetBSD (unix) host.

Build an image of the proper size. You'll get the size in sectors from dmesg when inserting the card.

In my case, it was 500736 (a "256 Meg" card).
dd if=/dev/zero of=CF bs=512 count=500736
500736+0 records in
500736+0 records out
256376832 bytes transferred in 4.316 secs (59401490 bytes/sec)

Then do it up on a VND:
vnconfig -v -c vnd0 CF
/dev/rvnd0d: 256376832 bytes on CF

Disklabel: remove the extra partition, change the label
disklabel -e -I vnd0

Newfs:
newfs -B le -m 0 -o space /dev/rvnd0a
/dev/rvnd0a: 244.5MB (500736 sectors) block size 8192, fragment size 1024
using 6 cylinder groups of 40.75MB, 5216 blks, 10112 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 83488, 166944, 250400, 333856, 417312,

Install boot:
/usr/sbin/installboot -v -m i386 -o timeout=3,console=com0,speed=19200 -t ffs /dev/rvnd0a /usr/mdec/bootxx_ffsv1
File system: /dev/rvnd0a
File system type: ffs (blocksize 8192, needswap 0)
Primary bootstrap: /usr/mdec/bootxx_ffsv1
Ignoring MBR with invalid magic in sector 0 of `/dev/rvnd0a'
Preserving 51 (0x33) bytes of the BPB
Boot options: timeout 3, flags 0, speed 19200, ioaddr 0, console com0

(the default on the soekris is 19200)

mount /dev/vnd0a /mnt
cp /usr/mdec/boot /mnt
tar -C /mnt -xpzf base.tgz
tar -C /mnt -xpzf etc.tgz
tar -C /mnt -xpzf misc.tgz
tar -C /mnt -xpzf text.tgz

mkdir /mnt/kern /mnt/proc

You might also want to make device entries, its saves several seconds of boot time to not have to run that in an mfs.

fstab:
/dev/wd0a / ffs rw,noatime,nodevmtime 1 1
kernfs /kern kernfs rw
procfs /proc procfs rw,noauto
tmpfs /tmp tmpfs rw

rc.conf:
sshd=YES
hostname=soekris.local
dhclient=YES
dhclient_flags="-q sip0"
savecore=NO
no_swap=YES

Added to gettytab:
Pc.19200|Pc 19200 console:\
:np:sp#19200:ig:ht:

changed in ttys:
console "/usr/libexec/getty Pc.19200" vt100 on secure

Once done configuring, unmount.
umount /mnt
vnconfig -u vnd0

Write it out to the card:
dd if=CF of=/dev/rsd0d


I think I got everything.

No comments: