diff options
| -rw-r--r-- | arch/arm/Kconfig | 15 | ||||
| -rw-r--r-- | arch/arm/Makefile | 7 | ||||
| -rw-r--r-- | arch/arm/boot/.gitignore | 3 | ||||
| -rw-r--r-- | arch/arm/boot/Makefile | 9 | ||||
| -rw-r--r-- | arch/arm/boot/dts/Makefile | 16 | ||||
| -rw-r--r-- | scripts/Makefile.lib | 8 | ||||
| -rwxr-xr-x | scripts/dtcat.py | 37 |
7 files changed, 83 insertions, 12 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 99887aaa04b..9ee350a36c5 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1840,6 +1840,21 @@ config USE_OF help Include support for flattened device tree machine descriptions. +config BUILD_ARM_APPENDED_DTB_IMAGE + bool "Build a concatenated zImage/dtb by default" + depends on OF + help + Enabling this option will cause a concatenated zImage and list of + DTBs to be built by default (instead of a standalone zImage.) + The image will built in arch/arm/boot/zImage-dtb + +config BUILD_ARM_APPENDED_DTB_IMAGE_NAMES + string "Default dtb names" + depends on BUILD_ARM_APPENDED_DTB_IMAGE + help + Space separated list of names of dtbs to append when + building a concatenated zImage-dtb. + config ATAGS bool "Support for the traditional ATAGS boot data passing" if USE_OF default y diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 314c7be492a..7278619f549 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -297,8 +297,11 @@ zinstall uinstall install: vmlinux dtbs: scripts $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs -zImage-dtb: vmlinux scripts dtbs - $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ +dtb_list: dtbs + $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ + +zImage-dtb: vmlinux dtb_list scripts + $(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ # We use MRPROPER_FILES and CLEAN_FILES now archclean: diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore index ad7a0253ea9..765c29a1e6d 100644 --- a/arch/arm/boot/.gitignore +++ b/arch/arm/boot/.gitignore @@ -1,7 +1,8 @@ Image zImage +zImage-dtb xipImage bootpImage uImage *.dtb -zImage-dtb
\ No newline at end of file +zImage-dtb diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 65285bbbf89..b66f57dbf75 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile @@ -26,7 +26,8 @@ INITRD_PHYS := $(initrd_phys-y) export ZRELADDR INITRD_PHYS PARAMS_PHYS -targets := Image zImage xipImage bootpImage uImage +targets := Image zImage xipImage bootpImage uImage zImage-dtb + DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES)) ifneq ($(DTB_NAMES),) @@ -64,9 +65,9 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE $(call if_changed,objcopy) @$(kecho) ' Kernel: $@ is ready' -$(obj)/zImage-dtb: $(obj)/zImage $(DTB_OBJS) FORCE - $(call if_changed,cat) - @echo ' Kernel: $@ is ready' +$(obj)/zImage-dtb: $(obj)/zImage $(obj)/dts/dtb_list FORCE + $(call if_changed,cat64) + @$(kecho) ' Kernel: $@ is ready' endif diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 5cd0d765c75..e2a70d9fb96 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1,5 +1,13 @@ ifeq ($(CONFIG_OF),y) +DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES)) +ifneq ($(DTB_NAMES),) +DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES)) +else +DTB_LIST := $(dtb-y) +endif +DTB_OBJS := $(addprefix $(obj)/,$(DTB_LIST)) + # Keep at91 dtb files sorted alphabetically for each SoC # rm9200 dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb @@ -222,9 +230,15 @@ targets += dtbs targets += $(DTB_LIST) endif +$(obj)/dtb_list: $(DTB_OBJS) FORCE + $(call if_changed,cat64) + +#$(srctree)/scripts/dtcat.py $(obj)/../zImage $(DTB_OBJS) > $@ + # *.dtb used to be generated in the directory above. Clean out the # old build results so people don't accidentally use them. -dtbs: $(addprefix $(obj)/, $(DTB_LIST)) +dtbs: $(DTB_OBJS) $(Q)rm -f $(obj)/../*.dtb clean-files := *.dtb + diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ef2142a6159..734fb10a0b0 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -273,11 +273,11 @@ $(obj)/%.dtb: $(src)/%.dts FORCE dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) -# cat +# cat64 # --------------------------------------------------------------------------- -# Concatentate multiple files together -quiet_cmd_cat = CAT $@ -cmd_cat = (cat $(filter-out FORCE,$^) > $@) || (rm -f $@; false) +# Concatentate multiple files together aligned to 64 bit +quiet_cmd_cat64 = CAT64 $@ +cmd_cat64 = ($(srctree)/scripts/dtcat.py $(filter-out FORCE,$^) > $@) # Bzip2 # --------------------------------------------------------------------------- diff --git a/scripts/dtcat.py b/scripts/dtcat.py new file mode 100755 index 00000000000..add986245e2 --- /dev/null +++ b/scripts/dtcat.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +# +# Copyright (C) 2013 Motorola, LLC. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307, USA +# +# generate a 64 bit aligned concatenation of the files +# given based on: +# padding = (align - (offset mod align)) mod align +import os, sys + + +def padding(v): + align = 8 + return (align - (v % align)) % align + +for f in sys.argv[1:]: + s = os.stat(f).st_size + print >> sys.stderr, f, 'size', s, 'padding', padding(s) + with open(f, 'rb') as fp: + data = fp.read() + sys.stdout.write(data) + for i in range(padding(s)): + sys.stdout.write(B'0') + |