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
24 define Device
/dockstar
25 DEVICE_DTS
:= kirkwood-dockstar
29 FILESYSTEMS
:= squashfs
30 PROFILES
:= Generic DOCKSTAR
31 IMAGES
:= factory.bin sysupgrade.
tar
32 IMAGE
/factory.bin
:= append-ubi
33 IMAGE
/sysupgrade.
tar := sysupgrade-nand
35 KERNEL
:= kernel-bin | append-dtb
38 define Device
/goflexnet
40 PROFILES
:= Generic GOFLEXNET
41 DEVICE_DTS
:= kirkwood-goflexnet
44 define Device
/goflexhome
46 PROFILES
:= Generic GOFLEXHOME
47 DEVICE_DTS
:= kirkwood-goflexhome
50 define Device
/linksys-audi
51 DEVICE_DTS
:= kirkwood-linksys-audi
56 FILESYSTEMS
:= squashfs
57 PROFILES
:= Generic AUDI
58 IMAGES
:= factory.bin sysupgrade.
tar
59 IMAGE
/factory.bin
:= append-kernel
$$$$(KERNEL_SIZE
) | append-ubi
60 IMAGE
/sysupgrade.
tar := sysupgrade-nand
63 define Device
/linksys-viper
64 DEVICE_DTS
:= kirkwood-linksys-viper
69 FILESYSTEMS
:= squashfs
70 PROFILES
:= Generic VIPER
71 IMAGES
:= factory.bin sysupgrade.
tar
72 IMAGE
/factory.bin
:= append-kernel
$$$$(KERNEL_SIZE
) | append-ubi
73 IMAGE
/sysupgrade.
tar := sysupgrade-nand
76 define Build
/append-dtb
77 cat
$(DTS_DIR
)/$(DEVICE_DTS
).dtb
>> $@
80 define Image
/BuildKernel
/Template
82 $(CP
) $(KDIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage
83 echo
-ne
'\x00\x00\x00\x00' >> $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
84 $(call Image
/BuildKernel
/MkuImage
, \
85 none
, 0x8000, 0x8000, \
86 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
, \
87 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage \
90 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
91 $(CP
) $(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
92 echo
-ne
'\x00\x00\x00\x00' >> $(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
93 $(call Image
/BuildKernel
/MkuImage
, \
94 none
, 0x8000, 0x8000, \
95 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
, \
96 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage-initramfs \
101 $(CP
) $(DTS_DIR
)/kirkwood-
$(1).dtb
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
103 $(CP
) $(KDIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage
104 cat
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
>> $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage
105 $(call Image
/BuildKernel
/MkuImage
, \
106 none
, 0x8000, 0x8000, \
107 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage
, \
108 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-uImage \
111 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
112 $(CP
) $(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage-initramfs
113 cat
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
>> $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage-initramfs
114 $(call Image
/BuildKernel
/MkuImage
, \
115 none
, 0x8000, 0x8000, \
116 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-zImage-initramfs
, \
117 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-uImage-initramfs \
123 define Image
/InstallKernel
/Template
125 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL
),)
126 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
127 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE
),)
128 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-uImage
$(TARGET_DIR
)/boot
/
129 ln
-sf
$(IMG_PREFIX
)-uImage
$(TARGET_DIR
)/boot
/uImage
131 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE
),)
132 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
$(TARGET_DIR
)/boot
/
133 ln
-sf
$(IMG_PREFIX
)-zImage
$(TARGET_DIR
)/boot
/zImage
137 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB
),)
138 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
140 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
$(TARGET_DIR
)/boot
/
141 ln
-sf
$(IMG_PREFIX
)-$(1).dtb
$(TARGET_DIR
)/boot
/$(1).dtb
146 define Image
/Build
/jffs2-nand-2048-128k
147 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-$(1).img \
151 define Image
/Build
/squashfs
152 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
154 dd if
=$(KDIR
)/zImage bs
=4096k conv
=sync
; \
155 dd if
=$(KDIR
)/root.
$(1) bs
=128k conv
=sync
; \
156 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-$(1).img
159 define Image
/Build
/ubifs
161 ifneq ($($(PROFILE
)_UBIFS_OPTS
),)
162 $(CP
) $(KDIR
)/root.ubifs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-rootfs.ubifs
166 define Image
/Build
/ubi
168 ifneq ($($(PROFILE
)_UBI_OPTS
),)
169 $(CP
) $(KDIR
)/root.ubi
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-rootfs.ubi
173 DOCKSTAR_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
174 DOCKSTAR_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
176 GOFLEXHOME_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
177 GOFLEXHOME_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
179 GOFLEXNET_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
180 GOFLEXNET_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
182 Image
/BuildKernel
/Template
/Generic
=$(call Image
/BuildKernel
/Template
)
183 Image
/InstallKernel
/Template
/Generic
=$(call Image
/InstallKernel
/Template
)
185 IB62X0_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
186 IB62X0_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
188 Image
/BuildKernel
/Template
/IB62X0
=$(call Image
/BuildKernel
/Template
,ib62x0
)
189 Image
/InstallKernel
/Template
/IB62X0
=$(call Image
/InstallKernel
/Template
,ib62x0
)
191 ICONNECT_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
192 ICONNECT_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
194 Image
/BuildKernel
/Template
/ICONNECT
=$(call Image
/BuildKernel
/Template
,iconnect
)
195 Image
/InstallKernel
/Template
/ICONNECT
=$(call Image
/InstallKernel
/Template
,iconnect
)
197 IOMEGA_IX2_200_UBIFS_OPTS
:="-m 512 -e 15872 -c 2048"
198 IOMEGA_IX2_200_UBI_OPTS
:="-m 512 -p 16384 -s 256"
200 Image
/BuildKernel
/Template
/IOMEGA_IX2_200
=$(call Image
/BuildKernel
/Template
,iomega_ix2_200
)
201 Image
/InstallKernel
/Template
/IOMEGA_IX2_200
=$(call Image
/InstallKernel
/Template
,iomega_ix2_200
)
203 NSA310S_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
204 NSA310S_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
206 Image
/BuildKernel
/Template
/NSA310S
=$(call Image
/BuildKernel
/Template
,nsa310s
)
207 Image
/InstallKernel
/Template
/NSA310S
=$(call Image
/InstallKernel
/Template
,nsa310s
)
209 POGOE02_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
210 POGOE02_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
212 Image
/BuildKernel
/Template
/POGOE02
=$(call Image
/BuildKernel
/Template
,pogo_e02
)
213 Image
/InstallKernel
/Template
/POGOE02
=$(call Image
/InstallKernel
/Template
,pogo_e02
)
215 SHEEVAPLUG_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
216 SHEEVAPLUG_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
218 Image
/BuildKernel
/Template
/SHEEVAPLUG
=$(call Image
/BuildKernel
/Template
,sheevaplug
)
219 Image
/InstallKernel
/Template
/SHEEVAPLUG
=$(call Image
/InstallKernel
/Template
,sheevaplug
)
221 SHEEVAPLUGSATA_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
222 SHEEVAPLUGSATA_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
224 Image
/BuildKernel
/Template
/SHEEVAPLUGSATA
=$(call Image
/BuildKernel
/Template
,sheevaplug-esata
)
225 Image
/InstallKernel
/Template
/SHEEVAPLUGSATA
=$(call Image
/InstallKernel
/Template
,sheevaplug-esata
)
227 GuruplugServerPlus_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
228 GuruplugServerPlus_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
230 Image
/BuildKernel
/Template
/GuruplugServerPlus
=$(call Image
/BuildKernel
/Template
,guruplug-server-plus
)
231 Image
/InstallKernel
/Template
/GuruplugServerPlus
=$(call Image
/InstallKernel
/Template
,guruplug-server-plus
)
233 Topkick1281P2_UBIFS_OPTS
:="-m 2048 -e 126KiB -c 4096"
234 Topkick1281P2_UBI_OPTS
:="-m 2048 -p 128KiB -s 512"
236 Image
/BuildKernel
/Template
/Topkick1281P2
=$(call Image
/BuildKernel
/Template
,topkick
)
237 Image
/InstallKernel
/Template
/Topkick1281P2
=$(call Image
/InstallKernel
/Template
,topkick
)
239 define Image
/BuildKernel
240 $(call Image
/BuildKernel
/Template
/$(PROFILE
))
243 define Image
/InstallKernel
244 $(call Image
/InstallKernel
/Template
/$(PROFILE
))
248 $(if
$(Image
/Build
/$(1)), \
249 $(call Image
/Build
/$(1),$(1)), \
250 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE_SANITIZED
)-$(1).img \
254 $(eval
$(call BuildImage
))