ARM64: add option to build Image.gz/dtb combo
authorAlex Ray <aray@google.com>
Mon, 17 Mar 2014 20:44:01 +0000 (13:44 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:54:07 +0000 (13:54 -0800)
Allows a defconfig to set a list of dtbs to concatenate with an
Image.gz to create a Image.gz-dtb.

Includes 8adb162 arm64: Fix correct dtb clean-files location

Change-Id: I0b462322d5c970f1fdf37baffece7ad058099f4a
Signed-off-by: Alex Ray <aray@google.com>
arch/arm64/Kconfig
arch/arm64/Makefile
arch/arm64/boot/.gitignore
arch/arm64/boot/Makefile
arch/arm64/boot/dts/Makefile

index a3a8ac3043603ecafba0b5d81cf98a55921ab080..77ea4f6b656e742871cdbecf1644383583dba303 100644 (file)
@@ -759,6 +759,21 @@ config DMI
          However, even with this option, the resultant kernel should
          continue to boot on existing non-UEFI platforms.
 
+config BUILD_ARM64_APPENDED_DTB_IMAGE
+       bool "Build a concatenated Image.gz/dtb by default"
+       depends on OF
+       help
+         Enabling this option will cause a concatenated Image.gz and list of
+         DTBs to be built by default (instead of a standalone Image.gz.)
+         The image will built in arch/arm64/boot/Image.gz-dtb
+
+config BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES
+       string "Default dtb names"
+       depends on BUILD_ARM64_APPENDED_DTB_IMAGE
+       help
+         Space separated list of names of dtbs to append when
+         building a concatenated Image.gz-dtb.
+
 endmenu
 
 menu "Userspace binary formats"
index 0527827f3d1471ab0b9390c630eb197cea5d9073..a5c84594f6adb38390b95271e0a48419d0199765 100644 (file)
@@ -74,7 +74,12 @@ libs-y               := arch/arm64/lib/ $(libs-y)
 core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
 
 # Default target when executing plain make
+ifeq ($(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE),y)
+KBUILD_IMAGE   := Image.gz-dtb
+else
 KBUILD_IMAGE   := Image.gz
+endif
+
 KBUILD_DTBS    := dtbs
 
 all:   $(KBUILD_IMAGE) $(KBUILD_DTBS)
@@ -101,6 +106,9 @@ dtbs: prepare scripts
 dtbs_install:
        $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
 
+Image.gz-dtb: vmlinux scripts dtbs
+       $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
+
 PHONY += vdso_install
 vdso_install:
        $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
index 8dab0bb6ae667c5f89da8aca74a0a3bb61dcfaa9..eb3551131b1e7c04930808c2b4834c7fc6f9817e 100644 (file)
@@ -1,2 +1,3 @@
 Image
 Image.gz
+Image.gz-dtb
index abcbba2f01baad4c76f0c414372ba4713beafa11..ddd405f883445d920f5f9bfac58f8db13cc36e59 100644 (file)
 # Based on the ia64 boot/Makefile.
 #
 
+include $(srctree)/arch/arm64/boot/dts/Makefile
+
 targets := Image Image.gz
 
+DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES))
+ifneq ($(DTB_NAMES),)
+DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
+else
+DTB_LIST := $(dtb-y)
+endif
+DTB_OBJS := $(addprefix $(obj)/dts/,$(DTB_LIST))
+
 $(obj)/Image: vmlinux FORCE
        $(call if_changed,objcopy)
 
@@ -34,6 +44,9 @@ $(obj)/Image.lzma: $(obj)/Image FORCE
 $(obj)/Image.lzo: $(obj)/Image FORCE
        $(call if_changed,lzo)
 
+$(obj)/Image.gz-dtb: $(obj)/Image.gz $(DTB_OBJS) FORCE
+       $(call if_changed,cat)
+
 install: $(obj)/Image
        $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
        $(obj)/Image System.map "$(INSTALL_PATH)"
index eb3c42d971750372d3194cf935f9148b9892f53c..062edb21099374db93a886c90082f26db4fee269 100644 (file)
@@ -21,3 +21,17 @@ dtstree              := $(srctree)/$(src)
 dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach d,$(dts-dirs), $(wildcard $(dtstree)/$(d)/*.dts)))
 
 always         := $(dtb-y)
+
+targets += dtbs
+
+DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES))
+ifneq ($(DTB_NAMES),)
+DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
+else
+DTB_LIST := $(dtb-y)
+endif
+targets += $(DTB_LIST)
+
+dtbs: $(addprefix $(obj)/, $(DTB_LIST))
+
+clean-files := dts/*.dtb *.dtb