diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-01-22 12:22:11 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-01-22 12:29:25 +0000 |
commit | 05d7591a71274349d17845a955f0d7d486a9634b (patch) | |
tree | 077c86798b3a631cc626d7adea0190b3d2aaaeb1 | |
parent | a2a6618d460d46acacc47d7c3048da3fcf5afd01 (diff) | |
download | ipxe-05d7591a71274349d17845a955f0d7d486a9634b.tar.gz |
[build] Use explicit disk geometry for generated FAT filesystem images
For FAT filesystem images larger than a 1.44MB floppy disk, round up
the image size to a whole number of 504kB cylinders before formatting.
This avoids losing up to a cylinder's worth of expected space in the
filesystem image.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rwxr-xr-x | src/util/genfsimg | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/util/genfsimg b/src/util/genfsimg index 3f1356eae..85fb006c4 100755 --- a/src/util/genfsimg +++ b/src/util/genfsimg @@ -242,12 +242,15 @@ if [ -n "${FATIMG}" ] ; then FATSIZE=$(( FATSIZE + PAD + 256 )) touch "${FATIMG}" if [ "${FATSIZE}" -le "1440" ] ; then - truncate -s 1440K "${FATIMG}" - mformat -v iPXE -i "${FATIMG}" -f 1440 :: + FATSIZE=1440 + FATARGS="-f 1440" else - truncate -s "${FATSIZE}K" "${FATIMG}" - mformat -v iPXE -i "${FATIMG}" :: + FATCYLS=$(( ( FATSIZE + 503 ) / 504 )) + FATSIZE=$(( FATCYLS * 504 )) + FATARGS="-s 63 -h 16 -t ${FATCYLS}" fi + truncate -s "${FATSIZE}K" "${FATIMG}" + mformat -v iPXE -i "${FATIMG}" ${FATARGS} :: mcopy -i "${FATIMG}" -s "${FATDIR}"/* :: if [ "${BIOSDIR}" = "${FATDIR}" ] ; then syslinux "${FATIMG}" |