From: Michael Brown Date: Tue, 24 Mar 2026 16:41:30 +0000 (+0000) Subject: [build] Ensure that generated filesystem images retain no stale content X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=0d30ee7b49d17248edbfd181bd09579f178ef860;p=thirdparty%2Fipxe.git [build] Ensure that generated filesystem images retain no stale content We use mformat to ensure that the FAT filesystem starts as empty. However, formatting the filesystem can still leave old data blocks present (though unreferenced) within the disk image. Truncate the image to a zero length before extending, to ensure that no stale content is retained. Signed-off-by: Michael Brown --- diff --git a/src/util/genfsimg b/src/util/genfsimg index 875815037..84deea42b 100755 --- a/src/util/genfsimg +++ b/src/util/genfsimg @@ -312,7 +312,6 @@ fi if [ -n "${FATIMG}" ] ; then FATSIZE=$(du -s -k "${FATDIR}" | cut -f1) FATSIZE=$(( FATSIZE + PAD + 256 )) - touch "${FATIMG}" if [ "${FATSIZE}" -le "1440" ] ; then FATSIZE=1440 FATARGS="-f 1440" @@ -325,6 +324,8 @@ if [ -n "${FATIMG}" ] ; then FATSERIAL=$(( SOURCE_DATE_EPOCH % 100000000 )) FATARGS="${FATARGS} -N ${FATSERIAL}" fi + touch "${FATIMG}" + truncate -s 0 "${FATIMG}" truncate -s "${FATSIZE}K" "${FATIMG}" mformat -v iPXE -i "${FATIMG}" ${FATARGS} :: mcopy -i "${FATIMG}" -s "${FATDIR}"/* ::