From patchwork Thu Nov 7 14:09:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1191173 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DLqFiY2V"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4784yx474bz9sP3 for ; Fri, 8 Nov 2019 01:09:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YzIfvFfdtRKIvwst/NlPkCwUaQqvff7pltz1ZdqVVd4=; b=DLqFiY2Vapj4Si fyq/PBApBJkBOyT1O2JSbTUr+eVB5cjlEqEb6oY4uHrBmQdWd+f7OA0HcuP2uZeytOgRRAwAmlWSF USiZNCaGKYTPPuGwSScLQYG1Ohmc3lXIWjwdueHsGccXqyXO2ZPTFAgKjpvXpnWSpEPMIMNfFBwsM joISGTc3XvAOpvaJR7+kCE3YXQyut5Y/BnJDT1JuxufKA0i+ucND7sb4VkYATsQgOD9Ww2DL1XsrG 0WBlsOPAj9ez2xAY+0UTvf4e2b1K704KxIxejyMFWruHBNogAINnmfyyIXcMkg1WP1RDqIvs84RO6 uH2B9WoKovTgpMqPIs7w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSiTW-0005Fu-21; Thu, 07 Nov 2019 14:09:26 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSiTM-00052b-3D for openwrt-devel@lists.openwrt.org; Thu, 07 Nov 2019 14:09:18 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 239745077; Thu, 7 Nov 2019 15:09:13 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 9e7af13a; Thu, 7 Nov 2019 15:09:01 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Thu, 7 Nov 2019 15:09:03 +0100 Message-Id: <20191107140903.21731-2-ynezz@true.cz> In-Reply-To: <20191107140903.21731-1-ynezz@true.cz> References: <20191107140903.21731-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191107_060916_440267_D05BA0C4 X-CRM114-Status: UNSURE ( 7.31 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH 2/2] x86, tegra, mvebu: image: use common reproducible IMG_PART_SIGNATURE X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Spooren 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) \