summaryrefslogtreecommitdiffstats
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2011-05-05 00:52:19 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2011-05-05 00:52:19 +0000
commit1b404ba5ee1af230b5a640424bdb749bbe17c58d (patch)
tree1765b2fcf49631af9627bba370ae97ea1058d1c9 /usr.sbin/makefs
parent13ee794d56c187874092b885943b52cce1a52dde (diff)
downloadFreeBSD-src-1b404ba5ee1af230b5a640424bdb749bbe17c58d.zip
FreeBSD-src-1b404ba5ee1af230b5a640424bdb749bbe17c58d.tar.gz
Fix boot on old machines (e.g. blue and white G3s) by synthesizing a
512-byte sector map instead unused space in the first 2048-byte sector.
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/cd9660/cd9660_eltorito.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c
index f0c8b2d..fef2fda 100644
--- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c
+++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c
@@ -528,6 +528,25 @@ cd9660_write_apm_partition_entry(FILE *fd, int index, int total_partitions,
fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR);
fwrite(part_type, strlen(part_type) + 1, 1, fd);
+ if (sector_size > 512) {
+ /*
+ * Some old broken software looks at 512-byte boundaries for
+ * partition table entries instead of sector boundaries. We
+ * can fit 3 entries into the first 2048-byte block, so use
+ * that to humor old code.
+ */
+
+ int n_512_parts = (sector_size / 512) - 1;
+ if (n_512_parts > total_partitions)
+ n_512_parts = total_partitions;
+
+ if (index < n_512_parts)
+ cd9660_write_apm_partition_entry(fd, index, n_512_parts,
+ sector_start * (sector_size / 512),
+ nsectors * (sector_size / 512), 512, part_name,
+ part_type);
+ }
+
return 0;
}
OpenPOWER on IntegriCloud