From: Michael Brown Date: Fri, 22 Jan 2021 12:22:11 +0000 (+0000) Subject: [build] Use explicit disk geometry for generated FAT filesystem images X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05d7591a71274349d17845a955f0d7d486a9634b;p=thirdparty%2Fipxe.git [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 --- 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}"