From patchwork Tue Apr 17 09:10:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 133527 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp4489833ljb; Tue, 17 Apr 2018 02:11:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx48SDvgtgYmTVRhfBicSCqDfeHsV9+XYQ7QdPVURKYRYNVIpx883K8YawrWVb86qhnVHvve3 X-Received: by 10.101.93.138 with SMTP id f10mr1152498pgt.25.1523956290041; Tue, 17 Apr 2018 02:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523956290; cv=none; d=google.com; s=arc-20160816; b=j2fhoZQCk/FQsTSayg1hhOn9FYtdlaSjKGxFxjOCr4I250TxoYONFF4IxsvByXCgga p368eBbRUcdgXwN/qMAS0QUwfkP5X2oTkcdA5zIzQIetp1EN5y8rY9yx0NF8pN05CedC E7ivFLDDF6GJdTjWIzf/hdGExjQNmR4Pqo9uUg3hVFgrZooY6fPxVJ5b/kBFCJp/Wkt1 h2P4SEBGbeleaRHzEJbq92eKutpyimWZuJ/TLnitlt0WnB3i1ulF/+Wd7WAsyhkU2wRd pqWtNrAQ5hDGHsefppns4t0vbCY8Ds+DLIOWg9SMbZQ4fY/4HoDL84IWrVgJv6OypUcF RlXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=T2Y6MIawRKW051CJLSm3ld944YfHUwvXpvqTzyCvMB0=; b=JxAfiIuaqlIVtMhpSTGA+lxJwyvPslRugX17LEMI19K65AIYh294BAPcXtZyaNPRMQ JA5cO6dNmCzWPVTOD3j69vH5188J8m7V+sr/RzmvvsRhMX16/xoiSmDjyIbwgbFtU53q OIRimU8LOuckR4ha57PUdUFN2LSNxiMnnsrhOyIA/SRjLpdILfKJ1cN7vHY8djj0XMzL lr4tDdot6CWfrkh+ONAQd9YvhqxPfguE7g9+a2vkC28e+hVJOAtZw3N1n4pe8ikpLdT7 d30A6AlKQch2GK2vwcd8clHqakzJ7AJZ0b2ybDxfCUVZpZLeQx7pkCDIwf9cknUm+6Fi iDUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=t8dTWW2i; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r25si12132209pfh.2.2018.04.17.02.11.29; Tue, 17 Apr 2018 02:11:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=t8dTWW2i; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751238AbeDQJL2 (ORCPT + 6 others); Tue, 17 Apr 2018 05:11:28 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:55367 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbeDQJL1 (ORCPT ); Tue, 17 Apr 2018 05:11:27 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3H9BDVt001454; Tue, 17 Apr 2018 04:11:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1523956273; bh=vU/YyIlkDsKliQOcxEfcYFqY5+6TfCnoAFazWd9BPqk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=t8dTWW2irAEAk7SqbUH+vcXbuZdLZL0DvhP8vvE7wGyIv3xRGR30NL7bIcYFoiyUw 8tUC35qFTkyRDeGGVdlB/eLJV3PiL31WsvJ1T0c+3boYouIAzUcTUNqQjLr+CL9h9+ r/QH/BaZJqrz1n1LvVYxryCBqmF2WtYy5728kSNI= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3H9BDpC021921; Tue, 17 Apr 2018 04:11:13 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 17 Apr 2018 04:11:12 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Tue, 17 Apr 2018 04:11:12 -0500 Received: from gomoku.home (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3H9AdnE031430; Tue, 17 Apr 2018 04:11:10 -0500 From: Tero Kristo To: , , , CC: , , , Subject: [RFC 09/13] kbuild: add support for generating FIT images Date: Tue, 17 Apr 2018 12:10:11 +0300 Message-ID: <1523956215-28154-10-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523956215-28154-1-git-send-email-t-kristo@ti.com> References: <1523956215-28154-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org FIT images are built with the mkimage tool, from source description similar to that of DT files. There are a few FIT image generation specifics that must be noted with this patch. The dependency generation for the FIT files requires some makefile magic, due to the build ordering; the dependency binaries must have been built before the FIT image itself, which is different from typical kernel build flow (source files are be built immediately and dependencies can be generated during build.) To use the generated dependency files, the user must manually include the local .itb-deps.d file in their makefile. The PATH environment variable while calling the mkimage tool is tweaked to contain the local / user provided DTC as first item, so that the correct version of mkimage tool will be used. Otherwise, the build will use the system default DTC, or won't find the tool at all. Signed-off-by: Tero Kristo --- scripts/Makefile.lib | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) -- 1.9.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 95f7a17..18517ea 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -295,6 +295,38 @@ $(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) +# FIT +# --------------------------------------------------------------------------- +define gen_itb_deps + @if [ -d $(obj) ] ; then \ + echo >> $(obj)/.itb-deps.d ; \ + echo "$(src)/$(patsubst %.its,%.itb,$(notdir $(1))): $(srctree)/$(src)/$(notdir $(1)) \\" >> $(obj)/.itb-deps.d ; \ + cat $(1) | grep incbin | cut -d "\"" -f 2 | awk '{ printf " $(src)/%s \\\n", $$1 }' | sed '$$s/ \\$$//' >> $(obj)/.itb-deps.d ; \ + fi + +endef + +$(obj)/.itb-deps.d: + @if [ -d $(obj) ] ; then \ + echo "$(src)/.itb-deps.d: $(src)/Makefile $(wildcard $(srctree)/$(src)/*.its)" > $(obj)/.itb-deps.d ; \ + echo >> $(obj)/.itb-deps.d ; \ + fi + $(foreach f,$(wildcard $(srctree)/$(src)/*.its),$(call gen_itb_deps,$f)) + +DTC_FLAGS_MKIMAGE = -I dts -O dtb -p 500 -Wno-unit_address_vs_reg \ + -i $(src) +ifneq ($(DTC),) + DTC_PATH=$(dir $(DTC)) +else + DTC_PATH=$(objtree)/scripts/dtc +endif + +quiet_cmd_mkdir = MKIMAGE -f $@ +cmd_mkfit = PATH="$(DTC_PATH):$(PATH)" $(MKIMAGE) -D "$(DTC_FLAGS_MKIMAGE)" -f $< $@ + +$(obj)/%.itb: $(src)/%.its FORCE + $(call cmd,mkfit) + # Bzip2 # ---------------------------------------------------------------------------