mirror of
https://github.com/ipxe/ipxe
synced 2026-05-09 18:00:12 +03:00
[build] Use sector count values consistently in genfsimg
The calculations around the FAT filesystem layout currently use a mixture of kilobytes and sector counts. Switch to using sector counts throughout the calculation, to make the code easier to read. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
+7
-7
@@ -341,18 +341,18 @@ fi
|
|||||||
# Create FAT filesystem image, if applicable
|
# Create FAT filesystem image, if applicable
|
||||||
#
|
#
|
||||||
if [ -n "${FATIMG}" ] ; then
|
if [ -n "${FATIMG}" ] ; then
|
||||||
FATSIZE=$(du -s -k "${FATDIR}" | cut -f1)
|
FATUSED=$(du -s -k "${FATDIR}" | cut -f1)
|
||||||
FATSIZE=$(( FATSIZE + PAD + 256 ))
|
FATSIZE=$(( ( FATUSED + PAD + 256 ) * 2 ))
|
||||||
if [ -n "${FATPART}" -o "${FATSIZE}" -gt "1440" ] ; then
|
if [ -n "${FATPART}" -o "${FATSIZE}" -gt "2880" ] ; then
|
||||||
FATHEADS=64
|
FATHEADS=64
|
||||||
FATSECTS=32
|
FATSECTS=32
|
||||||
FATALIGN=$(( ( FATHEADS * FATSECTS ) / 2 ))
|
FATALIGN=$(( FATHEADS * FATSECTS ))
|
||||||
FATCYLS=$(( ( FATSIZE + FATALIGN - 1 ) / FATALIGN ))
|
FATCYLS=$(( ( FATSIZE + FATALIGN - 1 ) / FATALIGN ))
|
||||||
FATSIZE=$(( FATCYLS * FATALIGN ))
|
FATSIZE=$(( FATCYLS * FATALIGN ))
|
||||||
FATARGS="-t ${FATCYLS} -h ${FATHEADS} -s ${FATSECTS}"
|
FATARGS="-t ${FATCYLS} -h ${FATHEADS} -s ${FATSECTS}"
|
||||||
else
|
else
|
||||||
FATSIZE=1440
|
FATSIZE=2880
|
||||||
FATARGS="-f ${FATSIZE}"
|
FATARGS="-f 1440"
|
||||||
fi
|
fi
|
||||||
if [ -n "${FATPART}" ] ; then
|
if [ -n "${FATPART}" ] ; then
|
||||||
FATOFFS="${FATSECTS}"
|
FATOFFS="${FATSECTS}"
|
||||||
@@ -366,7 +366,7 @@ if [ -n "${FATIMG}" ] ; then
|
|||||||
fi
|
fi
|
||||||
touch "${FATIMG}"
|
touch "${FATIMG}"
|
||||||
truncate -s 0 "${FATIMG}"
|
truncate -s 0 "${FATIMG}"
|
||||||
truncate -s "${FATSIZE}K" "${FATIMG}"
|
truncate -s $(( FATSIZE * 512 )) "${FATIMG}"
|
||||||
if [ -n "${FATPART}" ] ; then
|
if [ -n "${FATPART}" ] ; then
|
||||||
dd if="${FATMBR}" of="${FATIMG}" conv=notrunc status=none
|
dd if="${FATMBR}" of="${FATIMG}" conv=notrunc status=none
|
||||||
mpartition -c -I -t "${FATCYLS}" -h "${FATHEADS}" -s "${FATSECTS}" \
|
mpartition -c -I -t "${FATCYLS}" -h "${FATHEADS}" -s "${FATSECTS}" \
|
||||||
|
|||||||
Reference in New Issue
Block a user