freebsd-dev/usr.bin/mkimg
Marcel Moolenaar 53fcdb2d1a Fix partition alignment and image rounding when any of -P (block size),
-T (track size) or -H (number of heads) is given:
o   scheme_metadata() always rounded to the block size.  This is not
    always valid (e.g. vtoc8 that must have partitions start at cylinder
    boundaries).
o   The bsd and vtoc8 schemes "resized" the image to make it match the
    geometry, but since the geometry is an approximation and the size
    of the image computed from cylinders * heads * sectors is always
    smaller than the original image size, the partition information ran
    out of bounds.

The fix is to have scheme_metadata() simply pass it's arguments to the
per-scheme metadata callback, so that schemes not only know where the
metadata is to go, but also what the current block address is. It's now
up to the per-scheme callback to reserve room for metadata and to make
sure alignment and rounding is applied.

The BSD scheme now has the most elaborate alignment and rounding. Just
to make the point: partitions are aligned on block boundaries, but the
image is rounded to the next cyclinder boundary.

vtoc8 now properly has all partitions aligned (and rounded) to the
cyclinder boundary.

Obtained from:	Juniper Networks, Inc.
MFC after:	3 days
2014-09-19 23:16:02 +00:00
..
apm.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
bsd.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
ebr.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
format.c MFuser/marcel/mkimg: 2014-05-15 19:19:57 +00:00
format.h MFuser/marcel/mkimg: 2014-05-15 19:19:57 +00:00
gpt.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
image.c Add image_data() for checking whether a sequence of blocks has data. 2014-07-15 04:39:23 +00:00
image.h Add image_data() for checking whether a sequence of blocks has data. 2014-07-15 04:39:23 +00:00
Makefile Add VHD support to mkimg(1). VHD is used by Xen and Microsoft's Hyper-V 2014-07-03 20:31:43 +00:00
mbr.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
mkimg.1 Add support for adding empty partition entries. I.e. skip partition 2014-09-12 20:05:08 +00:00
mkimg.c Add support for adding empty partition entries. I.e. skip partition 2014-09-12 20:05:08 +00:00
mkimg.h Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
pc98.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
raw.c Add VHD support to mkimg(1). VHD is used by Xen and Microsoft's Hyper-V 2014-07-03 20:31:43 +00:00
scheme.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
scheme.h Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
vhd.c Fix builds on older FreeBSD versions and/or non-FreeBSD machines: 2014-07-23 18:05:39 +00:00
vmdk.c Create a redundant grain directory and table. Previously we were 2014-08-09 04:47:12 +00:00
vtoc8.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00