NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/57925: [RB] mkimage: Honor $MKREPRO_TIMESTAMP



>Number:         57925
>Category:       misc
>Synopsis:       [RB] mkimage: Honor $MKREPRO_TIMESTAMP
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 11 00:45:00 +0000 2024
>Originator:     Jan-Benedict Glaw
>Release:        current
>Organization:
>Environment:
>Description:
Several mach/arch tuples use ./distrib/utils/embedded/mkimage, which allows for build timestamps to sneak into the generated image.
>How-To-Repeat:
Build twice, compare results, eg. for riscv/riscv32.
>Fix:
The following patch will fix most of the issues. I still see a last-written or umount timestamp, still searching for that...


diff --git a/distrib/utils/embedded/mkimage b/distrib/utils/embedded/mkimage
index 737d057a61fa..03392b20c2c1 100755
--- a/distrib/utils/embedded/mkimage
+++ b/distrib/utils/embedded/mkimage
@@ -245,16 +245,24 @@ if [ -n "${msdosid}" ]; then
        11|12)  fat_opt=",fat_type=32";;
        *)      fat_opt=;;
        esac
+       if [ -n ${MKREPRO_TIMESTAMP} ]; then
+               makefs_opt="-T ${MKREPRO_TIMESTAMP}"
+               fat_opt="${fat_opt},volume_id=$((${MKREPRO_TIMESTAMP} & 0xffff))"
+       fi
+
        ${MAKEFS} -N ${release}/etc -t msdos \
-           -o "volume_label=NETBSD${fat_opt}" \
+           -o "volume_label=NETBSD${fat_opt}" ${makefs_opt} \
            -O $((${init} / 2))m -s $((${boot} / 2))m \
            ${image} ${mnt}/boot
 fi
 
 if [ -z "${bootonly}" ]; then
        echo ${bar} Populating ffs filesystem ${bar}
+       if [ -n ${MKREPRO_TIMESTAMP} ]; then
+               makefs_opt="-T ${MKREPRO_TIMESTAMP}"
+       fi
        ${MAKEFS} -rx ${endian} -N ${release}/etc -t ffs \
-           -O ${ffsoffset} \
+           -O ${ffsoffset} ${makefs_opt} \
            -o d=4096,f=8192,b=65536 -b $((${extra}))m \
            -F "$tmp/selected_sets" ${image} "${release}" "${mnt}"
 fi
@@ -276,6 +284,9 @@ if $gpt; then
        if $gpt_hybrid; then
                gpt_flags="-H"
        fi
+       if [ -n ${MKREPRO_TIMESTAMP} ]; then
+               gpt_flags="$gpt_flags -T ${MKREPRO_TIMESTAMP}"
+       fi
        initsecs=$((${init} * 1024))
        bootsecs=$((${boot} * 1024))
        ffsstart="$(getsectors ${ffsoffset})"
@@ -328,7 +339,7 @@ fi
 if $compress; then
        echo ${bar} Compressing image ${bar}
        rm -f "${image}.gz"
-       ${GZIP_CMD} -9 ${image}
+       ${GZIP_CMD} -n -9 ${image}
        image="${image}.gz"
 fi
 



Home | Main Index | Thread Index | Old Index