2 # Copyright (C) 2012-2015 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 # The next line will be dropped, migrate your board to use a single firmware file
26 cp
$(KDIR
)/uImage
$(2)-$(1) $(UIMAGE
)$(2)-$(1);
31 # $(3): Erase Block Size
33 # $(5): Sub-Page Size (optional)
34 # $(6): VID offset (optional)
36 define Image
/BuildKernel
/Profile
/$(1)
37 $(call Image
/Build
/DTB
,$(2))
38 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
39 $(call Image
/Build
/Profile
,$(1)/Initramfs
)
43 define Image
/Build
/Profile
/$(1)/BuildSysupgrade
44 $(call Image
/Build
/SysupgradeNAND
,$(2),$$(1),$(KDIR
)/uImage-
$(2))
47 define Image
/Build
/Profile
/$(1)/Initramfs
48 $(call Image
/Build
/DTB
,$(2),-initramfs
)
51 define Image
/Build
/Profile
/$(1)/squashfs
52 $(call Image
/Build
/UbinizeImage
,$(2),,squashfs
, -p
$(3) -m
$(4) $(if
$(5),-s
$(5)) $(if
$(6),-O
$(6)))
53 # The next line will be dropped, migrate your board to use a single firmware file
54 cp
$(KDIR
)/$$(IMG_PREFIX
)-$(2)-squashfs-ubinized.bin
$(BIN_DIR
)
62 # $(3): Erase Block Size
64 define Image
/BuildKernel
/Profile
/$(1)
65 $(call Image
/Build
/DTB
,$(2))
66 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
67 $(call Image
/Build
/Profile
,$(1)/Initramfs
)
71 define Image
/Build
/Profile
/$(1)/Initramfs
72 $(call Image
/Build
/DTB
,$(2),-initramfs
)
75 define Image
/Build
/Profile
/$(1)/squashfs
76 $(call Image
/Build
/UbinizeImage
,$(2),,squashfs
, -p
$(3) -m
1)
84 # $(3): Erase Block Size
86 define Image
/BuildKernel
/Profile
/$(1)
87 $(call Image
/Build
/DTB
,$(2))
88 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
89 $(call Image
/Build
/Profile
,$(1)/Initramfs
)
93 define Image
/Build
/Profile
/$(1)/Initramfs
94 $(call Image
/Build
/DTB
,$(2),-initramfs
)
97 define Image
/Build
/Profile
/$(1)/squashfs
99 dd if
=$(KDIR
)/uImage-
$(2) bs
=$(3) conv
=sync
; \
100 dd if
=$(KDIR
)/root.squashfs bs
=$(3) conv
=sync
; \
101 ) > $$(BIN_DIR
)/$$(IMG_PREFIX
)-$(2)-squashfs-firmware.bin
104 PROFILES_LIST
+= $(1)
108 # $(2): Sub Profiles list
110 define Image
/BuildKernel
/Profile
/$(1)
111 $(foreach profile
, $(2),
112 $(call Image
/BuildKernel
/Profile
/$(profile
)))
115 define Image
/Build
/Profile
/$(1)/BuildSysupgrade
116 $(foreach profile
, $(2),
117 $(call Image
/Build
/Profile
/$(profile
)/BuildSysupgrade
,$$(1)))
120 define Image
/Build
/Profile
/$(1)/Initramfs
121 $(foreach profile
, $(2),
122 $(call Image
/Build
/Profile
/$(profile
)/Initramfs
))
125 define Image
/Build
/Profile
/$(1)/squashfs
126 $(foreach profile
, $(2),
127 $(call Image
/Build
/Profile
/$(profile
)/squashfs
))
131 # Boards with NAND, without subpages
132 $(eval
$(call NANDProfile
,370-DB
,armada-370-db
,512KiB
,4096))
133 $(eval
$(call NANDProfile
,370-RD
,armada-370-rd
,512KiB
,4096))
134 $(eval
$(call NANDProfile
,385-DB-AP
,armada-385-db-ap
,256KiB
,4096))
135 $(eval
$(call NANDProfile
,Mirabox
,armada-370-mirabox
,512KiB
,4096))
136 $(eval
$(call NANDProfile
,XP-DB
,armada-xp-db
,512KiB
,4096))
137 $(eval
$(call NANDProfile
,XP-GP
,armada-xp-gp
,512KiB
,4096))
139 # Boards with NAND, with subpages
140 $(eval
$(call NANDProfile
,Mamba
,armada-xp-mamba
,128KiB
,2048,512,2048))
142 # Boards with large NOR, where we want to use UBI
143 $(eval
$(call UBINORProfile
,OpenBlocks-AX-3-4
,armada-xp-openblocks-ax3-4
,128KiB
))
145 # Boards with small NOR, where UBI doesn't make sense
146 $(eval
$(call NORProfile
,385-RD
,armada-385-rd
,256KiB
))
148 define Image
/Build
/Profile
/Mamba
/squashfs
149 $(call Image
/Build
/UbinizeImage
,armada-xp-mamba
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
151 dd if
=$(KDIR
)/uImage-armada-xp-mamba bs
=3072k conv
=sync
; \
152 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-xp-mamba-squashfs-ubinized.bin \
154 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-xp-mamba-squashfs-factory.img
157 # The Default profile should build everything
158 $(eval
$(call MultiProfile
,Default
,$(PROFILES_LIST
)))
160 define Image
/BuildKernel
161 $(call Image
/BuildKernel
/Profile
/$(PROFILE
))
164 define Image
/Build
/squashfs
165 # Align the squashfs image size before calling the profiles,
166 # otherwise the size would keep growing
167 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
168 $(call Image
/Build
/Profile
/$(PROFILE
)/squashfs
)
172 $(call Image
/Build
/$(1))
173 # The next line will be dropped, migrate your board to use a single firmware file
174 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) bs
=128k conv
=sync
175 $(call Image
/Build
/Profile
/$(PROFILE
)/BuildSysupgrade
,$(1))
176 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
177 $(call Image
/Build
/Profile
/$(PROFILE
)/Initramfs
)
181 $(eval
$(call BuildImage
))