2 # Copyright (C) 2010 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
11 $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(patsubst jffs2-
%,jffs2
,$(patsubst squashfs-
%,squashfs
,$(1)))
15 $(call imgname
,$(1),$(2))-sysupgrade.bin
19 $(call imgname
,$(1),$(2))-factory.bin
22 zImage
:=$(BIN_DIR
)/$(IMG_PREFIX
)-zImage
24 DTS_TARGETS
= hiveap-330 fsl
/p1010rdb-pa tl-wdr4900-v1 fsl
/p1020rdb
26 define Build
/empty-initramfs
27 -mkdir
$(KDIR_TMP
)/empty-initramfs
; \
28 cd
$(KDIR_TMP
)/empty-initramfs
; \
29 find . | cpio
-o
-H newc | gzip
-9n
> $(KDIR_TMP
)/empty-initramfs.gpio.gz
31 -$(STAGING_DIR_HOST
)/bin
/mkimage
-A
$(LINUX_KARCH
) -O linux
-T ramdisk \
32 -C gzip
-n
"empty initramfs" \
33 -d
$(KDIR_TMP
)/empty-initramfs.gpio.gz \
34 $(KDIR_TMP
)/$(IMG_PREFIX
)-empty-initramfs.image
37 define Image
/BuildKernel
38 cp
$(KDIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage
39 $(foreach dts
,$(DTS_TARGETS
),
40 $(LINUX_DIR
)/scripts
/dtc
/dtc
-I dts
-O dtb
$(DTS_DIR
)/$(dts
).dts
> $(BIN_DIR
)/$(IMG_PREFIX
)-$(notdir $(dts
)).fdt
44 define Image
/BuildKernel
/Initramfs
45 cp
$(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-initramfs-zImage
46 ifeq ($(SUBTARGET
),generic
)
47 cp
$(KDIR
)/cuImage.tl-wdr4900-v1-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-tl-wdr4900-v1-initramfs.uImage
49 ifeq ($(SUBTARGET
),p1020
)
50 cp
$(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-hiveap-330-initramfs.zImage
54 define Image
/Build
/Aerohive
55 $(call Build
/empty-initramfs
)
56 ifeq ($(2),hiveap-330
)
58 dd if
=$(BIN_DIR
)/$(IMG_PREFIX
)-$(2).fdt bs
=256k conv
=sync
; \
59 dd if
=$(KDIR_TMP
)/$(IMG_PREFIX
)-empty-initramfs.image bs
=256k conv
=sync
; \
60 dd if
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) bs
=40704k conv
=sync
; \
61 dd if
=$(KDIR
)/zImage conv
=sync
; \
62 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-sysupgrade.img
66 define Image
/Build
/TPLINK
67 -$(STAGING_DIR_HOST
)/bin
/mktplinkfw \
68 -H
$(4) -W
$(5) -F
$(6) -N OpenWrt
-V
$(REVISION
) $(7) \
70 -r
$(KDIR
)/root.
$(1) \
71 -o
$(call factoryname
,$(1),$(2))
72 -$(STAGING_DIR_HOST
)/bin
/mktplinkfw \
73 -H
$(4) -W
$(5) -F
$(6) -N OpenWrt
-V
$(REVISION
) $(7) -s \
75 -r
$(KDIR
)/root.
$(1) \
76 -o
$(call sysupname
,$(1),$(2))
79 define Image
/Build
/Profile
/hiveap-330
80 $(call Image
/Build
/Aerohive
,$(1),hiveap-330
)
83 define Image
/Build
/Profile
/TLWDR4900
84 $(call Image
/Build
/TPLINK
,$(1),tl-wdr4900-v1
,cuImage.tl-wdr4900-v1
,0x49000001,1,16Mppc
)
87 define Image
/Build
/Profile
/Default
88 $(call Image
/Build
/Profile
/TLWDR4900
,$(1))
91 define Image
/Build
/ext2
92 cp
$(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-ext2.img
95 define Image
/Build
/squashfs
96 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
97 cp
$(KDIR
)/root.squashfs
$(BIN_DIR
)/$(IMG_PREFIX
)-root.squashfs
103 $(call Image
/Build
/$(1),$(1))
104 $(call Image
/Build
/Profile
/$(PROFILE
),$(1))
107 $(eval
$(call BuildImage
))