From e97113d5e18c31050bc06f7c6b7a5c663b5f31a4 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 4 Nov 2019 10:55:23 -1000 Subject: [PATCH] x86,tegra,mvebu: image: use common reproducible IMG_PART_SIGNATURE MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 [split into separate commit, renamed to IMG_PART_SIGNATURE] Signed-off-by: Petr Å tetiar --- target/linux/mvebu/image/Makefile | 8 +++----- target/linux/tegra/image/Makefile | 6 ++---- target/linux/x86/image/Makefile | 5 ++--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/target/linux/mvebu/image/Makefile b/target/linux/mvebu/image/Makefile index 967a1e4ee152..ce1344a5470e 100644 --- a/target/linux/mvebu/image/Makefile +++ b/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 $@-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 \ diff --git a/target/linux/tegra/image/Makefile b/target/linux/tegra/image/Makefile index 2ce86599954c..10bada9c38b1 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 @@ -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 \ diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index ac70e771c86f..4383bcdcb2b1 100644 --- a/target/linux/x86/image/Makefile +++ b/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) \ -- 2.30.2