2 # Copyright (C) 2012-2014 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
12 JFFS2_BLOCKSIZE = 128k
17 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
19 define Image/Build/DTB
20 cp $(KDIR)/zImage$(2) $(KDIR)/zImage$(2)-$(1);
21 cat $(DTS_DIR)/$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
22 $(call Image/BuildKernel/MkuImage, \
23 none, $(LOADADDR), $(LOADADDR), \
24 $(KDIR)/zImage$(2)-$(1), $(KDIR)/uImage$(2)-$(1))
25 cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1);
30 # $(3): Erase Block Size
32 # $(5): Sub-Page Size (optional)
34 define Image/BuildKernel/Profile/$(1)
35 $(call Image/Build/DTB,$(2))
36 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
37 $(call Image/Build/Profile,$(1)/Initramfs)
41 define Image/Build/Profile/$(1)/BuildSysupgrade
42 $(call Image/Build/SysupgradeNAND,$(2),$$(1),$(KDIR)/uImage-$(2))
45 define Image/Build/Profile/$(1)/Initramfs
46 $(call Image/Build/DTB,$(2),-initramfs)
49 define Image/Build/Profile/$(1)/squashfs
50 $(call Image/Build/UbinizeImage,$(2),,squashfs, -p $(3) -m $(4) $(if $(5),-s $(5)))
51 cp $(KDIR)/$$(IMG_PREFIX)-$(2)-squashfs-ubinized.bin $(BIN_DIR)
58 # $(2): Sub Profiles list
60 define Image/BuildKernel/Profile/$(1)
61 $(foreach profile, $(2),
62 $(call Image/BuildKernel/Profile/$(profile)))
65 define Image/Build/Profile/$(1)/BuildSysupgrade
66 $(foreach profile, $(2),
67 $(call Image/Build/Profile/$(profile)/BuildSysupgrade,$$(1)))
70 define Image/Build/Profile/$(1)/Initramfs
71 $(foreach profile, $(2),
72 $(call Image/Build/Profile/$(profile)/Initramfs))
75 define Image/Build/Profile/$(1)/squashfs
76 $(foreach profile, $(2),
77 $(call Image/Build/Profile/$(profile)/squashfs))
81 # Boards with NAND, with subpages
82 $(eval $(call NANDProfile,370-DB,armada-370-db,128KiB,2048,512))
83 $(eval $(call NANDProfile,370-RD,armada-370-rd,128KiB,2048,512))
84 $(eval $(call NANDProfile,Mamba,armada-xp-mamba,128KiB,2048,512))
85 $(eval $(call NANDProfile,Mirabox,armada-370-mirabox,128KiB,2048,512))
86 $(eval $(call NANDProfile,OpenBlocks-AX-3-4,armada-xp-openblocks-ax3-4,128KiB,2048,512))
87 $(eval $(call NANDProfile,XP-DB,armada-xp-db,128KiB,2048,512))
88 $(eval $(call NANDProfile,XP-GP,armada-xp-gp,128KiB,2048,512))
90 define Image/Build/Profile/Mamba/squashfs
91 $(call Image/Build/UbinizeImage,armada-xp-mamba,,squashfs, -p 128KiB -m 2048 -s 512)
93 dd if=$(KDIR)/uImage-armada-xp-mamba bs=3072k conv=sync; \
94 dd if=$(KDIR)/$(IMG_PREFIX)-armada-xp-mamba-squashfs-ubinized.bin \
96 ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-xp-mamba-squashfs-factory.img
99 $(eval $(call MultiProfile,Generic,$(PROFILES_LIST)))
100 $(eval $(call MultiProfile,Evalboards,$(PROFILES_LIST)))
102 define Image/BuildKernel
103 $(call Image/BuildKernel/Profile/$(PROFILE))
106 define Image/Build/squashfs
107 # Align the squashfs image size before calling the profiles,
108 # otherwise the size would keep growing
109 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
110 $(call Image/Build/Profile/$(PROFILE)/squashfs)
114 $(call Image/Build/$(1))
115 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
116 $(call Image/Build/Profile/$(PROFILE)/BuildSysupgrade,$(1))
117 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
118 $(call Image/Build/Profile/$(PROFILE)/Initramfs)
122 $(eval $(call BuildImage))