[OpenWrt-Devel] [PATCH v2] build: unify SIGNATURE and make it reproducible

Paul Spooren mail at aparcar.org
Mon Nov 4 15:55:23 EST 2019


The SIGNATURE variable is a unique ID used as partition identifier for
x86, tegra and mvebu. This patch unifies the generation of SIGNATURE by
creating it once in include/image.mk instead differently for each
target.

Also make it reproducible by using SOURCE_DATE_EPOCH, resulting in equal
SIGNATURE valuess over multiple build with the same commit.

This is another step in the direction of reproducible OpenWrt images.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
I'm currently trying to step up my commit message game, please comment
if the message is unclear or confusing!

 include/image.mk                  | 2 ++
 target/linux/mvebu/image/Makefile | 2 --
 target/linux/tegra/image/Makefile | 2 --
 target/linux/x86/image/Makefile   | 1 -
 4 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 940ae812ea..4884ad9fe2 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -45,6 +45,8 @@ IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$
 IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
 IMG_COMBINED:=$(IMG_PREFIX)-combined
 
+SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
+
 MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
 
 ifneq ($(CONFIG_BIG_ENDIAN),)
diff --git a/target/linux/mvebu/image/Makefile b/target/linux/mvebu/image/Makefile
index 967a1e4ee1..1c96a5e175 100644
--- a/target/linux/mvebu/image/Makefile
+++ b/target/linux/mvebu/image/Makefile
@@ -13,8 +13,6 @@ include $(INCLUDE_DIR)/image.mk
 
 KERNEL_LOADADDR := 0x00008000
 
-SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
-
 define Build/boot-scr
 	rm -f $@-boot.scr
 	sed \
diff --git a/target/linux/tegra/image/Makefile b/target/linux/tegra/image/Makefile
index 2ce8659995..39073a47d2 100644
--- a/target/linux/tegra/image/Makefile
+++ b/target/linux/tegra/image/Makefile
@@ -7,8 +7,6 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
-SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
-
 define Build/tegra-sdcard
 	rm -fR $@.boot
 	mkdir -p $@.boot
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index ac70e771c8..73e468d38f 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -40,7 +40,6 @@ ifneq ($(GRUB_TERMINALS),)
   GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS)
 endif
 
-SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0xFFFFFFFF))')
 ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
 ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(SIGNATURE)-02)
 
-- 
2.24.0.rc1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list