summaryrefslogtreecommitdiff
path: root/target/linux/kirkwood/image/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/kirkwood/image/Makefile')
-rw-r--r--target/linux/kirkwood/image/Makefile103
1 files changed, 73 insertions, 30 deletions
diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile
index c63f606..1bc17c2 100644
--- a/target/linux/kirkwood/image/Makefile
+++ b/target/linux/kirkwood/image/Makefile
@@ -9,67 +9,110 @@ include $(INCLUDE_DIR)/image.mk
NAND_BLOCKSIZE := 2048:128k
-define Image/BuildKernel
- $(CP) $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
+define Image/BuildKernel/Template
+
+ $(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
+ echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage
+ $(call Image/BuildKernel/MkuImageARM, \
+ 0x00008000, \
+ $(BIN_DIR)/$(IMG_PREFIX)-zImage, \
+ $(BIN_DIR)/$(IMG_PREFIX)-uImage \
+ )
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
- $(CP) $(KDIR)/uImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
-endif
+ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
+ $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
+ echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
+ $(call Image/BuildKernel/MkuImageARM, \
+ 0x00008000, \
+ $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \
+ $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \
+ )
+ endif
- $(foreach board,$(BOARDS),
- $(LINUX_DIR)/scripts/dtc/dtc \
- -O dtb -o $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb \
- -I dts $(LINUX_DIR)/arch/arm/boot/dts/kirkwood-$(board).dts
- )
+ ifneq ($(1),)
+ $(CP) $(LINUX_DIR)/arch/arm/boot/dts/kirkwood-$(1).dtb $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb
+
+ $(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-zImage
+ cat $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb >> $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-zImage
+ $(call Image/BuildKernel/MkuImageARM, \
+ 0x00008000, \
+ $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-zImage, \
+ $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-uImage \
+ )
+
+ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
+ $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-zImage-initramfs
+ cat $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb >> $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-zImage-initramfs
+ $(call Image/BuildKernel/MkuImageARM, \
+ 0x00008000, \
+ $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-zImage-initramfs, \
+ $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-uImage-initramfs \
+ )
+ endif
+ endif
endef
-define Image/InstallKernel
-
+define Image/InstallKernel/Template
+
ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL),)
$(INSTALL_DIR) $(TARGET_DIR)/boot
- $(CP) $(KDIR)/uImage $(TARGET_DIR)/boot/
+ $(CP) $(BIN_DIR)/$(IMG_PREFIX)-zImage $(TARGET_DIR)/boot/
endif
ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),)
$(INSTALL_DIR) $(TARGET_DIR)/boot
- $(foreach board,$(BOARDS),
- $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb $(TARGET_DIR)/boot/
- )
+ ifneq ($(1),)
+ $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb $(TARGET_DIR)/boot/
+ endif
endif
endef
-define Image/Build
- $(if $(Image/Build/$(1)), \
- $(call Image/Build/$(1),$(1)), \
- $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
- )
-endef
-
define Image/Build/jffs2-nand-2048-128k
- dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
+ dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-$(1).img \
bs=2048 conv=sync
endef
define Image/Build/squashfs
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
( \
- dd if=$(KDIR)/uImage bs=4096k conv=sync; \
+ dd if=$(KDIR)/zImage bs=4096k conv=sync; \
dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
+ ) > $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-$(1).img
endef
define Image/Build/ubifs
- ifdef UBIFS_OPTS
- $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
+ ifneq ($($(PROFILE)_UBIFS_OPTS),)
+ $(CP) $(KDIR)/root.ubifs $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-ubifs.img
endif
endef
define Image/Build/ubi
- ifdef UBI_OPTS
- $(call Image/Build/ubifs,$(1))
+ ifneq ($($(PROFILE)_UBI_OPTS),)
+ $(CP) $(KDIR)/root.ubi $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-ubi.img
endif
endef
+Image/BuildKernel/Template/Generic=$(call Image/BuildKernel/Template)
+Image/InstallKernel/Template/Generic=$(call Image/InstallKernel/Template)
+
+Image/BuildKernel/Template/IB62X0=$(call Image/BuildKernel/Template,ib62x0)
+Image/InstallKernel/Template/IB62X0=$(call Image/InstallKernel/Template,ib62x0)
+
+define Image/BuildKernel
+ $(call Image/BuildKernel/Template/$(PROFILE))
+endef
+
+define Image/InstallKernel
+ $(call Image/InstallKernel/Template/$(PROFILE))
+endef
+
+define Image/Build
+ $(if $(Image/Build/$(1)), \
+ $(call Image/Build/$(1),$(1)), \
+ $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-$(1).img \
+ )
+endef
+
$(eval $(call BuildImage))