From patchwork Wed Oct 7 13:39:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1378006 X-Patchwork-Delegate: trini@ti.com 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.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=default header.b=TtDqlUNY; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C5wSL5KWkz9sTt for ; Thu, 8 Oct 2020 00:40:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2D67381260; Wed, 7 Oct 2020 15:39:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="TtDqlUNY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 91414806C5; Wed, 7 Oct 2020 15:39:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1C2A9806C5 for ; Wed, 7 Oct 2020 15:39:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from pali.im (pali.im [31.31.79.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F071206DD; Wed, 7 Oct 2020 13:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602077991; bh=vtUfdNSlvbOPbZjqpoIE059pqe8lvNB5ZBYaFC7PtPQ=; h=From:To:Cc:Subject:Date:From; b=TtDqlUNYmoAOw/UnF1f/fqpGMTTMPJ5cErLbY0nMKdVoqTplkem90OM8JOmqhtDMk HBgomoxP05vL3xDKnwAaJ7K000i4dfGrZvWURRq4UWM3uRjVlgl3OvGAug/Y8kmz77 +lCmy7laXy9k2BfBZhx43adFZ67uM4pgH4eXhZCY= Received: by pali.im (Postfix) id ABAC45FF; Wed, 7 Oct 2020 15:39:48 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Simon Glass , Bin Meng , Kever Yang , Jagan Teki , Heinrich Schuchardt Cc: u-boot@lists.denx.de Subject: [PATCH] Makefile: Fix u-boot-nodtb.bin target Date: Wed, 7 Oct 2020 15:39:40 +0200 Message-Id: <20201007133940.21028-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This change fixes two issues when building u-boot-nodtb.bin target: * Remove intermediate binary u-boot-nodtb.bin from disk when static_rela call (which modifies u-boot-nodtb.bin binary) failed. It is required because previous objcopy call creates binary and static_rela finish it. * Do not call static_rela cmd when u-boot-nodtb.bin binary was not created/updated by previous objcopy call. Second fix would ensure that u-boot-nodtb.bin binary is not updated when all prerequisites were up-to-date. And therefore final binary u-boot.bin is not updated in case all prerequisites were not modified and were up-to-date. Now running 'make SOURCE_DATE_EPOCH=0 u-boot.bin' second time now does not touch u-boot.bin binary in case nothing was modified, so GNU make can correctly detect that everything is up-to-date. Signed-off-by: Pali Rohár Reviewed-by: Simon Glass --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d4736bb501..91b6d2c2b3 100644 --- a/Makefile +++ b/Makefile @@ -884,7 +884,7 @@ cmd_static_rela = \ tools/relocate-rela $(3) $(4) $$start $$end else quiet_cmd_static_rela = -cmd_static_rela = +cmd_static_rela = true endif # Always append INPUTS so that arch config.mk's can add custom ones @@ -1317,9 +1317,13 @@ init_sp_bss_offset_check: u-boot.dtb FORCE fi endif +shell_cmd = { $(echo-cmd) $(cmd_$(1)); } + +quiet_cmd_objcopy_uboot = OBJCOPY $@ +cmd_objcopy_uboot = $(cmd_objcopy) && $(call shell_cmd,static_rela,$<,$@,$(CONFIG_SYS_TEXT_BASE)) || rm -f $@ + u-boot-nodtb.bin: u-boot FORCE - $(call if_changed,objcopy) - $(call cmd,static_rela,$<,$@,$(CONFIG_SYS_TEXT_BASE)) + $(call if_changed,objcopy_uboot) $(BOARD_SIZE_CHECK) u-boot.ldr: u-boot