Ver Fonte

x86,tegra,mvebu: image: use common reproducible IMG_PART_SIGNATURE

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 <[email protected]>
[split into separate commit, renamed to IMG_PART_SIGNATURE]
Signed-off-by: Petr Štetiar <[email protected]>
Paul Spooren há 6 anos atrás
pai
commit
e97113d5e1

+ 3 - 5
target/linux/mvebu/image/Makefile

@@ -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 [email protected]
 	sed \
-		-e 's#@ROOT@#$(SIGNATURE)#g' \
+		-e 's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
 		-e 's#@DTB@#$(firstword $(DEVICE_DTS))#g' \
 		$(BOOT_SCRIPT).bootscript > [email protected]
 	mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d [email protected] [email protected]
@@ -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) [email protected] \
@@ -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) [email protected] \

+ 2 - 4
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 [email protected]
 	mkdir -p [email protected]
@@ -17,7 +15,7 @@ define Build/tegra-sdcard
 		$(foreach dtb,$(DEVICE_DTS),$(CP) $(DTS_DIR)/$(dtb).dtb [email protected]), \
 		$(CP) $(DTS_DIR)/*.dtb [email protected])
 	sed \
-		-e 's#@ROOT@#$(SIGNATURE)#g' \
+		-e 's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
 		-e 's#@KERNEL@#$(KERNEL_NAME)#g' \
 		$(BOOT_SCRIPT) > [email protected]
 	mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
@@ -25,7 +23,7 @@ define Build/tegra-sdcard
 		-d [email protected] \
 		[email protected]/boot.scr
 
-	SIGNATURE="$(SIGNATURE)" \
+	SIGNATURE="$(IMG_PART_SIGNATURE)" \
 	$(SCRIPT_DIR)/gen_image_generic.sh \
 		$@ \
 		$(CONFIG_TARGET_KERNEL_PARTSIZE) [email protected] \

+ 2 - 3
target/linux/x86/image/Makefile

@@ -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) \