Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: how to create a disk image? (shark; disklabel + / + swap)



hubert%feyrer.de@localhost wrote:

> Things I've learned by the script, and also by using hexdump(1) on  
> various disk images and disk labels:
> 
>   * a MS-DOS MBR is 512 bytes (boring)

You can see it in <sys/bootblock.h>.

>   * a BSD disklabel is some 300-400 bytes, apparently not really  
> fixed in size.

It's quite machine dependent, defined by LABELOFFSET and MAXPARTITIONS
in <machine/disklabel.h>.

The actual written size might be variable by d_npartitions
in struct disklabel.

>     the interesting part: if you create a BSD disk label on a image,  
> the first 512 bytes
>     are left alone. good to put an MBR in!

This is also machine dependent, defined by LABELSECTOR.
On ports which handle MBR (FDISK) partitions, LABELSECTOR should be 1.

>   * 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! :-)

Maybe FFS was well considered. On the other hand, ext2fs preserves
only 1024 bytes, i.e. we can put only MBR and disklabel there,
so it's quite annoying to design a bootloader.  (consider LILO..)
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index