OpenBSD to the rescue (II)
Some days ago, I wrote about how I used OpenBSD to quickly set up a firewall to share an internet connection between a computer and some laptops and back then, I didn't think about what would happend later on this week.
Today, I visited an old friend of mine. After some talk, I noticed that he still has a little embedded computer which size is similar to one of my soekris.
Some months ago we talked about installing something there that could be configured as a firewall and router. The problem we found at that time was that the device only has a limited storage capability (128Mb) in a Industrial Grade flash card.
I recommended him to use OpenBSD for that, but we found out that the base system didn't fit in only 128Mb, we would have to create our own install sets.
But today I had another idea, we could use flashdist to directly put a running image of an OpenBSD system into the 128Mb flash card. With that, we will get a complete OpenBSD system (without some binaries anyway).
But we had a problem to do that, that kind of flash card couldn't be accessed using a USB card reader, and we needed direct access to it in order to use dd and put the image into the flash card.
The only way we could access the flash card directly was booting some operating system directly on the embedded device, an unix-like system that could mount an USB storage device (where the flashdist image was) and a system with the dd tool (to dump that image into the card.
So, we thought about netboot the OpenBSD installer...
Luckily, pAvl0 already has both dhcpd and tftp servers running on a Ubuntu box, so it was a matter of getting the installation files for OpenBSD, put them in the main directory of the tftp server and activate netboot on the embedded device.
Once the installer booted, we selected the (S)hell option and we used that shell within the installer to mount the USB storage device:
# mount -t msdos /dev/sd0i /mnt
and to dump the flashdist image:
# dd if=flashimg-20080308.GENERIC.console of=/dev/wd0c bs=64k
Only after the system was booted, we noticed that the whole system was read-only (loaded into RAM), so we couldn't modify nor the network configuration files neither the PF files.
One more thing to do, tweak our image file before dumping it into the flash card. That's pretty easy, although we didn't have more time to keep playing with that.
Tomorrow I'll try to mount the flashdist image as a normal disk, touch the needed configuration files and then dump again the image into the flash card.