x86,tegra,mvebu: image: use common reproducible IMG_PART_SIGNATURE
authorPaul Spooren <mail@aparcar.org>
Mon, 4 Nov 2019 20:55:23 +0000 (10:55 -1000)
committerPetr Štetiar <ynezz@true.cz>
Mon, 11 Nov 2019 15:37:13 +0000 (16:37 +0100)
These targets are currently using more or less same SIGNATURE variable
which provides unique partition ID/signature, so it makes sense to
refactor it out into common IMG_PART_SIGNATURE variable which could be
reused by all targets.

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

Signed-off-by: Paul Spooren <mail@aparcar.org>
[split into separate commit, renamed to IMG_PART_SIGNATURE]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
target/linux/mvebu/image/Makefile
target/linux/tegra/image/Makefile
target/linux/x86/image/Makefile

index 967a1e4ee1525ec9db9197c3d5ac13a8ef1c1810..ce1344a5470e8b74f4a7c6347b6c488e8d898764 100644 (file)
@@ -13,12 +13,10 @@ include $(INCLUDE_DIR)/image.mk
 
 KERNEL_LOADADDR := 0x00008000
 
-SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
-
 define Build/boot-scr
        rm -f $@-boot.scr
        sed \
-               -e 's#@ROOT@#$(SIGNATURE)#g' \
+               -e 's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
                -e 's#@DTB@#$(firstword $(DEVICE_DTS))#g' \
                $(BOOT_SCRIPT).bootscript > $@-new.bootscript
        mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $@-new.bootscript $@-boot.scr
@@ -42,7 +40,7 @@ define Build/boot-img-ext4
 endef
 
 define Build/sdcard-img
-       SIGNATURE="$(SIGNATURE)" \
+       SIGNATURE="$(IMG_PART_SIGNATURE)" \
        ./gen_mvebu_sdcard_img.sh $@ \
                $(if $(UBOOT),$(STAGING_DIR_IMAGE)/$(UBOOT)) \
                c $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
@@ -50,7 +48,7 @@ define Build/sdcard-img
 endef
 
 define Build/sdcard-img-ext4
-       SIGNATURE="$(SIGNATURE)" \
+       SIGNATURE="$(IMG_PART_SIGNATURE)" \
        ./gen_mvebu_sdcard_img.sh $@ \
                $(if $(UBOOT),$(STAGING_DIR_IMAGE)/$(UBOOT)) \
                83 $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.bootimg \
index 2ce86599954c8dd376a9bc4868b8de0c1693b34d..10bada9c38b1400da216f0ae01f0ca72c4a6d639 100644 (file)
@@ -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
@@ -17,7 +15,7 @@ define Build/tegra-sdcard
                $(foreach dtb,$(DEVICE_DTS),$(CP) $(DTS_DIR)/$(dtb).dtb $@.boot), \
                $(CP) $(DTS_DIR)/*.dtb $@.boot)
        sed \
-               -e 's#@ROOT@#$(SIGNATURE)#g' \
+               -e 's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
                -e 's#@KERNEL@#$(KERNEL_NAME)#g' \
                $(BOOT_SCRIPT) > $@-boot.scr
        mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
@@ -25,7 +23,7 @@ define Build/tegra-sdcard
                -d $@-boot.scr \
                $@.boot/boot.scr
 
-       SIGNATURE="$(SIGNATURE)" \
+       SIGNATURE="$(IMG_PART_SIGNATURE)" \
        $(SCRIPT_DIR)/gen_image_generic.sh \
                $@ \
                $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
index ac70e771c86fb4130adea8c0648a0b561400dd38..4383bcdcb2b13a974a596c11329506e169a7e3a8 100644 (file)
@@ -40,9 +40,8 @@ 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)
+ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(IMG_PART_SIGNATURE)-02)
 
 GRUB_TIMEOUT:=$(call qstrip,$(CONFIG_GRUB_TIMEOUT))
 GRUB_TITLE:=$(call qstrip,$(CONFIG_GRUB_TITLE))
@@ -80,7 +79,7 @@ ifneq ($(CONFIG_GRUB_IMAGES),)
                -e 's#@TITLE@#$(GRUB_TITLE)#g' \
                ./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
        -$(CP) $(STAGING_DIR_ROOT)/boot/. $(KDIR)/root.grub/boot/
-       PADDING="1" SIGNATURE="$(SIGNATURE)" PATH="$(TARGET_PATH)" $(SCRIPT_DIR)/gen_image_generic.sh \
+       PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" PATH="$(TARGET_PATH)" $(SCRIPT_DIR)/gen_image_generic.sh \
                $(BIN_DIR)/$(IMG_COMBINED)-$(1).img \
                $(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.grub \
                $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1) \