Getting FreeBSD onto a flash chip


I am setting up two Soekris net5501 boxes to use as routers. After you install FreeBSD to a directory (I chose /usr/net5501) this is how to get that installation onto a flash chip.

In this example my flash chip shows up as /dev/da1

You get the count for sectors/unit (in my case 31227840) by:

# bsdlabel -Awn da1 auto

Okay – so the old Ultradesic tutorial I was following was having you make a “dangerously dedicated” disk. Also, I left out the -B in the bsdlabel command below because I assumed -b implied -B but I do not believe it does.

Let’s use slices instead (the standard way).  `mkdir /mnt/flash` or choose your own mount directory.

# dd if=/dev/zero of=/dev/da1 bs=1k count=1
# fdisk -BI da1
# bsdlabel -B -b /usr/net5501/boot/boot -w da1s1 auto
# bsdlabel -e da1s1 # Don't need to edit anything for our purposes here but this is where you would add slices
# newfs -U /dev/da1s1a # -U enables soft updates
# mount /dev/da1s1a /mnt/flash
# (cd /usr/net5501 ; tar cPf - .) | (cd /mnt/flash ; tar xf - );
# umount /mnt/flash