ubinize-image: set image sequence from SOURCE_DATE_EPOCH
authorAlexander Couzens <lynxis@fe80.eu>
Sun, 3 Nov 2019 02:18:35 +0000 (03:18 +0100)
committerAlexander Couzens <lynxis@fe80.eu>
Sun, 3 Nov 2019 03:20:21 +0000 (04:20 +0100)
Set the image sequence number to SOURCE_DATE_EPOCH.
If not set, ubinize will use rand() as image sequence.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
scripts/ubinize-image.sh

index d82d81432d976cbf0be2d86cfd47fb36420e0d00..c6f8bcefe5e04bc3e3093873f593aa8ab0ada9f2 100755 (executable)
@@ -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"