From patchwork Mon Apr 16 14:47:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 133473 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3656540ljb; Mon, 16 Apr 2018 07:52:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx49oxEg+PNLaHg60vsVuQ3DVdK1dAWoYhY4/ToplD/lkvsbcc5wBJw9wOJMXklPYqRxnaUbi X-Received: by 2002:a17:902:10c:: with SMTP id 12-v6mr7852189plb.252.1523890365953; Mon, 16 Apr 2018 07:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523890365; cv=none; d=google.com; s=arc-20160816; b=h77Md21llxGSNrNBnJJEVB9drdF98CHzgjxEvHz3Tj70g26YSbeRICZ4P1N23J5sH/ tn9D74MsqP3miqL04WzkaojZMh4piQ3mE9EgeK51eQEx1h8i5bVty+S3OTeRzpO93g7B j92wDEX9PQYipLUyo9hl4Vq3fxQdevjf/3L6PmOQbLVWaucmVAEzGDKfkd9/hWPNPSsz fyQMs+Yu1JI9UPny9SJXMNknaKz5uReRxhkAIYu9ESnoQSJIxmYmC9e05WjIG17Cy8Km JNfpYAVQ6Hp0Qah/+e8HcNUWBXFeEo8r2ggq1coCGc8bRg+6gYkmYBFjLLywgDmB7X0R DUvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=CYPFusBhS8V9N+DmVeG5V++6ZLl4j07EeJcsetbKx8Q=; b=Dgw058T5/RmfOOVcCP32NI+YIsk4/C1x9Du3yA3cEZcVDaYMVRJ2dDNYcVRP+AFXdp xJxPn5TY8IzLM+k/w82gjqvR5bvIuJsrx83HbobK6CynaqSdcGW49mZSD936jM1oIRCw PGt6wE8SH/FXvLz8u+MZMuzsXXi5AuGCxpluMSucaS2M8BL1tJdfq2SZ7oAQ0pLqWNMB t6YCsLy0nrNMsdqjrAUwtLC9fMmV2+Z8m9Hrdz2RgryVnVSpfVKdXOltGs1ZI7vdfZbM GOlSqENLki3ql4alX2YUce6RcEVMoP/93riJ3r20qk+F7ak8p+9A3eBB2AtMqans5xMG Kzrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=lWKM97y9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si9216653pgc.463.2018.04.16.07.52.45; Mon, 16 Apr 2018 07:52:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=lWKM97y9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbeDPOs7 (ORCPT + 29 others); Mon, 16 Apr 2018 10:48:59 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:62201 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751099AbeDPOs5 (ORCPT ); Mon, 16 Apr 2018 10:48:57 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-10.nifty.com with ESMTP id w3GElqtv017749; Mon, 16 Apr 2018 23:47:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w3GElqtv017749 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1523890080; bh=CYPFusBhS8V9N+DmVeG5V++6ZLl4j07EeJcsetbKx8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWKM97y9xEuDDb1MqFSJF3B7dcmRaP0rmx2WKjAWIJb3aRiX+qz6H5TPwbXXICQF8 njpMNCAa6i3VyEbPqbkhfGcQ/TAWz+78i3sJ9RhnhBtdOC7YmUfhF1G+tTsfRFvY6q zocHwbACaVSbuiQMnsvH2L0kfQcAuvc9bXn2v3ozYY+AArdHt4EZLmMxGOloWV9jty 2c5cFOF5TMqNSjbGWgTYDqzSIoNaxrw+EMW4NvDOOD1ecHu073r3X8tLN2ksjRh2Ph 6NmTNX121chIYyFBnLwmwl7fxMulkuyfr/8wGTQsB9nFmzdq4ytZNyDAlkY5X4GzCv Ir6wr2FdpAxnQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: Ralf Baechle , James Hogan , linux-mips@linux-mips.org Cc: Paul Burton , Masahiro Yamada , Kees Cook , linux-kernel@vger.kernel.org Subject: [PATCH 7/7] MIPS: boot: rebuild ITB when contained DTB is updated Date: Mon, 16 Apr 2018 23:47:47 +0900 Message-Id: <1523890067-13641-8-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523890067-13641-1-git-send-email-yamada.masahiro@socionext.com> References: <1523890067-13641-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since now, the unnecessary rebuild of ITB has been fixed. Another problem to be taken care of is, missed rebuild of ITB. For example, board-boston.its.S includes boston.dtb by the /incbin/ directive. If boston.dtb is updated, vmlinux.*.dtb must be rebuilt. Currently, the dependency between ITB and contained DTB files is not described anywhere. Previously, this problem was hidden since vmlinux.*.itb was always rebuilt even if nothing is updated. By fixing the spurious rebuild, this is a real problem now. Use the same strategy for automatic generation of the header file dependency. DTC works as a backend of mkimage, and DTC supports -d option. It outputs the dependencies, including binary files pulled by the /incbin/ directive. The implementation is simpler than cmd_dtc in scripts/Makefile.lib since we do not need CPP here. Just pass -d $(depfile) to DTC, and let the resulted $(depfile) processed by fixdep. It might be unclear why "$(obj)/dts/%.dtb: ;" is needed. With this commit, *.cmd files will contain dependency on DTB files. In the next invocation of build, the *.cmd files will be included, then Make will try to find a rule to update *.dtb files. Unfortunately, it is found in scripts/Makefile.lib. The build rule of $(obj)/%.dtb is invoked by if_changed_dep, so it needs to include *.cmd files of DTB, but they are not included because we are in arch/mips/boot, but those *.cmd files reside in arch/mips/boot/dts/*/. Cancel the pattern rule in scripts/Makefile.lib to suppress unneeded rebuilding of DTB. Signed-off-by: Masahiro Yamada --- arch/mips/boot/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile index d102d53..f8dce5b 100644 --- a/arch/mips/boot/Makefile +++ b/arch/mips/boot/Makefile @@ -163,11 +163,18 @@ quiet_cmd_itb-image = ITB $@ $(CONFIG_SHELL) $(MKIMAGE) \ -D "-I dts -O dtb -p 500 \ --include $(objtree)/arch/mips \ - --warning no-unit_address_vs_reg" \ + --warning no-unit_address_vs_reg \ + -d $(depfile)" \ -f $(2) $@ $(obj)/vmlinux.itb: $(obj)/vmlinux.its $(obj)/vmlinux.bin FORCE - $(call if_changed,itb-image,$<) + $(call if_changed_dep,itb-image,$<) $(obj)/vmlinux.%.itb: $(obj)/vmlinux.%.its $(obj)/vmlinux.bin.% FORCE - $(call if_changed,itb-image,$<) + $(call if_changed_dep,itb-image,$<) + +# The -d option of DTC outputs dependencies of binaries included by the +# /incbin/ directive. When .*.cmd files are included, Kbuild tries to +# update *.dtb because it sees a pattern rule defined in scripts/Makefile.lib. +# The rule must be cancelled by a more specific rule. +$(obj)/dts/%.dtb: ;