From 5625a02e77bd293e999562141aab01746521f30b Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sun, 3 Nov 2019 03:18:35 +0100 Subject: [PATCH] ubinize-image: set image sequence from SOURCE_DATE_EPOCH Set the image sequence number to SOURCE_DATE_EPOCH. If not set, ubinize will use rand() as image sequence. Signed-off-by: Alexander Couzens --- scripts/ubinize-image.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh index d82d81432d..c6f8bcefe5 100755 --- a/scripts/ubinize-image.sh +++ b/scripts/ubinize-image.sh @@ -9,6 +9,7 @@ kernel="" rootfs="" outfile="" err="" +ubinize_seq="" ubivol() { volid=$1 @@ -81,6 +82,12 @@ ubilayout() { [ "$rootfs_type" = "ubifs" ] || ubivol $vol_id rootfs_data "" 1 } +set_ubinize_seq() { + if [ -n "$SOURCE_DATE_EPOCH" ] ; then + ubinize_seq="-Q $SOURCE_DATE_EPOCH" + fi +} + while [ "$1" ]; do case "$1" in "--uboot-env") @@ -137,8 +144,9 @@ if [ -z "$ubinizecfg" ]; then fi ubilayout "$ubootenv" "$rootfs" "$kernel" > "$ubinizecfg" +set_ubinize_seq cat "$ubinizecfg" -ubinize -o "$outfile" $ubinize_param "$ubinizecfg" +ubinize $ubinize_seq -o "$outfile" $ubinize_param "$ubinizecfg" err="$?" [ ! -e "$outfile" ] && err=2 rm "$ubinizecfg"