Creating a bootable disk image (for shark/arm and i386)
I've added a SD-Card to IDE adapter to my shark some time ago,
and wanted to create an image for the SD-Card. Using Mac OS
as development platform prevented the use of NetBSD's vnd(4),
plus I wanted to do this without root privileges. NetBSD's
makefs(8) seemed like a nice tool, but how to add bootblocks,
partition tables, etc.? A script posted by Izumi Tsutsui
got me on track, and after looking a bit at some hexdumps
of various file system images, boot blocks, and BSD disk labels,
I managed to adjust Izumi's script enough to give me bootable
disk images for booth shar/arm and i386.
The script can be found
in the port-arm archive.
Lessons that I've learned by this (and that I'd like to share):
A followup by Izumi
explains these things in more details.
- a MS-DOS MBR is 512 bytes (boring)
- a BSD disklabel is some 300-400 bytes, apparently not really fixed in size.
The interesting part: if you create a BSD disk label on a image, the
first 512 bytes are left alone. Good to put a MBR in!
- when you have a FFS file system image (e.g. created with mkfile), the
actual file system data only starts at byte 8192 - that's plenty of
space to put a BSD disk label in there. Oh, and a MBR, too, if needed! :-)
[Tags: arm, boot, i386, image, makefs, shark]