blob: 0e5fed916708e1aa6e88e2b0c95c44f88d057ea5 [file] [log] [blame]
xf.libfc6e712025-02-07 01:54:34 -08001
2include $(ZTE_PS_LINK_SCRIPT)
3-include $(OUTPUT_DIR)/sys_type.mk
4-include $(LINUX_DIR)/.config
5
6.PHONY: help all allclean ps psclean kernel kernelclean app appclean lib libclean libc libcclean check
7
8help: check
9 @echo "=========================Make help start========================="
10 @echo "make [help] this help"
11 @echo "make all[clean] compile all, include recovery and normal system"
12 @echo "make userdata make userdata for normal system"
13 @echo "make normal[clean] compile normal system,include kernel libc lib and app"
14 @echo "make normal2 continue to compile normal system"
15 @echo "make normal_rootfs make rootfs for normal system"
16 @echo "make normal_copybin copy bins to project for normal system"
17 @echo "make recovery[clean] compile recovery system,include kernel libc lib and app"
18 @echo "make recovery2 continue to compile recovery system"
19 @echo "make recovery_rootfs make rootfs for recovery system"
20 @echo "make recovery_copybin copy bins to project for recovery system"
21 @echo "make kernel[clean] compile linux kernel"
22 @echo "make rootfs make rootfs for normal or recovery automatically based on config"
23 @echo "make copybin copy bins to project for normal or recovery automatically based on config"
24 @echo "make lib[clean] compile lib"
25 @echo "make libc[clean] compile libc"
26 @echo "make app[clean] compile app"
27ifeq ($(CONFIG_SINGLECORE),yes)
28 @echo "make ps[clean] compile libps"
29endif
30 @echo "=========================Make help end========================="
31
32check:
33ifeq ($(PRJ_NAME),)
34 $(error ONLY execute the make command in the project/CHIP_NAME/prj_xxx/build directory)
35endif
36 bash $(BUILD_DIR)/env_check.sh
37
38normal_check:
39ifneq ($(AP_BUILD_TYPE),normal)
40 $(error current config is not normal,make normal first)
41endif
42
43recovery_check:
44ifneq ($(AP_BUILD_TYPE),recovery)
45 $(error current config is not recovery,make recovery first)
46endif
47
48copy:
49 @bash $(BUILD_DIR)/modcopy.sh
50
51all:
52ifeq ($(USE_FOTA),yes)
53ifneq ($(USE_FOTA_AB),yes)
54 make recovery
55endif
56endif
57ifeq ($(BUILD_CAP),yes)
58 make cap
59endif
60 make normal
61
62allclean: normalclean
63
64sys: check
65ifeq ($(CONFIG_SINGLECORE),yes)
66ifeq ($(AP_BUILD_TYPE),normal)
67 make ps
68endif
69endif
70 make kernel
71ifeq ($(CONFIG_SINGLECORE),yes)
72ifeq ($(AP_BUILD_TYPE),normal)
73ifeq ($(USE_CPPS_KO),yes)
74 make cpko
75endif
76endif
77endif
78 make libc
79 make lib
80 make app
81 @echo "all modules build done"
82
83sysclean: check
84ifeq ($(CONFIG_SINGLECORE),yes)
85ifeq ($(AP_BUILD_TYPE),normal)
86 make psclean
87endif
88endif
89 make kerneldistclean
90ifeq ($(CONFIG_SINGLECORE),yes)
91ifeq ($(AP_BUILD_TYPE),normal)
92ifeq ($(USE_CPPS_KO),yes)
93 make cpkoclean
94endif
95endif
96endif
97 make libcclean
98 -make libclean
99 -make appclean
100 -@rm -fr $(OUTPUT_DIR) $(STAGEDIR)
101 @echo "all modules clean done"
102
103ps:
104 mkdir -p $(LIBPS_PATH)
105ifeq ($(CONFIG_SINGLECORE),yes)
106 make -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) prepare
107ifneq ($(MK_SDK_VERSION),yes)
108 (cd $(PS_BUILD_DIR) && bash $(LIBPS_BUILD_SHELL) all)
109else
110 (cd $(PS_BUILD_DIR) && bash $(LIBPS_BUILD_SHELL) sdk)
111endif
112else
113 $(error libps in NOT on AP)
114endif
115
116psclean:
117ifeq ($(CONFIG_SINGLECORE),yes)
118ifneq ($(MK_SDK_VERSION),yes)
119 (cd $(PS_BUILD_DIR) && bash $(LIBPS_BUILD_SHELL) allclean)
120 -rm -fr $(LIBPS_PATH)/*
121else
122 (cd $(PS_BUILD_DIR) && bash $(LIBPS_BUILD_SHELL) sdkclean)
123endif
124else
125 $(error libps in NOT on AP)
126endif
127
128kernel:
129 -rm -v $(LINUX_DIR)/arch/arm/boot/*Image
130 -rm -v $(LINUX_DIR)/vmlinux*
131 #make -j1 ARCH=arm KBUILD_VERBOSE=1 CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) all
132 make -j4 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) all
133 make -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) uImage
134ifeq ($(CONFIG_MODULES), y)
135 make -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) modules
136 make -j1 ARCH=arm -C $(LINUX_DIR) INSTALL_MOD_PATH=$(ROOTFS_DIR) modules_install
137endif
138 make -j1 ARCH=arm -C $(LINUX_DIR) INSTALL_HDR_PATH=$(STAGEDIR) headers_install
139 cp -v $(LINUX_DIR)/include/generated/autoconf.h $(LINUX_DIR)/include/linux/
140 -cp -v $(LINUX_DIR)/include/generated/autoconf.h $(LINUX_DIR)/usr/include/linux/
141 mkdir -p $(IMAGE_DIR)
142 cp -v $(LINUX_DIR)/arch/arm/boot/uImage $(IMAGE_DIR)/linux_kernel.img
143 cp -v $(LINUX_DIR)/vmlinux $(IMAGE_DIR)/
144 cp -v $(LINUX_DIR)/System.map $(IMAGE_DIR)/
145 @echo "kernel build done"
146
147kernelclean:
148 make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) clean
149 @echo "kernel clean done"
150
151kernel2:
152 make kernel
153ifeq ($(CONFIG_SINGLECORE),yes)
154ifeq ($(AP_BUILD_TYPE),normal)
155ifeq ($(USE_CPPS_KO),yes)
156 make cpkoclean cpko
157endif
158endif
159endif
160 make rootfs
161 make copybin
162
163kerneldistclean:
164 make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) distclean
165 -rm -f $(LINUX_DIR)/include/linux/autoconf.h
166
167kernel_menuconfig:
168 make ARCH=arm -C $(LINUX_DIR) menuconfig
169
170kernellink:
171 -rm -v $(LINUX_DIR)/arch/arm/boot/*Image
172 -rm -v $(LINUX_DIR)/vmlinux*
173 make -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) uImage
174 cp -v $(LINUX_DIR)/arch/arm/boot/uImage $(IMAGE_DIR)/linux_kernel.img
175ifeq ($(CONFIG_SIGN_IMAGE),yes)
176 chmod a+x $(SIGN)
177 mkimage -A arm -O linux -C none -T filesystem -a 0 -e 0 -n 'rootfs' -d $(IMAGE_DIR)/rootfs.img $(IMAGE_DIR)/rootfs_u.img
178 @$(SIGN) -i $(IMAGE_DIR)/rootfs_u.img -o $(IMAGE_DIR)/rootfs_signed.img -k $(PRIVATE_KEY_PATH)
179 dd if=$(IMAGE_DIR)/rootfs_signed.img of=$(IMAGE_DIR)/rootfs.sign bs=704 count=1
180 cat $(IMAGE_DIR)/rootfs.sign $(IMAGE_DIR)/linux_kernel.img > $(IMAGE_DIR)/rootfs_kernel.img
181 @$(SIGN) -i $(IMAGE_DIR)/rootfs_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin -k $(PRIVATE_KEY_PATH)
182else
183 @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin
184endif
185
186busybox_menuconfig:
187ifeq ($(AP_BUILD_TYPE),normal)
188 make -C $(APP_DIR)/busybox/src O=$(APP_DIR)/busybox/build menuconfig
189else
190 make -C $(APP_DIR)/busybox/src O=$(APP_DIR)/busybox_recovery/build menuconfig
191endif
192
193cpko:
194 (cd $(LINUX_DIR) && $(CC) -Wp,-MD,drivers/cpko/.cpko_main.o.d -nostdinc -isystem $(CROSS_COMPILE_INCLUDE_PATH) -I$(LINUX_DIR)/arch/arm/include -Iarch/arm/include/generated -Iinclude -include $(LINUX_DIR)/include/linux/kconfig.h -D__KERNEL__ -DDDR_BASE_ADDR_LINUX_VA -mlittle-endian -Iarch/arm/mach-zx297520v3/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -DCONFIG_SINGLECORE -DUSE_CPPS_KO -mlong-calls -marm -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables $(CPKO_EXT_CFLAGS) -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -DMODULE -DCPKO -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(cpko_main)" -D"KBUILD_MODNAME=KBUILD_STR(cpko)" -c -o drivers/cpko/cpko_main.o drivers/cpko/cpko_main.c)
195 #(cd $(LINUX_DIR) && $(LD) -EL -r -o drivers/cpko/cpko.o drivers/cpko/cpko_main.o --whole-archive $(libps_libs) --no-whole-archive; scripts/mod/modpost drivers/cpko/cpko.o)
196ifeq ($(USE_ENABLE_LTO),yes)
197 (cd $(LINUX_DIR) && $(LD) -EL -r -o drivers/cpko/cpko.o drivers/cpko/cpko_main.o; scripts/mod/modpost drivers/cpko/cpko.o)
198else
199 (cd $(LINUX_DIR) && $(LD) -EL -r -T $(LINUX_DIR)/scripts/module-cpko.lds -o drivers/cpko/cpko.o drivers/cpko/cpko_main.o --start-group $(libps_libs) --end-group; scripts/mod/modpost drivers/cpko/cpko.o)
200endif
201 (cd $(LINUX_DIR) && $(CC) -Wp,-MD,drivers/cpko/.cpko.mod.o.d -nostdinc -isystem $(CROSS_COMPILE_INCLUDE_PATH) -I$(LINUX_DIR)/arch/arm/include -Iarch/arm/include/generated -Iinclude -include $(LINUX_DIR)/include/linux/kconfig.h -D__KERNEL__ -DDDR_BASE_ADDR_LINUX_VA -mlittle-endian -Iarch/arm/mach-zx297520v3/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -DCONFIG_SINGLECORE -DUSE_CPPS_KO -mlong-calls -marm -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables $(CPKO_EXT_CFLAGS) -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(cpko.mod)" -D"KBUILD_MODNAME=KBUILD_STR(cpko)" -DMODULE -c -o drivers/cpko/cpko.mod.o drivers/cpko/cpko.mod.c)
202ifeq ($(USE_ENABLE_LTO),yes)
203 (cd $(LINUX_DIR) && $(CC) -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -DCONFIG_SINGLECORE -DUSE_CPPS_KO -mlong-calls -marm -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO $(LTO_CFLAGS) -nostdlib $(LTO_FINAL_CFLAGS) -Wl,-r -Wl,-T $(LINUX_DIR)/scripts/module-common.lds -Wl,--build-id -o drivers/cpko/cpko.ko drivers/cpko/cpko.o drivers/cpko/cpko.mod.o -Wl,--whole-archive $(libps_libs_lto) -Wl,--no-whole-archive -Wl,--start-group $(libps_libs_nolto) -Wl,--end-group)
204else
205# (cd $(LINUX_DIR) && $(LD) -EL -r -T $(LINUX_DIR)/scripts/module-common.lds --build-id -o drivers/cpko/cpko.ko drivers/cpko/cpko.o drivers/cpko/cpko.mod.o)
206 (cd $(LINUX_DIR) && $(LD) -EL -r --build-id -o drivers/cpko/cpko.ko drivers/cpko/cpko.o drivers/cpko/cpko.mod.o)
207endif
208 #(cd $(LINUX_DIR) && scripts/mod/modpost -m -a -o $(LINUX_DIR)/Module.symvers -c -s vmlinux drivers/cpko/cpko.ko)
209 mkdir -p $(ROOTFS_DIR)/lib/cpko
210 $(STRIPTOOL) --strip-debug --strip-unneeded -R .comment -R .ARM.attributes -R .ARM.exidx -R .ARM.extab -R .ARM.extab.ps_static_func -R .ARM.exidx.ps_static_func -R .ARM.extab.ps_comm_func -R .ARM.exidx.ps_comm_func -R .ARM.extab.ps_4g_func -R .ARM.exidx.ps_4g_func -R .ARM.extab.ps_3g_func -R .ARM.exidx.ps_3g_func -R .ARM.extab.ps_2g_func -R .ARM.exidx.ps_2g_func $(LINUX_DIR)/drivers/cpko/cpko.ko -o $(LINUX_DIR)/drivers/cpko/cpko_stripped.ko
211 ko_strip $(LINUX_DIR)/drivers/cpko/cpko_stripped.ko $(LINUX_DIR)/System.map $(ROOTFS_DIR)/lib/cpko/cpko_tmp.ko $(ROOTFS_DIR)/lib/cpko/cpko_secinfo.bin > $(OUTPUT_DIR)/ko_strip.txt 2>&1 \
212 && echo "ko_strip success." || { echo "ko_strip failure!"; cat $(OUTPUT_DIR)/ko_strip.txt; exit 1; }
213 $(STRIPTOOL) -R .symtab -R .strtab $(ROOTFS_DIR)/lib/cpko/cpko_tmp.ko -o $(ROOTFS_DIR)/lib/cpko/cpko.ko
214 rm $(ROOTFS_DIR)/lib/cpko/cpko_tmp.ko
215 chmod a+x $(ROOTFS_DIR)/lib/cpko/*
216
217ifeq ($(USE_DL_CP),no)
218 (cd $(LINUX_DIR) && $(CC) -Wp,-MD,drivers/loadcp/.load_cpko.o.d -nostdinc -isystem $(CROSS_COMPILE_INCLUDE_PATH) -I$(LINUX_DIR)/arch/arm/include -Iarch/arm/include/generated -Iinclude -include $(LINUX_DIR)/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-zx297520v3/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -DCONFIG_SINGLECORE -DUSE_CPPS_KO -mlong-calls -marm -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -DMODULE -DLOADCP -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(load_cpko)" -D"KBUILD_MODNAME=KBUILD_STR(loadcp)" -c -o drivers/loadcp/load_cpko.o drivers/loadcp/load_cpko.c)
219 (cd $(LINUX_DIR) && $(LD) -EL -r -o drivers/loadcp/loadcp.o drivers/loadcp/load_cpko.o; scripts/mod/modpost drivers/loadcp/loadcp.o)
220 (cd $(LINUX_DIR) && $(CC) -Wp,-MD,drivers/loadcp/.loadcp.mod.o.d -nostdinc -isystem $(CROSS_COMPILE_INCLUDE_PATH) -I$(LINUX_DIR)/arch/arm/include -Iarch/arm/include/generated -Iinclude -include $(LINUX_DIR)/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-zx297520v3/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -DCONFIG_SINGLECORE -DUSE_CPPS_KO -mlong-calls -marm -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(loadcp.mod)" -D"KBUILD_MODNAME=KBUILD_STR(loadcp)" -DMODULE -c -o drivers/loadcp/loadcp.mod.o drivers/loadcp/loadcp.mod.c)
221 (cd $(LINUX_DIR) && $(LD) -EL -r --build-id -o drivers/loadcp/loadcp.ko drivers/loadcp/loadcp.o drivers/loadcp/loadcp.mod.o)
222 #(cd $(LINUX_DIR) && scripts/mod/modpost -m -a -o $(LINUX_DIR)/Module.symvers -c -s vmlinux drivers/loadcp/loadcp.ko)
223 $(STRIPTOOL) --strip-debug --strip-unneeded -R .comment -R .ARM.attributes $(LINUX_DIR)/drivers/loadcp/loadcp.ko -o $(LINUX_DIR)/drivers/loadcp/loadcp_stripped.ko
224 mkdir -p $(ROOTFS_DIR)/lib/loadcp
225 cp -v $(LINUX_DIR)/drivers/loadcp/loadcp_stripped.ko $(ROOTFS_DIR)/lib/loadcp/loadcp.ko > $(OUTPUT_DIR)/ko_strip.txt
226 chmod a+x $(ROOTFS_DIR)/lib/loadcp/*.ko
227 rm -f $(ROOTFS_DIR)/lib/cpko/cpko.ko
228 chmod a+x $(ROOTFS_DIR)/lib/cpko/*.bin
229endif
230ifeq ($(KO_SPLIT_ENABLE),yes)
231 rm -fv $(ROOTFS_DIR)/lib/cpko/*.lzma
232 (cd $(ROOTFS_DIR)/lib/cpko && split -b $(SPLIT_BLOCK_SIZE) cpko.ko -d -a 2 cpko_)
233 (cd $(ROOTFS_DIR)/lib/cpko && ls -1 cpko_?? | xargs -I {} minilzma -t $(LZMA_DICT) {})
234 rm -fv $(ROOTFS_DIR)/lib/cpko/cpko.ko
235endif
236
237cpkoclean:
238 make V=1 -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) M=drivers/cpko clean
239
240app:
241 mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin
242 make -C app
243
244appclean:
245 make -C app clean
246
247lib:
248 mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin
249 make -C lib
250
251libclean:
252 make -C lib clean
253
254populate_sdk:
255 make -C lib populate_sdk
256
257libc:
258 make -C $(LIBC_DIR)
259
260libcclean:
261 make -C $(LIBC_DIR) clean
262
263normal_conf:
264 @cp -v $(PRJ_CONF_DIR)/normal/config.linux $(LINUX_DIR)/arch/arm/configs/zte_defconfig
265 make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) zte_defconfig
266 $(BUILD_DIR)/config_check.sh $(PRJ_CONF_DIR)/normal/config.linux $(LINUX_DIR)/.config
267 @cp -v $(PRJ_CONF_DIR)/normal/config.busybox $(APP_DIR)/busybox/src/configs/zte_defconfig
268 @cp -v $(PRJ_CONF_DIR)/normal/config.busybox_recovery $(APP_DIR)/busybox/src/configs/zte_recovery_defconfig
269ifeq ($(LIBC_TYPE),uClibc)
270 @cp -v $(PRJ_CONF_DIR)/normal/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config
271endif
272 @cp -v $(PRJ_CONF_DIR)/normal/config_lib.mk $(LIB_DIR)/config_lib.mk
273 @cp -v $(PRJ_CONF_DIR)/normal/config_app.mk $(APP_DIR)/config_app.mk
274 mkdir -p $(OUTPUT_DIR)
275 echo "AP_BUILD_TYPE = normal" > $(OUTPUT_DIR)/sys_type.mk
276 echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk
277
278cap_conf:
279 @cp -v $(PRJ_CONF_DIR)/cap/config.linux $(LINUX_DIR)/arch/arm/configs/zte_defconfig
280 make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) zte_defconfig
281 $(BUILD_DIR)/config_check.sh $(PRJ_CONF_DIR)/cap/config.linux $(LINUX_DIR)/.config
282 @cp -v $(PRJ_CONF_DIR)/cap/config.busybox $(APP_DIR)/busybox/src/configs/zte_defconfig
283ifeq ($(LIBC_TYPE),uClibc)
284 @cp -v $(PRJ_CONF_DIR)/cap/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config
285endif
286 @cp -v $(PRJ_CONF_DIR)/cap/config_lib.mk $(LIB_DIR)/config_lib.mk
287 @cp -v $(PRJ_CONF_DIR)/cap/config_app.mk $(APP_DIR)/config_app.mk
288 mkdir -p $(OUTPUT_DIR)
289 echo "AP_BUILD_TYPE = cap" > $(OUTPUT_DIR)/sys_type.mk
290 echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk
291
292userdata:
293 @echo "=========> Begin to Make userdata FS Image! <==================="
294 rm -rf $(USERDATA_DIR)
295 mkdir -p $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins
296 mkdir -p $(USERDATA_DIR)/cache $(USERDATA_DIR)/etc_rw $(USERDATA_DIR)/var
297 #@cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/userdata/* $(USERDATA_DIR)
298 #find $(USERDATA_DIR) -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
299ifeq ($(USERDATA_FS_TYPE),ubifs)
300 bash $(BUILD_DIR)/ubifs.sh userdata $(USERDATA_SIZE) $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img
301else
302ifeq ($(PRJ_IS_MIN),yes)
303 bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img lzma
304else
305 bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img lzo
306endif
307endif
308
309 #(cd $(USERDATA_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../userdata_attr.txt)
310 #(cd $(USERDATA_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../userdata_attr.txt)
311 #(cd $(USERDATA_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../userdata_attr.txt)
312 #(cd $(USERDATA_DIR)/.. && tar -zcvf $(PRJ_BIN_DIR)/allbins/userdata.tgz userdata userdata_attr.txt)
313 #@rm $(USERDATA_DIR)/../userdata_attr.txt
314 @echo "=========> Make userdata FS Image End! <==================="
315
316capuserdata:
317 @echo "=========> Begin to Make cap userdata FS Image! <==================="
318 rm -rf $(USERDATA_DIR) $(ROOTFS_DIR)
319 mkdir -p $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins
320 mkdir -p $(USERDATA_DIR)/cache $(USERDATA_DIR)/etc_rw $(USERDATA_DIR)/var $(CAP_ROOTFS_DIR)/etc_ro/
321 ln -s $(CAP_ROOTFS_DIR) $(ROOTFS_DIR)
322 #@cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/userdata/* $(USERDATA_DIR)
323 #find $(USERDATA_DIR) -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
324ifeq ($(USERDATA_FS_TYPE),ubifs)
325 bash $(BUILD_DIR)/ubifs.sh userdata $(CAP_USERDATA_SIZE) $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img
326else
327ifeq ($(PRJ_IS_MIN),yes)
328 bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img lzma
329else
330 bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img lzo
331endif
332endif
333 @echo "=========> Make cap userdata FS Image End! <==================="
334
335resource:
336ifneq ($(USE_RESOURCE),yes)
337 $(error NO USE_RESOURCE)
338endif
339 @echo "=========> Begin to Make resource FS Image! <==================="
340 rm -rf $(RESOURCE_DIR)
341 mkdir -p $(RESOURCE_DIR) $(PRJ_BIN_DIR)/allbins
342 @cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/resource/* $(RESOURCE_DIR)
343 find $(RESOURCE_DIR) -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
344 for bmpfile in $(LOGO_BMP_FILE); \
345 do \
346 bmp_to_565 $(RESOURCE_DIR)/$$bmpfile.bmp $(RESOURCE_DIR)/$$bmpfile.bin || exit $$?; \
347 rm $(RESOURCE_DIR)/$$bmpfile.bmp || exit $$?; \
348 done
349
350ifeq ($(PRJ_IS_MIN),yes)
351 bash $(BUILD_DIR)/jffs2_lzma.sh $(RESOURCE_DIR) $(PRJ_BIN_DIR)/allbins/ap_resource.img lzma
352else
353 bash $(BUILD_DIR)/jffs2_lzma.sh $(RESOURCE_DIR) $(PRJ_BIN_DIR)/allbins/ap_resource.img lzo
354endif
355
356 (cd $(RESOURCE_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../resource_attr.txt)
357 (cd $(RESOURCE_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../resource_attr.txt)
358 (cd $(RESOURCE_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../resource_attr.txt)
359 (cd $(RESOURCE_DIR)/.. && tar -zcvf $(PRJ_BIN_DIR)/allbins/resource.tgz resource resource_attr.txt)
360 @rm $(RESOURCE_DIR)/../resource_attr.txt
361 @echo "=========> Make resource FS Image End! <==================="
362
363oem_fs:
364ifneq ($(USE_OEM_FS),yes)
365 $(error NO USE_OEM_FS)
366endif
367 @echo "=========> Begin to Make oem FS Image! <==================="
368 rm -rf $(OEM_FS_DIR)
369 mkdir -p $(OEM_FS_DIR) $(PRJ_BIN_DIR)/allbins
370 @cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/oem/* $(OEM_FS_DIR)
371 find $(OEM_FS_DIR) -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
372ifeq ($(PRJ_IS_MIN),yes)
373 bash $(BUILD_DIR)/jffs2_lzma.sh $(OEM_FS_DIR) $(PRJ_BIN_DIR)/allbins/ap_oem.img lzma
374else
375 bash $(BUILD_DIR)/jffs2_lzma.sh $(OEM_FS_DIR) $(PRJ_BIN_DIR)/allbins/ap_oem.img lzo
376endif
377 @echo "=========> Make oem FS Image End! <==================="
378
379normal:
380 make AP_BUILD_TYPE=normal sysclean
381 make userdata
382ifeq ($(USE_RESOURCE),yes)
383 make resource
384endif
385ifeq ($(USE_OEM_FS),yes)
386 make oem_fs
387endif
388 make normal_conf
389 make AP_BUILD_TYPE=normal sysclean
390 make normal_conf
391 make AP_BUILD_TYPE=normal sys
392 make AP_BUILD_TYPE=normal rootfs
393 make AP_BUILD_TYPE=normal copybin
394
395normal2:
396 make AP_BUILD_TYPE=normal sys
397 make AP_BUILD_TYPE=normal rootfs
398 make AP_BUILD_TYPE=normal copybin
399
400normalclean:
401 -make AP_BUILD_TYPE=normal sysclean
402 make normal_conf
403 make AP_BUILD_TYPE=normal sysclean
404
405cap:
406 make AP_BUILD_TYPE=cap sysclean
407 make cap_conf
408 make AP_BUILD_TYPE=cap sysclean
409 make cap_conf
410 make capuserdata
411 make AP_BUILD_TYPE=cap sys
412 make AP_BUILD_TYPE=cap rootfs
413 make AP_BUILD_TYPE=cap copybin
414
415cap2:
416 make AP_BUILD_TYPE=cap sys
417 make AP_BUILD_TYPE=cap rootfs
418 make AP_BUILD_TYPE=cap copybin
419
420capclean:
421 make AP_BUILD_TYPE=cap sysclean
422 make cap_conf
423 make AP_BUILD_TYPE=cap sysclean
424
425recovery_conf:
426 @cp -v $(PRJ_CONF_DIR)/recovery/config.linux $(LINUX_DIR)/arch/arm/configs/zte_defconfig
427 make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) zte_defconfig
428 $(BUILD_DIR)/config_check.sh $(PRJ_CONF_DIR)/recovery/config.linux $(LINUX_DIR)/.config
429 mkdir -p $(OUTPUT_DIR)
430ifeq ($(USE_RECOVERYFS),yes)
431 @cp -v $(PRJ_CONF_DIR)/recovery/config.busybox $(APP_DIR)/busybox/src/configs/zte_defconfig
432ifeq ($(LIBC_TYPE),uClibc)
433 @cp -v $(PRJ_CONF_DIR)/recovery/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config
434endif
435 @cp -v $(PRJ_CONF_DIR)/recovery/config_lib.mk $(LIB_DIR)/config_lib.mk
436 @cp -v $(PRJ_CONF_DIR)/recovery/config_app.mk $(APP_DIR)/config_app.mk
437 mkdir -p $(OUTPUT_DIR)/recoveryfs
438 ln -s $(RECOVERYFS_DIR) $(ROOTFS_DIR)
439endif
440 echo "AP_BUILD_TYPE = recovery" > $(OUTPUT_DIR)/sys_type.mk
441 echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk
442
443recovery:
444ifeq ($(USE_RECOVERYFS),yes)
445 make AP_BUILD_TYPE=recovery sysclean
446 make recovery_conf
447 make AP_BUILD_TYPE=recovery sysclean
448 make recovery_conf
449 make AP_BUILD_TYPE=recovery sys
450 make AP_BUILD_TYPE=recovery rootfs
451else
452 make kerneldistclean
453 make recovery_conf
454 make kerneldistclean
455 make recovery_conf
456 make kernel
457endif
458 make AP_BUILD_TYPE=recovery copybin
459
460recovery2:
461ifeq ($(USE_RECOVERYFS),yes)
462 make AP_BUILD_TYPE=recovery sys
463 make AP_BUILD_TYPE=recovery rootfs
464else
465 make kernel
466endif
467 make AP_BUILD_TYPE=recovery copybin
468
469recoveryclean:
470ifeq ($(USE_RECOVERYFS),yes)
471 -make AP_BUILD_TYPE=recovery sysclean
472 make recovery_conf
473 make AP_BUILD_TYPE=recovery sysclean
474else
475 make kerneldistclean
476 make recovery_conf
477 make kerneldistclean
478endif
479
480
481rootfs:
482ifeq ($(AP_BUILD_TYPE),)
483 $(error AP_BUILD_TYPE is NULL)
484endif
485ifeq ($(AP_BUILD_TYPE),normal)
486 make normal_rootfs
487endif
488ifeq ($(AP_BUILD_TYPE),cap)
489 make cap_rootfs
490endif
491ifeq ($(USE_RECOVERYFS),yes)
492ifeq ($(AP_BUILD_TYPE),recovery)
493 make recovery_rootfs
494endif
495endif
496
497copybin:
498ifeq ($(AP_BUILD_TYPE),)
499 $(error AP_BUILD_TYPE is NULL)
500endif
501ifeq ($(AP_BUILD_TYPE),normal)
502 make normal_copybin
503endif
504ifeq ($(AP_BUILD_TYPE),recovery)
505 make recovery_copybin
506endif
507ifeq ($(AP_BUILD_TYPE),cap)
508 make cap_copybin
509endif
510
511normal_rootfs: normal_check
512 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs
513 rm -fr $(ROOTFS_DIR)/etc_rw
514 cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/rootfs/* $(ROOTFS_DIR)/
515 cp -v $(PRJ_BIN_DIR)/allbins/ap_userdata.img $(ROOTFS_DIR)/etc_ro/
516 @cd $(BUILD_DIR); bash ./install_libc.sh $(ROOTFS_DIR)
517 @cd $(BUILD_DIR); bash ./fix_userdata_link.sh $(ROOTFS_DIR)
518 @cd $(BUILD_DIR); bash ./check_file_mode.sh $(ROOTFS_DIR)
519 find $(ROOTFS_DIR)/ -name '.gitkeep' -print0 | xargs -0 rm -fr
520 find $(ROOTFS_DIR)/ -name '.git' -print0 | xargs -0 rm -fr
521 find $(ROOTFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr
522 find $(ROOTFS_DIR)/ -name '.svn' -print0 | xargs -0 rm -fr
523ifneq ($(USE_FOTA),yes)
524 rm -fr $(ROOTFS_DIR)/recovery
525else
526ifeq ($(USE_FOTA_AB),yes)
527 rm -fr $(ROOTFS_DIR)/recovery
528endif
529endif
530
531ifeq ($(ROOT_FS_TYPE),ubifs)
532 bash $(BUILD_DIR)/ubifs.sh rootfs $(ROOTFS_SIZE) $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img
533else
534ifeq ($(ROOT_FS_TYPE),jffs2)
535ifeq ($(PRJ_IS_MIN),yes)
536 bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzma
537else
538 bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzo
539endif
540else
541ifeq ($(ROOT_FS_TYPE),squashfs)
542 bash $(BUILD_DIR)/squashfs.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img
543endif
544endif
545endif
546 (cd $(ROOTFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../rootfs_attr.txt)
547 (cd $(ROOTFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt)
548 (cd $(ROOTFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt)
549 (cd $(ROOTFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/rootfs.tgz rootfs rootfs_attr.txt)
550 @rm $(ROOTFS_DIR)/../rootfs_attr.txt
551
552recovery_rootfs: recovery_check
553 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs
554 rm -fr $(RECOVERYFS_DIR)/etc_rw $(RECOVERYFS_DIR)/recovery
555 cp -afvp $(PRJ_PRODUCT_DIR)/fs/recovery/rootfs/* $(RECOVERYFS_DIR)/
556 @cd $(BUILD_DIR); bash ./install_libc.sh $(RECOVERYFS_DIR)
557 @cd $(BUILD_DIR); bash ./fix_userdata_link.sh $(RECOVERYFS_DIR)
558 @cd $(BUILD_DIR); bash ./check_file_mode.sh $(RECOVERYFS_DIR)
559 find $(RECOVERYFS_DIR)/ -name '.gitkeep' -print0 | xargs -0 rm -fr
560 find $(RECOVERYFS_DIR)/ -name '.git' -print0 | xargs -0 rm -fr
561 find $(RECOVERYFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr
562 find $(RECOVERYFS_DIR)/ -name '.svn' -print0 | xargs -0 rm -fr
563
564ifeq ($(ROOT_FS_TYPE),ubifs)
565 bash $(BUILD_DIR)/ubifs.sh recoveryfs $(RECOVERYFS_SIZE) $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img
566else
567ifeq ($(ROOT_FS_TYPE),jffs2)
568ifeq ($(PRJ_IS_MIN),yes)
569 bash $(BUILD_DIR)/jffs2_lzma.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img lzma
570else
571 bash $(BUILD_DIR)/jffs2_lzma.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img lzo
572endif
573else
574ifeq ($(ROOT_FS_TYPE),squashfs)
575 bash $(BUILD_DIR)/squashfs.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img
576endif
577endif
578endif
579 (cd $(RECOVERYFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../recoveryfs_attr.txt)
580 (cd $(RECOVERYFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../recoveryfs_attr.txt)
581 (cd $(RECOVERYFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../recoveryfs_attr.txt)
582 (cd $(RECOVERYFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/recoveryfs.tgz recoveryfs recoveryfs_attr.txt)
583 @rm $(RECOVERYFS_DIR)/../recoveryfs_attr.txt
584
585cap_rootfs:
586 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs
587 rm -fr $(CAP_ROOTFS_DIR)/etc_rw
588 cp -afvp $(PRJ_PRODUCT_DIR)/fs/cap/rootfs/* $(CAP_ROOTFS_DIR)/
589 cp -v $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img $(CAP_ROOTFS_DIR)/etc_ro/
590 chmod -R a+r $(CAP_ROOTFS_DIR)/etc_ro
591 find $(CAP_ROOTFS_DIR)/bin -type f | xargs chmod a+x
592 -find $(CAP_ROOTFS_DIR)/sbin -type f | xargs chmod a+x
593 chmod a+x $(CAP_ROOTFS_DIR)/etc/rc
594 @cd $(BUILD_DIR); bash ./install_libc.sh $(CAP_ROOTFS_DIR)
595 find $(CAP_ROOTFS_DIR)/ -name '.gitkeep' -print0 | xargs -0 rm -fr
596 find $(CAP_ROOTFS_DIR)/ -name '.git' -print0 | xargs -0 rm -fr
597 find $(CAP_ROOTFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr
598 find $(CAP_ROOTFS_DIR)/ -name '.svn' -print0 | xargs -0 rm -fr
599
600ifeq ($(ROOT_FS_TYPE),ubifs)
601 bash $(BUILD_DIR)/ubifs.sh rootfs $(CAP_ROOTFS_SIZE) $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img
602else
603ifeq ($(ROOT_FS_TYPE),jffs2)
604ifeq ($(PRJ_IS_MIN),yes)
605 bash $(BUILD_DIR)/jffs2_lzma.sh $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img lzma
606else
607 bash $(BUILD_DIR)/jffs2_lzma.sh $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img lzo
608endif
609endif
610endif
611
612 (cd $(CAP_ROOTFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../caprootfs_attr.txt)
613 (cd $(CAP_ROOTFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../caprootfs_attr.txt)
614 (cd $(CAP_ROOTFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../caprootfs_attr.txt)
615 (cd $(CAP_ROOTFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/caprootfs.tgz caprootfs caprootfs_attr.txt)
616 @rm $(CAP_ROOTFS_DIR)/../caprootfs_attr.txt
617
618imagefs:
619 mkdir -p $(IMAGEFS_DIR)
620 rm -frv $(IMAGEFS_DIR)/*
621 cp -v $(PRJ_BIN_DIR)/allbins/evb_cpuphy.bin $(IMAGEFS_DIR)/
622ifeq ($(LARGEFILE_SPLIT_ENABLE),yes)
623 (cd $(IMAGEFS_DIR) && split -b $(SPLIT_BLOCK_SIZE) evb_cpuphy.bin -d -a 2 cpuphy_)
624 (cd $(IMAGEFS_DIR) && ls -1 cpuphy_* | xargs -I {} minilzma -t $(LZMA_DICT) {})
625 rm -fv $(IMAGEFS_DIR)/evb_cpuphy.bin
626endif
627 cp -v $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(IMAGEFS_DIR)/
628ifeq ($(BUILD_CAP),yes)
629 cp -v $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin $(IMAGEFS_DIR)/
630ifeq ($(LARGEFILE_SPLIT_ENABLE),yes)
631 (cd $(IMAGEFS_DIR) && split -b $(SPLIT_BLOCK_SIZE) ap_cpucap.bin -d -a 2 cpucap_)
632 (cd $(IMAGEFS_DIR) && ls -1 cpucap_* | xargs -I {} minilzma -t $(LZMA_DICT) {})
633 rm -fv $(IMAGEFS_DIR)/ap_cpucap.bin
634endif
635endif
636
637ifeq ($(LARGEFILE_SPLIT_ENABLE),yes)
638 (cd $(IMAGEFS_DIR) && split -b $(SPLIT_BLOCK_SIZE) ap_cpuap.bin -d -a 2 cpuap_)
639 (cd $(IMAGEFS_DIR) && ls -1 cpuap_* | xargs -I {} minilzma -t $(LZMA_DICT) {})
640 rm -fv $(IMAGEFS_DIR)/ap_cpuap.bin
641endif
642ifeq ($(USE_FOTA),yes)
643ifneq ($(USE_FOTA_AB),yes)
644 cp -v $(PRJ_BIN_DIR)/allbins/ap_recovery.bin $(IMAGEFS_DIR)/
645ifeq ($(LARGEFILE_SPLIT_ENABLE),yes)
646 (cd $(IMAGEFS_DIR) && split -b $(SPLIT_BLOCK_SIZE) ap_recovery.bin -d -a 2 recovery_)
647 (cd $(IMAGEFS_DIR) && ls -1 recovery_* | xargs -I {} minilzma -t $(LZMA_DICT) {})
648 rm -fv $(IMAGEFS_DIR)/ap_recovery.bin
649endif
650endif
651endif
652 cp -v $(PRJ_BIN_DIR)/allbins/evb_cpurpm.img $(IMAGEFS_DIR)/
653 cp -v $(PRJ_BIN_DIR)/allbins/nvrwoall.bin $(IMAGEFS_DIR)/
654 cp -v $(PRJ_BIN_DIR)/allbins/nvrwall.bin $(IMAGEFS_DIR)/
655 md5sum $(IMAGEFS_DIR)/nvrwall.bin | awk '{printf $$1}' > $(IMAGEFS_DIR)/nvrwall.hash
656ifeq ($(USE_FOTA),yes)
657ifneq ($(USE_FOTA_AB),yes)
658 dd if=/dev/zero bs=1024 count=1 2> /dev/null | tr \\000 \\377 > $(IMAGEFS_DIR)/fotaflag
659endif
660endif
661 #minilzma -t $(LZMA_DICT) $(IMAGEFS_DIR)/nvrwall.bin
662ifeq ($(PRJ_IS_MIN),yes)
663 bash $(BUILD_DIR)/jffs2_lzma.sh $(IMAGEFS_DIR) $(IMAGE_DIR)/ap_imagefs.img lzma
664else
665 bash $(BUILD_DIR)/jffs2_lzma.sh $(IMAGEFS_DIR) $(IMAGE_DIR)/ap_imagefs.img lzo
666endif
667 cp -v $(IMAGE_DIR)/ap_imagefs.img $(PRJ_BIN_DIR)/allbins/
668
669 (cd $(IMAGEFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../imagefs_attr.txt)
670 (cd $(IMAGEFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../imagefs_attr.txt)
671 (cd $(IMAGEFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../imagefs_attr.txt)
672 (cd $(IMAGEFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/imagefs.tgz imagefs imagefs_attr.txt)
673 @rm $(IMAGEFS_DIR)/../imagefs_attr.txt
674
675nvrofs:
676 mkdir -p $(NVROFS_DIR)
677 cp -v $(PRJ_BIN_DIR)/allbins/nvroall.bin $(NVROFS_DIR)/
678ifeq ($(PRJ_IS_MIN),yes)
679 bash $(BUILD_DIR)/jffs2_lzma.sh $(NVROFS_DIR) $(IMAGE_DIR)/ap_nvrofs.img lzma
680else
681 bash $(BUILD_DIR)/jffs2_lzma.sh $(NVROFS_DIR) $(IMAGE_DIR)/ap_nvrofs.img lzo
682endif
683 cp -v $(IMAGE_DIR)/ap_nvrofs.img $(PRJ_BIN_DIR)/allbins/
684
685normal_copybin: normal_check
686 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/normalelfs
687 cp -v $(IMAGE_DIR)/rootfs.img $(PRJ_BIN_DIR)/allbins/ap_rootfs.img
688ifeq ($(CONFIG_SIGN_IMAGE),yes)
689 chmod a+x $(SIGN)
690 mkimage -A arm -O linux -C none -T filesystem -a 0 -e 0 -n 'rootfs' -d $(IMAGE_DIR)/rootfs.img $(IMAGE_DIR)/rootfs_u.img
691 @$(SIGN) -i $(IMAGE_DIR)/rootfs_u.img -o $(IMAGE_DIR)/rootfs_signed.img -k $(PRIVATE_KEY_PATH)
692 dd if=$(IMAGE_DIR)/rootfs_signed.img of=$(IMAGE_DIR)/rootfs.sign bs=704 count=1
693 cat $(IMAGE_DIR)/rootfs.sign $(IMAGE_DIR)/linux_kernel.img > $(IMAGE_DIR)/rootfs_kernel.img
694 @$(SIGN) -i $(IMAGE_DIR)/rootfs_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin -k $(PRIVATE_KEY_PATH)
695else
696 @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin
697endif
698 cp -v $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/elfs/
699 cp -v $(IMAGE_DIR)/System.map $(PRJ_BIN_DIR)/elfs/
700 mkdir -p $(PRJ_BIN_DIR)/test_tools/
701 cp -afvp $(APP_DIR)/test_tools/* $(PRJ_BIN_DIR)/test_tools/
702 find $(PRJ_BIN_DIR)/test_tools/ -type f -size +512k -exec ${STRIPTOOL} '{}' ';'
703
704 find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
705 find $(LIB_DIR)/ -name "l*.so*" -type f ! -path "*/.libs/*" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
706 find $(STAGEDIR)/libc/lib -type f -name "*.so*" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
707 find $(LINUX_DIR) -type f -name "*.ko" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
708
709cap_copybin:
710 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/capelfs
711 cp -v $(IMAGE_DIR)/ap_caprootfs.img $(PRJ_BIN_DIR)/allbins/
712ifeq ($(CONFIG_SIGN_IMAGE),yes)
713 chmod a+x $(SIGN)
714 @$(SIGN) -i $(IMAGE_DIR)/linux_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin -k $(PRIVATE_KEY_PATH)
715else
716 @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin
717endif
718 cp -v $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/elfs/vmlinux_cap
719 cp -v $(IMAGE_DIR)/System.map $(PRJ_BIN_DIR)/elfs/System_cap.map
720 mkdir -p $(PRJ_BIN_DIR)/test_tools/
721 cp -afvp $(APP_DIR)/test_tools/* $(PRJ_BIN_DIR)/test_tools/
722 find $(PRJ_BIN_DIR)/test_tools/ -type f -size +512k -exec ${STRIPTOOL} '{}' ';'
723
724 find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/capelfs \;
725 find $(LIB_DIR)/ -type f -name "lib*.so" -exec cp {} $(PRJ_BIN_DIR)/elfs/capelfs \;
726 find $(STAGEDIR)/libc/lib -type f -name "*.so" -exec cp {} $(PRJ_BIN_DIR)/elfs/capelfs \;
727 find $(LINUX_DIR) -type f -name "*.ko" -exec cp {} $(PRJ_BIN_DIR)/elfs/capelfs \;
728
729recovery_copybin: recovery_check
730 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/recoveryelfs
731ifeq ($(USE_RECOVERYFS),yes)
732 cp -v $(IMAGE_DIR)/recoveryfs.img $(PRJ_BIN_DIR)/allbins/ap_recoveryfs.img
733endif
734ifeq ($(CONFIG_SIGN_IMAGE),yes)
735 chmod a+x $(SIGN)
736 @$(SIGN) -i $(IMAGE_DIR)/linux_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_recovery.bin -k $(PRIVATE_KEY_PATH)
737else
738 @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_recovery.bin
739endif
740 cp -v $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/elfs/vmlinux.recovery
741 cp -v $(IMAGE_DIR)/System.map $(PRJ_BIN_DIR)/elfs/System.map.recovery
742ifeq ($(USE_RECOVERYFS),yes)
743 find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/recoveryelfs \;
744 find $(LIB_DIR)/ -name "l*.so*" -type f ! -path "*/.libs/*" -exec cp {} $(PRJ_BIN_DIR)/elfs/recoveryelfs \;
745 find $(STAGEDIR)/libc/lib -type f -name "*.so*" -exec cp {} $(PRJ_BIN_DIR)/elfs/recoveryelfs \;
746 find $(LINUX_DIR) -type f -name "*.ko" -exec cp {} $(PRJ_BIN_DIR)/elfs/recoveryelfs \;
747endif
748
749section_bin:
750 echo $(CROSS_COMPILE)
751 echo $(UIMAGE_LOADADDR)
752 rm -frv $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin
753 rm -frv $(PRJ_BIN_DIR)/allbins/modem_code.bin
754 rm -frv $(ROOTFS_DIR)/bin/modem_code.bin
755 $(CROSS_COMPILE)objcopy -O binary -j .modem.text $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/allbins/modem_code.bin
756 $(CROSS_COMPILE)objcopy -O binary -R .modem.text $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/allbins/ap_tmp.bin
757 ./os/linux/linux-3.4.x/scripts/mkuboot.sh -A arm -O linux -C none -T kernel -a 0x205c8000 -e 0x205c8000 -n 'Linux-3.4.110-rt140' -d $(PRJ_BIN_DIR)/allbins/ap_tmp.bin $(PRJ_BIN_DIR)/allbins/uap_tmp.bin
758 @$(SIGN) -i $(PRJ_BIN_DIR)/allbins/uap_tmp.bin -o $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin -k $(PRIVATE_KEY_PATH)
759 cp -v $(PRJ_BIN_DIR)/allbins/modem_code.bin $(ROOTFS_DIR)/bin/
760 rm -frv $(PRJ_BIN_DIR)/allbins/uap_tmp.bin
761 rm -frv $(PRJ_BIN_DIR)/allbins/ap_tmp.bin
762
763obfu:
764 bash $(BUILD_DIR)/obfu.sh