aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2014-08-11 11:36:55 +0000
committerJonas Gorski <jogo@openwrt.org>2014-08-11 11:36:55 +0000
commitac01f9dc1d6b0e89ab8c33e9a95c0501b179792c (patch)
tree7a863ace776e7d29fc0b970ceee00627b879c5c2 /target/linux/brcm63xx
parentc22347ed9ae10f8c757040e09336d0b190da1bcf (diff)
downloadupstream-ac01f9dc1d6b0e89ab8c33e9a95c0501b179792c.tar.gz
upstream-ac01f9dc1d6b0e89ab8c33e9a95c0501b179792c.tar.bz2
upstream-ac01f9dc1d6b0e89ab8c33e9a95c0501b179792c.zip
brcm63xx: add support for attaching dtbs to lzma kernels
In preparation for switching to dtb based board identification, add support for building lzma-loader and lzma cfe kernels with dtb appended. Signed-off-by: Jonas Gorski <jogo@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42121 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm63xx')
-rwxr-xr-xtarget/linux/brcm63xx/image/Makefile31
1 files changed, 26 insertions, 5 deletions
diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile
index 807eebf3e3..705515c88b 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -31,6 +31,8 @@ define Image/LimitName16
$(shell expr substr "$(1)" 1 16)
endef
+TARGET_DTBS:=
+
define Image/Build/CFE
# Generate the tagged image
$(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
@@ -161,21 +163,40 @@ define Image/PrepareLoader
rm -f $(KDIR)/vmlinux$(1).lzma
endef
-define Image/Prepare
+define Image/PrepareLoaderDTB
+ # append dtb to vmlinux, then build a standard LZMA loader
+ cat $(KDIR)/vmlinux$(1) $(DTS_DIR)/$(2).dtb > $(KDIR)/vmlinux$(1)-$(2)
+ $(call Image/PrepareLoader,$(1)-$(2))
+endef
+define Image/PrepareCFELzmaKernel
# CFE is a LZMA nazi! It took me hours to find out the parameters!
# Also I think lzma has a bug cause it generates different output depending on
# if you use stdin / stdout or not. Use files instead of stdio here, cause
# otherwise CFE will complain and not boot the image.
- $(STAGING_DIR_HOST)/bin/lzma e -d22 -fb64 -a1 $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma.tmp
+ $(STAGING_DIR_HOST)/bin/lzma e -d22 -fb64 -a1 $(KDIR)/vmlinux$(1) $(KDIR)/vmlinux$(1).lzma.tmp
# Strip out the length, CFE doesn't like this
- dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe bs=5 count=1
- dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe ibs=13 obs=5 skip=1 seek=1 conv=notrunc
- rm -f $(KDIR)/vmlinux.lzma.tmp
+ dd if=$(KDIR)/vmlinux$(1).lzma.tmp of=$(KDIR)/vmlinux$(1).lzma.cfe bs=5 count=1
+ dd if=$(KDIR)/vmlinux$(1).lzma.tmp of=$(KDIR)/vmlinux$(1).lzma.cfe ibs=13 obs=5 skip=1 seek=1 conv=notrunc
+ rm -f $(KDIR)/vmlinux$(1).lzma.tmp
+endef
+
+define Image/PrepareCFELzmaKernelDTB
+ # compile the dts (the dtb will be later reused for the lzma loader)
+ $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(DTS_DIR)/$(1).dtb ../dts/$(1).dts
+ cat $(KDIR)/vmlinux $(DTS_DIR)/$(1).dtb > $(KDIR)/vmlinux-$(1)
+ $(call Image/PrepareCFELzmaKernel,-$(1))
+endef
+
+define Image/Prepare
+ $(call Image/PrepareCFELzmaKernel,)
+
+ $(foreach board,$(sort $(TARGET_DTBS)), $(call Image/PrepareCFELzmaKernelDTB,$(board)))
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
$(call Image/PrepareLoader,-initramfs)
+ $(foreach board,$(sort $(TARGET_DTBS)), $(call Image/PrepareLoaderDTB,-initramfs,$(board)))
endif
rm -f $(KDIR)/fs_mark
touch $(KDIR)/fs_mark