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 <mail@aparcar.org>
[split into separate commit, renamed to IMG_PART_SIGNATURE]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
Paul Spooren 2019-11-04 10:55:23 -10:00 committed by Petr Štetiar
parent 98d1c7d834
commit e97113d5e1
3 changed files with 7 additions and 12 deletions

View 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 \

View 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 \

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