- 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)))