From patchwork Tue Feb 4 12:41:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 3575861 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CAEE4C02DC for ; Tue, 4 Feb 2014 12:42:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADE3E2018B for ; Tue, 4 Feb 2014 12:42:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E8B62018E for ; Tue, 4 Feb 2014 12:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750937AbaBDMl7 (ORCPT ); Tue, 4 Feb 2014 07:41:59 -0500 Received: from mail-we0-f179.google.com ([74.125.82.179]:46474 "EHLO mail-we0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753305AbaBDMl6 (ORCPT ); Tue, 4 Feb 2014 07:41:58 -0500 Received: by mail-we0-f179.google.com with SMTP id q58so3996027wes.38 for ; Tue, 04 Feb 2014 04:41:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4MHnBJh92S0WRf62ilpX65c0ch7tWhXlkIf0NEbkrp0=; b=f4PjbSzpZPad+S6zTuex6fLUIE7wKs/HnQJTuOocKjwgNlQftE0zPjX1v+I5gF5atb fVkRlfHaZaA9OW6vHp0Wm2wxG02po6HvVkKLvRpkiZufIBr2bsSKk5qOh6GPzjWvnq+E U63c+FobfTE305Olh8s2OeS5dXE/7NlqkEnO95L8hlp5ncV9wvBfQeebCXJUK+IEMa4j F3yUU8gp/0l9yJLVQH98ToUem2T9Yv8iCHy2idQPpqxfJ4M1nhAG6AKFvAF2/aSCIpaZ 67lngicK7N7d9t9ldffJkcMU0elydWa5kIIWzLpk86FDBi8ekWvdyUnF0H+oMohjcnID JiVA== X-Gm-Message-State: ALoCoQmM1AmfX9TzwrVl2HTwAp42v/NTuahBMpxtD9zEp/eOFM+iFeN0wv3PnfefTc/gdUfAbgT5 X-Received: by 10.180.94.67 with SMTP id da3mr12683178wib.38.1391517716816; Tue, 04 Feb 2014 04:41:56 -0800 (PST) Received: from trevor.secretlab.ca (host81-147-189-92.range81-147.btcentralplus.com. [81.147.189.92]) by mx.google.com with ESMTPSA id ff7sm1521008wic.10.2014.02.04.04.41.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 04:41:55 -0800 (PST) Received: by trevor.secretlab.ca (Postfix, from userid 1000) id 8057CC407C9; Tue, 4 Feb 2014 12:41:50 +0000 (GMT) From: Grant Likely To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Jason Cooper , Grant Likely , Michal Marek , Russell King , Rob Herring Subject: [PATCH] kbuild: dtbs_install: new make target Date: Tue, 4 Feb 2014 12:41:40 +0000 Message-Id: <1391517700-13103-1-git-send-email-grant.likely@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <20140110182923.GM19878@titan.lakedaemon.net> References: <20140110182923.GM19878@titan.lakedaemon.net> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Cooper Unlike other build products in the Linux kernel, there is no 'make *install' mechanism to put devicetree blobs in a standard place. This commit adds a new 'dtbs_install' make target which copies all of the dtbs into the INSTALL_DTBS_PATH directory. INSTALL_DTBS_PATH can be set before calling make to change the default install directory. If not set then it defaults to: $INSTALL_PATH/dtbs/$KERNELRELEASE. This is done to keep dtbs from different kernel versions separate until things have settled down. Once the dtbs are stable, and not so strongly linked to the kernel version, the devicetree files will most likely move to their own repo. Users will need to upgrade install scripts at that time. v7: (reworked by Grant Likely) - Moved rules from arch/arm/Makefile to arch/arm/boot/dts/Makefile so that each dtb install could have a separate target and be reported as part of the make output. - Fixed dependency problem to ensure $KERNELRELEASE is calculated before attempting to install - Removed option to call external script. Copying the files should be sufficient and a build system can post-process the install directory. Despite the fact an external script is used for installing the kernel, I don't think that is a pattern that should be encouraged. I would rather see buildroot type tools post process the install directory to rename or move dtb files after installing to a staging directory. - Plus it is easy to add a hook after the fact without blocking the rest of this feature. - Move the helper targets into scripts/Makefile.lib with the rest of the common dtb rules Signed-off-by: Jason Cooper Signed-off-by: Grant Likely Cc: Michal Marek Cc: Russell King Cc: Rob Herring --- Makefile | 7 +++++++ arch/arm/Makefile | 7 ++++--- arch/arm/boot/dts/Makefile | 4 +++- scripts/Makefile.lib | 12 ++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 606ef7c4a544..90556da6959d 100644 --- a/Makefile +++ b/Makefile @@ -727,6 +727,13 @@ export KBUILD_IMAGE ?= vmlinux export INSTALL_PATH ?= /boot # +# INSTALL_DTBS_PATH specifies a prefix for relocations required by build roots. +# Like INSTALL_MOD_PATH, it isn't defined in the Makefile, but can be passed as +# an argument if needed. Otherwise it defaults to the kernel install path +# +export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE) + +# # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory # relocations required by build roots. This is not defined in the # makefile but the argument can be passed to make if needed. diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 08a9ef58d9c3..fddf4beaee45 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -310,9 +310,9 @@ $(INSTALL_TARGETS): %.dtb: | scripts $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ -PHONY += dtbs -dtbs: scripts - $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs +PHONY += dtbs dtbs_install +dtbs dtbs_install: prepare scripts + $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $@ # We use MRPROPER_FILES and CLEAN_FILES now archclean: @@ -331,6 +331,7 @@ define archhelp echo ' bootpImage - Combined zImage and initial RAM disk' echo ' (supply initrd image via make variable INITRD=)' echo '* dtbs - Build device tree blobs for enabled boards' + echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)' echo ' install - Install uncompressed kernel' echo ' zinstall - Install compressed kernel' echo ' uinstall - Install U-Boot wrapped compressed kernel' diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index b9d6a8b485e0..649c8e345ac5 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -321,7 +321,7 @@ dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb \ zynq-zc706.dtb \ zynq-zed.dtb -targets += dtbs +targets += dtbs dtbs_install targets += $(dtb-y) endif @@ -331,3 +331,5 @@ dtbs: $(addprefix $(obj)/, $(dtb-y)) $(Q)rm -f $(obj)/../*.dtb clean-files := *.dtb + +dtbs_install: $(addsuffix _dtbinst_, $(dtb-y)) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 49392ecbef17..d0c17a55a2f5 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -273,6 +273,18 @@ $(obj)/%.dtb: $(src)/%.dts FORCE dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) +# Helper targets for Installing DTBs into the boot directory +quiet_cmd_dtb_install = INSTALL $< + cmd_dtb_install = cp $< $(2) + +_dtbinst_pre_: + $(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi + $(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi + $(Q)mkdir -p $(INSTALL_DTBS_PATH) + +%.dtb_dtbinst_: $(obj)/%.dtb _dtbinst_pre_ + $(call cmd,dtb_install,$(INSTALL_DTBS_PATH)) + # Bzip2 # ---------------------------------------------------------------------------