2 # Copyright (C) 2009-2013 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 NAND_BLOCKSIZE
:= 2048-128k
10 include $(TOPDIR
)/rules.mk
11 include $(INCLUDE_DIR
)/image.mk
13 DEVICE_VARS
+= DEVICE_DTS KERNEL_SIZE PAGESIZE BLOCKSIZE SUBPAGESIZE KERNEL_IN_UBI
14 KERNEL_LOADADDR
:=0x8000
15 TARGET_DEVICES
= linksys-audi linksys-viper dockstar goflexnet goflexhome
18 KERNEL_DEPENDS
= $$(wildcard $(DTS_DIR
)/$$(DEVICE_DTS
).dts
)
19 KERNEL
:= kernel-bin | append-dtb | uImage none
21 KERNEL_SUFFIX
:= -uImage
26 define Device
/dockstar
27 DEVICE_DTS
:= kirkwood-dockstar
31 FILESYSTEMS
:= squashfs
32 PROFILES
:= Generic DOCKSTAR
33 IMAGES
:= factory.bin sysupgrade.
tar
34 IMAGE
/factory.bin
:= append-ubi
35 IMAGE
/sysupgrade.
tar := sysupgrade-nand
37 KERNEL
:= kernel-bin | append-dtb
40 define Device
/goflexnet
42 PROFILES
:= Generic GOFLEXNET
43 DEVICE_DTS
:= kirkwood-goflexnet
46 define Device
/goflexhome
48 PROFILES
:= Generic GOFLEXHOME
49 DEVICE_DTS
:= kirkwood-goflexhome
52 define Device
/linksys-audi
53 DEVICE_DTS
:= kirkwood-linksys-audi
58 FILESYSTEMS
:= squashfs
59 PROFILES
:= Generic AUDI
60 IMAGES
:= factory.bin sysupgrade.
tar
61 IMAGE
/factory.bin
:= append-kernel
$$$$(KERNEL_SIZE
) | append-ubi
62 IMAGE
/sysupgrade.
tar := sysupgrade-nand
65 define Device
/linksys-viper
66 DEVICE_DTS
:= kirkwood-linksys-viper
71 FILESYSTEMS
:= squashfs
72 PROFILES
:= Generic VIPER
73 IMAGES
:= factory.bin sysupgrade.
tar
74 IMAGE
/factory.bin
:= append-kernel
$$$$(KERNEL_SIZE
) | append-ubi
75 IMAGE
/sysupgrade.
tar := sysupgrade-nand
78 define Build
/append-dtb
79 cat
$(DTS_DIR
)/$(DEVICE_DTS
).dtb
>> $@
82 define Image
/BuildKernel
/Template
84 $(CP
) $(KDIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage
85 echo
-ne
'\x00\x00\x00\x00' >> $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
86 $(call Image
/BuildKernel
/MkuImage
, \
87 none
, 0x8000, 0x8000, \
88 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
, \
89 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage \
92 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
93 $(CP
) $(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
94 echo
-ne
'\x00\x00\x00\x00' >> $(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
95 $(call Image
/BuildKernel
/MkuImage
, \
96 none
, 0x8000, 0x8000, \
97 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
, \
98 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage-initramfs \
103 $(CP
) $(DTS_DIR
)/kirkwood-
$(1).dtb
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
105 $(CP
) $(KDIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage
106 cat
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
>> $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage
107 $(call Image
/BuildKernel
/MkuImage
, \
108 none
, 0x8000, 0x8000, \
109 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage
, \
110 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-uImage \
113 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
114 $(CP
) $(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage-initramfs
115 cat
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
>> $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage-initramfs
116 $(call Image
/BuildKernel
/MkuImage
, \
117 none
, 0x8000, 0x8000, \
118 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage-initramfs
, \
119 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-uImage-initramfs \
125 define Image
/InstallKernel
/Template
127 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL
),)
128 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
129 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE
),)
130 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-uImage
$(TARGET_DIR
)/boot
/
131 ln
-sf
$(IMG_PREFIX
)-uImage
$(TARGET_DIR
)/boot
/uImage
133 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE
),)
134 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
$(TARGET_DIR
)/boot
/
135 ln
-sf
$(IMG_PREFIX
)-zImage
$(TARGET_DIR
)/boot
/zImage
139 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB
),)
140 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
142 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
$(TARGET_DIR
)/boot
/
143 ln
-sf
$(IMG_PREFIX
)-$(1).dtb
$(TARGET_DIR
)/boot
/$(1).dtb
148 define Image
/Build
/jffs2-nand-2048-128k
149 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-$(1).img \
153 define Image
/Build
/squashfs
154 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
156 dd if
=$(KDIR
)/zImage bs
=4096k conv
=sync
; \
157 dd if
=$(KDIR
)/root.
$(1) bs
=128k conv
=sync
; \
158 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-$(1).img
161 define Image
/Build
/ubifs
163 ifneq ($($(PROFILE
)_UBIFS_OPTS
),)
164 $(CP
) $(KDIR
)/root.ubifs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-rootfs.ubifs
168 define Image
/Build
/ubi
170 ifneq ($($(PROFILE
)_UBI_OPTS
),)
171 $(CP
) $(KDIR
)/root.ubi
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-rootfs.ubi
175 DOCKSTAR_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
176 DOCKSTAR_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
178 GOFLEXHOME_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
179 GOFLEXHOME_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
181 GOFLEXNET_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
182 GOFLEXNET_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
184 Image
/BuildKernel
/Template
/Generic
=$(call Image
/BuildKernel
/Template
)
185 Image
/InstallKernel
/Template
/Generic
=$(call Image
/InstallKernel
/Template
)
187 IB62X0_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
188 IB62X0_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
190 Image
/BuildKernel
/Template
/IB62X0
=$(call Image
/BuildKernel
/Template
,ib62x0
)
191 Image
/InstallKernel
/Template
/IB62X0
=$(call Image
/InstallKernel
/Template
,ib62x0
)
193 ICONNECT_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
194 ICONNECT_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
196 Image
/BuildKernel
/Template
/ICONNECT
=$(call Image
/BuildKernel
/Template
,iconnect
)
197 Image
/InstallKernel
/Template
/ICONNECT
=$(call Image
/InstallKernel
/Template
,iconnect
)
199 IOMEGA_IX2_200_UBIFS_OPTS
:="-m 512 -e 15872 -c 2048"
200 IOMEGA_IX2_200_UBI_OPTS
:="-m 512 -p 16384 -s 256"
202 Image
/BuildKernel
/Template
/IOMEGA_IX2_200
=$(call Image
/BuildKernel
/Template
,iomega_ix2_200
)
203 Image
/InstallKernel
/Template
/IOMEGA_IX2_200
=$(call Image
/InstallKernel
/Template
,iomega_ix2_200
)
205 NSA310S_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
206 NSA310S_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
208 Image
/BuildKernel
/Template
/NSA310S
=$(call Image
/BuildKernel
/Template
,nsa310s
)
209 Image
/InstallKernel
/Template
/NSA310S
=$(call Image
/InstallKernel
/Template
,nsa310s
)
211 POGOE02_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
212 POGOE02_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
214 Image
/BuildKernel
/Template
/POGOE02
=$(call Image
/BuildKernel
/Template
,pogo_e02
)
215 Image
/InstallKernel
/Template
/POGOE02
=$(call Image
/InstallKernel
/Template
,pogo_e02
)
217 SHEEVAPLUG_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
218 SHEEVAPLUG_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
220 Image
/BuildKernel
/Template
/SHEEVAPLUG
=$(call Image
/BuildKernel
/Template
,sheevaplug
)
221 Image
/InstallKernel
/Template
/SHEEVAPLUG
=$(call Image
/InstallKernel
/Template
,sheevaplug
)
223 SHEEVAPLUGSATA_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
224 SHEEVAPLUGSATA_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
226 Image
/BuildKernel
/Template
/SHEEVAPLUGSATA
=$(call Image
/BuildKernel
/Template
,sheevaplug-esata
)
227 Image
/InstallKernel
/Template
/SHEEVAPLUGSATA
=$(call Image
/InstallKernel
/Template
,sheevaplug-esata
)
229 GuruplugServerPlus_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
230 GuruplugServerPlus_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
232 Image
/BuildKernel
/Template
/GuruplugServerPlus
=$(call Image
/BuildKernel
/Template
,guruplug-server-plus
)
233 Image
/InstallKernel
/Template
/GuruplugServerPlus
=$(call Image
/InstallKernel
/Template
,guruplug-server-plus
)
235 Topkick1281P2_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
236 Topkick1281P2_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
238 Image
/BuildKernel
/Template
/Topkick1281P2
=$(call Image
/BuildKernel
/Template
,topkick
)
239 Image
/InstallKernel
/Template
/Topkick1281P2
=$(call Image
/InstallKernel
/Template
,topkick
)
241 define Image
/BuildKernel
242 $(call Image
/BuildKernel
/Template
/$(PROFILE
))
245 define Image
/InstallKernel
246 $(call Image
/InstallKernel
/Template
/$(PROFILE
))
250 $(if
$(Image
/Build
/$(1)), \
251 $(call Image
/Build
/$(1),$(1)), \
252 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-$(1).img \
256 $(eval
$(call BuildImage
))