mirror of
https://github.com/ipxe/ipxe
synced 2025-12-18 18:40:24 +03:00
[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>
This commit is contained in:
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user