From patchwork Thu Apr 16 04:38:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 1271485 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.a=rsa-sha256 header.s=dec2015msa header.b=VbWULQiy; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 492mjM5x0tz9sPF for ; Thu, 16 Apr 2020 14:39:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3EDC9819F3; Thu, 16 Apr 2020 06:39:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (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 (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="VbWULQiy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B6CF805A4; Thu, 16 Apr 2020 06:39:31 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6E3258047E for ; Thu, 16 Apr 2020 06:39:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=masahiroy@kernel.org Received: from oscar.flets-west.jp (softbank060142179096.bbtec.net [60.142.179.96]) (authenticated) by conuserg-08.nifty.com with ESMTP id 03G4cUkQ008921; Thu, 16 Apr 2020 13:38:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 03G4cUkQ008921 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1587011914; bh=jI44O/d2UEpwYcwa+QorN6oZJ18F63EdLkyRUpa0hW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VbWULQiyRr8P6rGAnZyYjN2igc4EZSxD5dqvyqg3oqp4kIFglKbqgSreyN8c7Y7Dd cTL+uFwd34YdfDrMWxRuUvW6EFJxrNFUIjvDay3naxHZ6WKe2yZlJoOdBsKET1GcmG FEZesS6XR1LjLsk4jlyx0IdlgZEQpoagkAt/vmHIuFs4By4UnEvrDjQSIAM4c++HnU w9EAfv/IxJ4euWpiTYJulsL+j+o1aMHQtVeQ1zf7QvnAsFcOP42lm7mpyRS459JY6p i8YFAD7fEILFLs7YZg7QcYfa+mc0tIcEkdSCJLHEugJ/06NP8lDgXDPMV/R2WQNGML rQkXaw0akG0yg== X-Nifty-SrcIP: [60.142.179.96] From: Masahiro Yamada To: u-boot@lists.denx.de Cc: Bin Meng , Masahiro Yamada , Heiko Stuebner , Kever Yang , Simon Glass , Vignesh Raghavendra Subject: [PATCH 3/3] kbuild: SPL/TPL: generate separate asm-offsets.h for SPL and TPL Date: Thu, 16 Apr 2020 13:38:26 +0900 Message-Id: <20200416043826.490120-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200416043826.490120-1-masahiroy@kernel.org> References: <20200416043826.490120-1-masahiroy@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Currently generic-asm-offsets.h and asm-offsets.h are generated based on U-Boot proper config options. The same asm-offsets headers are used for building U-Boot SPL/TPL, which causes potential offset mismatch if U-Boot proper has different config options from U-Boot SPL/TPL. This commit adds: spl/include/generated/(generic-)asm-offsets.h tpl/include/generated/(generic-)asm-offsets.h spl/include/generated/(generic-)asm-offsets.h is generated if CONFIG_SPL=y, and included when building SPL. tpl/include/generated/(generic-)asm-offsets.h is generated if CONFIG_TPL=y, and included when building TPL. They are created before Kbuild descends into SPL/TPL object directories and builds $(obj)/dts/dt-platdata.o because $(obj)/dts/dt-platdata.c includes a bunch of headers. Prepend -I$(obj)/include to $(UBOOTINCLUDE) so (generic-)asm-offsets.h is searched in {spl,tpl}/include/generated/. Requested-by: Bin Meng Signed-off-by: Masahiro Yamada --- Kbuild | 4 ++-- scripts/Makefile.spl | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Kbuild b/Kbuild index 6014f7c34a..1eac091594 100644 --- a/Kbuild +++ b/Kbuild @@ -10,7 +10,7 @@ generic-offsets-file := include/generated/generic-asm-offsets.h always := $(generic-offsets-file) targets := lib/asm-offsets.s -$(obj)/$(generic-offsets-file): lib/asm-offsets.s FORCE +$(obj)/$(generic-offsets-file): $(obj)/lib/asm-offsets.s FORCE $(call filechk,offsets,__GENERIC_ASM_OFFSETS_H__) ##### @@ -25,5 +25,5 @@ targets += arch/$(ARCH)/lib/asm-offsets.s CFLAGS_asm-offsets.o := -DDO_DEPS_ONLY -$(obj)/$(offsets-file): arch/$(ARCH)/lib/asm-offsets.s FORCE +$(obj)/$(offsets-file): $(obj)/arch/$(ARCH)/lib/asm-offsets.s FORCE $(call filechk,offsets,__ASM_OFFSETS_H__) diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 98c04bbbfc..c3fa45f520 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -22,6 +22,8 @@ include $(srctree)/scripts/Kbuild.include -include include/config/auto.conf -include $(obj)/include/autoconf.mk +UBOOTINCLUDE := -I$(obj)/include $(UBOOTINCLUDE) + KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD ifeq ($(CONFIG_TPL_BUILD),y) KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD @@ -311,7 +313,7 @@ cmd_plat = $(CC) $(c_flags) -c $< -o $(filter-out $(PHONY),$@) targets += $(obj)/dts/dt-platdata.o $(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c \ - include/generated/dt-structs-gen.h FORCE + include/generated/dt-structs-gen.h prepare FORCE $(call if_changed,plat) PHONY += dts_dir @@ -422,9 +424,13 @@ $(obj)/$(SPL_BIN): $(u-boot-spl-platdata) $(u-boot-spl-init) \ $(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ; PHONY += $(u-boot-spl-dirs) -$(u-boot-spl-dirs): $(u-boot-spl-platdata) +$(u-boot-spl-dirs): $(u-boot-spl-platdata) prepare $(Q)$(MAKE) $(build)=$@ +PHONY += prepare +prepare: + $(Q)$(MAKE) $(build)=$(obj)/. + quiet_cmd_cpp_lds = LDS $@ cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ -D__ASSEMBLY__ -x assembler-with-cpp -std=c99 -P -o $@ $<