2 # Copyright (C) 2013 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
10 STG212_UBI_OPTS
= -m
2048 -p
128KiB
-s
512
11 STG212_UBIFS_OPTS
= -m
2048 -e
126KiB
-c
4096
13 KD20_UBI_OPTS
= -m
2048 -p
128KiB
-s
512
14 KD20_UBIFS_OPTS
= -m
2048 -e
126KiB
-c
4096
16 POGOPLUG_PRO_UBI_OPTS
= -m
2048 -p
128KiB
-s
512
17 POGOPLUG_PRO_UBIFS_OPTS
= -m
2048 -e
126KiB
-c
4096
19 POGOPLUG_V3_UBI_OPTS
= -m
2048 -p
128KiB
-s
512
20 POGOPLUG_V3_UBIFS_OPTS
= -m
2048 -e
126KiB
-c
4096
22 VMLINUX
:=$(BIN_DIR
)/$(IMG_PREFIX
)-vmlinux
23 UIMAGE
:=$(BIN_DIR
)/$(IMG_PREFIX
)-uImage
25 define sanitize_profile_name
26 $(shell echo
$(PROFILE
) | tr
'[:upper:]' '[:lower:]' | sed
's/_/-/g')
29 define Image
/BuildKernel
/Template
30 $(CP
) $(DTS_DIR
)/ox820-
$(1).dtb
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
32 $(call Image
/BuildKernel
/MkFIT
,$(1),$(KDIR
)/zImage
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
,none
,0x60008000,0x60008000)
33 $(CP
) $(KDIR
)/fit-
$(1).itb
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-fit-uImage.itb
35 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
36 $(call Image
/BuildKernel
/MkFIT
,$(1),$(KDIR
)/zImage-initramfs
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
,none
,0x60008000,0x60008000,-initramfs
)
37 $(CP
) $(KDIR
)/fit-
$(1)-initramfs.itb
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-fit-uImage-initramfs.itb
38 if
[ -e
"$(KDIR)/u-boot.bin" ]; then \
39 ( dd if
=$(KDIR
)/u-boot.bin bs
=128k conv
=sync
; dd if
=$(KDIR
)/fit-
$(1)-initramfs.itb bs
=128k conv
=sync
) \
40 > $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-u-boot-initramfs.bin
; \
44 $(CP
) $(KDIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage
45 $(call Image
/BuildKernel
/MkuImage
, \
46 none
, 0x60008000, 0x60008000, \
47 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
, \
48 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage \
51 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
52 $(CP
) $(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
53 $(call Image
/BuildKernel
/MkuImage
, \
54 none
, 0x60008000, 0x60008000, \
55 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
, \
56 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage-initramfs \
61 define Image
/InstallKernel
/Template
63 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL
),)
64 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
65 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE
),)
66 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-uImage
$(TARGET_DIR
)/boot
/
67 ln
-sf
$(IMG_PREFIX
)-uImage
$(TARGET_DIR
)/boot
/uImage
69 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE
),)
70 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
$(TARGET_DIR
)/boot
/
71 ln
-sf
$(IMG_PREFIX
)-zImage
$(TARGET_DIR
)/boot
/zImage
73 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_FIT
),)
74 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-fit-uImage.itb
$(TARGET_DIR
)/boot
/
75 ln
-sf
$(IMG_PREFIX
)-$(1)-fit-uImage.itb
$(TARGET_DIR
)/boot
/uImage.itb
79 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB
),)
80 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
82 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
$(TARGET_DIR
)/boot
/
83 ln
-sf
$(IMG_PREFIX
)-$(1).dtb
$(TARGET_DIR
)/boot
/$(1).dtb
88 define Image
/Build
/squashfs
89 $(call Image
/Build
/SysupgradeNAND
,$(call sanitize_profile_name
),$(1),$(KDIR
)/fit-
$(call sanitize_profile_name
).itb
)
90 $(call Image
/Build
/UbinizeImage
,$(call sanitize_profile_name
),--uboot-env
--kernel
$(KDIR
)/fit-
$(call sanitize_profile_name
).itb
,$(1),$($(PROFILE
)_UBI_OPTS
))
91 cp
$(KDIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-squashfs-ubinized.bin
$(BIN_DIR
)
94 define Image
/mkfs
/targz
96 $(TAR
) -czpf
$(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-rootfs.
tar.gz
--numeric-owner
--owner
=0 --group
=0 -C
$(TARGET_DIR
)/ .
99 define Image
/Build
/ubifs
101 ifneq ($($(PROFILE
)_UBIFS_OPTS
),)
102 $(call Image
/Build
/SysupgradeNAND
,$(call sanitize_profile_name
),ubifs
,$(KDIR
)/fit-
$(call sanitize_profile_name
).itb
)
103 $(call Image
/Build
/UbinizeImage
,$(call sanitize_profile_name
),--uboot-env
--kernel
$(KDIR
)/fit-
$(call sanitize_profile_name
).itb
,ubifs
,$($(PROFILE
)_UBI_OPTS
))
104 cp
$(KDIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-ubifs-ubinized.bin
$(BIN_DIR
)
109 Image
/BuildKernel
/Template
/POGOPLUG_PRO
=$(call Image
/BuildKernel
/Template
,pogoplug-pro
)
110 Image
/InstallKernel
/Template
/POGOPLUG_PRO
=$(call Image
/InstallKernel
/Template
,pogoplug-pro
)
112 Image
/BuildKernel
/Template
/POGOPLUG_V3
=$(call Image
/BuildKernel
/Template
,pogoplug-v3
)
113 Image
/InstallKernel
/Template
/POGOPLUG_V3
=$(call Image
/InstallKernel
/Template
,pogoplug-v3
)
115 Image
/BuildKernel
/Template
/STG212
=$(call Image
/BuildKernel
/Template
,stg212
)
116 Image
/InstallKernel
/Template
/STG212
=$(call Image
/InstallKernel
/Template
,stg212
)
118 Image
/BuildKernel
/Template
/KD20
=$(call Image
/BuildKernel
/Template
,kd20
)
119 Image
/InstallKernel
/Template
/KD20
=$(call Image
/InstallKernel
/Template
,kd20
)
121 define Image
/BuildKernel
122 $(call Image
/BuildKernel
/Template
/$(PROFILE
))
125 define Image
/InstallKernel
126 $(call Image
/InstallKernel
/Template
/$(PROFILE
))
130 $(if
$(Image
/Build
/$(1)), \
131 $(call Image
/Build
/$(1),$(1)), \
132 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-$(1).img \
136 $(eval
$(call BuildImage
))