blob: 9ae3d8091b53e01e15b896d8e6705e2573638910 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001
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 @$(SIGN) -s $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(PRIVATE_KEY_PATH)
178else
179 @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin
180endif
181
182busybox_menuconfig:
183ifeq ($(AP_BUILD_TYPE),normal)
184 make -C $(APP_DIR)/busybox/src O=$(APP_DIR)/busybox/build menuconfig
185else
186 make -C $(APP_DIR)/busybox/src O=$(APP_DIR)/busybox_recovery/build menuconfig
187endif
188
189cpko:
190 (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)
191 #(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)
192ifeq ($(USE_ENABLE_LTO),yes)
193 (cd $(LINUX_DIR) && $(LD) -EL -r -o drivers/cpko/cpko.o drivers/cpko/cpko_main.o; scripts/mod/modpost drivers/cpko/cpko.o)
194else
195 (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)
196endif
197 (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)
198ifeq ($(USE_ENABLE_LTO),yes)
199 (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)
200else
201# (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)
202 (cd $(LINUX_DIR) && $(LD) -EL -r --build-id -o drivers/cpko/cpko.ko drivers/cpko/cpko.o drivers/cpko/cpko.mod.o)
203endif
204 #(cd $(LINUX_DIR) && scripts/mod/modpost -m -a -o $(LINUX_DIR)/Module.symvers -c -s vmlinux drivers/cpko/cpko.ko)
205 mkdir -p $(ROOTFS_DIR)/lib/cpko
206 $(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
207 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 \
208 && echo "ko_strip success." || { echo "ko_strip failure!"; cat $(OUTPUT_DIR)/ko_strip.txt; exit 1; }
209 $(STRIPTOOL) -R .symtab -R .strtab $(ROOTFS_DIR)/lib/cpko/cpko_tmp.ko -o $(ROOTFS_DIR)/lib/cpko/cpko.ko
210 rm $(ROOTFS_DIR)/lib/cpko/cpko_tmp.ko
211 chmod a+x $(ROOTFS_DIR)/lib/cpko/*
212
213ifeq ($(USE_DL_CP),no)
214 (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)
215 (cd $(LINUX_DIR) && $(LD) -EL -r -o drivers/loadcp/loadcp.o drivers/loadcp/load_cpko.o; scripts/mod/modpost drivers/loadcp/loadcp.o)
216 (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)
217 (cd $(LINUX_DIR) && $(LD) -EL -r --build-id -o drivers/loadcp/loadcp.ko drivers/loadcp/loadcp.o drivers/loadcp/loadcp.mod.o)
218 #(cd $(LINUX_DIR) && scripts/mod/modpost -m -a -o $(LINUX_DIR)/Module.symvers -c -s vmlinux drivers/loadcp/loadcp.ko)
219 $(STRIPTOOL) --strip-debug --strip-unneeded -R .comment -R .ARM.attributes $(LINUX_DIR)/drivers/loadcp/loadcp.ko -o $(LINUX_DIR)/drivers/loadcp/loadcp_stripped.ko
220 mkdir -p $(ROOTFS_DIR)/lib/loadcp
221 cp -v $(LINUX_DIR)/drivers/loadcp/loadcp_stripped.ko $(ROOTFS_DIR)/lib/loadcp/loadcp.ko > $(OUTPUT_DIR)/ko_strip.txt
222 chmod a+x $(ROOTFS_DIR)/lib/loadcp/*.ko
223 rm -f $(ROOTFS_DIR)/lib/cpko/cpko.ko
224 chmod a+x $(ROOTFS_DIR)/lib/cpko/*.bin
225endif
226ifeq ($(KO_SPLIT_ENABLE),yes)
227 rm -fv $(ROOTFS_DIR)/lib/cpko/*.lzma
228 (cd $(ROOTFS_DIR)/lib/cpko && split -b $(SPLIT_BLOCK_SIZE) cpko.ko -d -a 2 cpko_)
229 (cd $(ROOTFS_DIR)/lib/cpko && ls -1 cpko_?? | xargs -I {} minilzma -t $(LZMA_DICT) {})
230 rm -fv $(ROOTFS_DIR)/lib/cpko/cpko.ko
231endif
232
233cpkoclean:
234 make V=1 -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) M=drivers/cpko clean
235
236app:
237 mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin
238 make -C app
239
240appclean:
241 make -C app clean
242
243lib:
244 mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin
245 make -C lib
246
247libclean:
248 make -C lib clean
249
250populate_sdk:
251 make -C lib populate_sdk
252
253libc:
254 make -C $(LIBC_DIR)
255
256libcclean:
257 make -C $(LIBC_DIR) clean
258
259normal_conf:
260 @cp -v $(PRJ_CONF_DIR)/normal/config.linux $(LINUX_DIR)/arch/arm/configs/zte_defconfig
261 make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) zte_defconfig
262 $(BUILD_DIR)/config_check.sh $(PRJ_CONF_DIR)/normal/config.linux $(LINUX_DIR)/.config
263 @cp -v $(PRJ_CONF_DIR)/normal/config.busybox $(APP_DIR)/busybox/src/configs/zte_defconfig
264 @cp -v $(PRJ_CONF_DIR)/normal/config.busybox_recovery $(APP_DIR)/busybox/src/configs/zte_recovery_defconfig
265ifeq ($(LIBC_TYPE),uClibc)
266 @cp -v $(PRJ_CONF_DIR)/normal/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config
267endif
268 @cp -v $(PRJ_CONF_DIR)/normal/config_lib.mk $(LIB_DIR)/config_lib.mk
269 @cp -v $(PRJ_CONF_DIR)/normal/config_app.mk $(APP_DIR)/config_app.mk
270 mkdir -p $(OUTPUT_DIR)
271 echo "AP_BUILD_TYPE = normal" > $(OUTPUT_DIR)/sys_type.mk
272 echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk
273
274cap_conf:
275 @cp -v $(PRJ_CONF_DIR)/cap/config.linux $(LINUX_DIR)/arch/arm/configs/zte_defconfig
276 make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) zte_defconfig
277 $(BUILD_DIR)/config_check.sh $(PRJ_CONF_DIR)/cap/config.linux $(LINUX_DIR)/.config
278 @cp -v $(PRJ_CONF_DIR)/cap/config.busybox $(APP_DIR)/busybox/src/configs/zte_defconfig
279ifeq ($(LIBC_TYPE),uClibc)
280 @cp -v $(PRJ_CONF_DIR)/cap/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config
281endif
282 @cp -v $(PRJ_CONF_DIR)/cap/config_lib.mk $(LIB_DIR)/config_lib.mk
283 @cp -v $(PRJ_CONF_DIR)/cap/config_app.mk $(APP_DIR)/config_app.mk
284 mkdir -p $(OUTPUT_DIR)
285 echo "AP_BUILD_TYPE = cap" > $(OUTPUT_DIR)/sys_type.mk
286 echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk
287
288userdata:
289 @echo "=========> Begin to Make userdata FS Image! <==================="
290 rm -rf $(USERDATA_DIR)
291 mkdir -p $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins
292 mkdir -p $(USERDATA_DIR)/cache $(USERDATA_DIR)/etc_rw $(USERDATA_DIR)/var
293 #@cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/userdata/* $(USERDATA_DIR)
294 #find $(USERDATA_DIR) -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
295ifeq ($(USERDATA_FS_TYPE),ubifs)
296 bash $(BUILD_DIR)/ubifs.sh userdata $(USERDATA_SIZE) $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img
297else
298ifeq ($(PRJ_IS_MIN),yes)
299 bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img lzma
300else
301 bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img lzo
302endif
303endif
304
305 #(cd $(USERDATA_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../userdata_attr.txt)
306 #(cd $(USERDATA_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../userdata_attr.txt)
307 #(cd $(USERDATA_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../userdata_attr.txt)
308 #(cd $(USERDATA_DIR)/.. && tar -zcvf $(PRJ_BIN_DIR)/allbins/userdata.tgz userdata userdata_attr.txt)
309 #@rm $(USERDATA_DIR)/../userdata_attr.txt
310 @echo "=========> Make userdata FS Image End! <==================="
311
312capuserdata:
313 @echo "=========> Begin to Make cap userdata FS Image! <==================="
314 rm -rf $(USERDATA_DIR) $(ROOTFS_DIR)
315 mkdir -p $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins
316 mkdir -p $(USERDATA_DIR)/cache $(USERDATA_DIR)/etc_rw $(USERDATA_DIR)/var $(CAP_ROOTFS_DIR)/etc_ro/
317 ln -s $(CAP_ROOTFS_DIR) $(ROOTFS_DIR)
318 #@cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/userdata/* $(USERDATA_DIR)
319 #find $(USERDATA_DIR) -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
320ifeq ($(USERDATA_FS_TYPE),ubifs)
321 bash $(BUILD_DIR)/ubifs.sh userdata $(CAP_USERDATA_SIZE) $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img
322else
323ifeq ($(PRJ_IS_MIN),yes)
324 bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img lzma
325else
326 bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img lzo
327endif
328endif
329 @echo "=========> Make cap userdata FS Image End! <==================="
330
331resource:
332ifneq ($(USE_RESOURCE),yes)
333 $(error NO USE_RESOURCE)
334endif
335 @echo "=========> Begin to Make resource FS Image! <==================="
336 rm -rf $(RESOURCE_DIR)
337 mkdir -p $(RESOURCE_DIR) $(PRJ_BIN_DIR)/allbins
338 @cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/resource/* $(RESOURCE_DIR)
339 find $(RESOURCE_DIR) -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
340 for bmpfile in $(LOGO_BMP_FILE); \
341 do \
342 bmp_to_565 $(RESOURCE_DIR)/$$bmpfile.bmp $(RESOURCE_DIR)/$$bmpfile.bin || exit $$?; \
343 rm $(RESOURCE_DIR)/$$bmpfile.bmp || exit $$?; \
344 done
345
346ifeq ($(PRJ_IS_MIN),yes)
347 bash $(BUILD_DIR)/jffs2_lzma.sh $(RESOURCE_DIR) $(PRJ_BIN_DIR)/allbins/ap_resource.img lzma
348else
349 bash $(BUILD_DIR)/jffs2_lzma.sh $(RESOURCE_DIR) $(PRJ_BIN_DIR)/allbins/ap_resource.img lzo
350endif
351
352 (cd $(RESOURCE_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../resource_attr.txt)
353 (cd $(RESOURCE_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../resource_attr.txt)
354 (cd $(RESOURCE_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../resource_attr.txt)
355 (cd $(RESOURCE_DIR)/.. && tar -zcvf $(PRJ_BIN_DIR)/allbins/resource.tgz resource resource_attr.txt)
356 @rm $(RESOURCE_DIR)/../resource_attr.txt
357 @echo "=========> Make resource FS Image End! <==================="
358
359oem_fs:
360ifneq ($(USE_OEM_FS),yes)
361 $(error NO USE_OEM_FS)
362endif
363 @echo "=========> Begin to Make oem FS Image! <==================="
364 rm -rf $(OEM_FS_DIR)
365 mkdir -p $(OEM_FS_DIR) $(PRJ_BIN_DIR)/allbins
366 @cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/oem/* $(OEM_FS_DIR)
367 find $(OEM_FS_DIR) -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
368ifeq ($(PRJ_IS_MIN),yes)
369 bash $(BUILD_DIR)/jffs2_lzma.sh $(OEM_FS_DIR) $(PRJ_BIN_DIR)/allbins/ap_oem.img lzma
370else
371 bash $(BUILD_DIR)/jffs2_lzma.sh $(OEM_FS_DIR) $(PRJ_BIN_DIR)/allbins/ap_oem.img lzo
372endif
373 @echo "=========> Make oem FS Image End! <==================="
374
375normal:
376 make AP_BUILD_TYPE=normal sysclean
377 make userdata
378ifeq ($(USE_RESOURCE),yes)
379 make resource
380endif
381ifeq ($(USE_OEM_FS),yes)
382 make oem_fs
383endif
384 make normal_conf
385 make AP_BUILD_TYPE=normal sysclean
386 make normal_conf
387 make AP_BUILD_TYPE=normal sys
388 make AP_BUILD_TYPE=normal rootfs
389 make AP_BUILD_TYPE=normal copybin
390
391normal2:
392 make AP_BUILD_TYPE=normal sys
393 make AP_BUILD_TYPE=normal rootfs
394 make AP_BUILD_TYPE=normal copybin
395
396normalclean:
397 -make AP_BUILD_TYPE=normal sysclean
398 make normal_conf
399 make AP_BUILD_TYPE=normal sysclean
400
401cap:
402 make AP_BUILD_TYPE=cap sysclean
403 make cap_conf
404 make AP_BUILD_TYPE=cap sysclean
405 make cap_conf
406 make capuserdata
407 make AP_BUILD_TYPE=cap sys
408 make AP_BUILD_TYPE=cap rootfs
409 make AP_BUILD_TYPE=cap copybin
410
411cap2:
412 make AP_BUILD_TYPE=cap sys
413 make AP_BUILD_TYPE=cap rootfs
414 make AP_BUILD_TYPE=cap copybin
415
416capclean:
417 make AP_BUILD_TYPE=cap sysclean
418 make cap_conf
419 make AP_BUILD_TYPE=cap sysclean
420
421recovery_conf:
422 @cp -v $(PRJ_CONF_DIR)/recovery/config.linux $(LINUX_DIR)/arch/arm/configs/zte_defconfig
423 make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) zte_defconfig
424 $(BUILD_DIR)/config_check.sh $(PRJ_CONF_DIR)/recovery/config.linux $(LINUX_DIR)/.config
425 mkdir -p $(OUTPUT_DIR)
426ifeq ($(USE_RECOVERYFS),yes)
427 @cp -v $(PRJ_CONF_DIR)/recovery/config.busybox $(APP_DIR)/busybox/src/configs/zte_defconfig
428ifeq ($(LIBC_TYPE),uClibc)
429 @cp -v $(PRJ_CONF_DIR)/recovery/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config
430endif
431 @cp -v $(PRJ_CONF_DIR)/recovery/config_lib.mk $(LIB_DIR)/config_lib.mk
432 @cp -v $(PRJ_CONF_DIR)/recovery/config_app.mk $(APP_DIR)/config_app.mk
433 mkdir -p $(OUTPUT_DIR)/recoveryfs
434 ln -s $(RECOVERYFS_DIR) $(ROOTFS_DIR)
435endif
436 echo "AP_BUILD_TYPE = recovery" > $(OUTPUT_DIR)/sys_type.mk
437 echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk
438
439recovery:
440ifeq ($(USE_RECOVERYFS),yes)
441 make AP_BUILD_TYPE=recovery sysclean
442 make recovery_conf
443 make AP_BUILD_TYPE=recovery sysclean
444 make recovery_conf
445 make AP_BUILD_TYPE=recovery sys
446 make AP_BUILD_TYPE=recovery rootfs
447else
448 make kerneldistclean
449 make recovery_conf
450 make kerneldistclean
451 make recovery_conf
452 make kernel
453endif
454 make AP_BUILD_TYPE=recovery copybin
455
456recovery2:
457ifeq ($(USE_RECOVERYFS),yes)
458 make AP_BUILD_TYPE=recovery sys
459 make AP_BUILD_TYPE=recovery rootfs
460else
461 make kernel
462endif
463 make AP_BUILD_TYPE=recovery copybin
464
465recoveryclean:
466ifeq ($(USE_RECOVERYFS),yes)
467 -make AP_BUILD_TYPE=recovery sysclean
468 make recovery_conf
469 make AP_BUILD_TYPE=recovery sysclean
470else
471 make kerneldistclean
472 make recovery_conf
473 make kerneldistclean
474endif
475
476
477rootfs:
478ifeq ($(AP_BUILD_TYPE),)
479 $(error AP_BUILD_TYPE is NULL)
480endif
481ifeq ($(AP_BUILD_TYPE),normal)
482 make normal_rootfs
483endif
484ifeq ($(AP_BUILD_TYPE),cap)
485 make cap_rootfs
486endif
487ifeq ($(USE_RECOVERYFS),yes)
488ifeq ($(AP_BUILD_TYPE),recovery)
489 make recovery_rootfs
490endif
491endif
492
493copybin:
494ifeq ($(AP_BUILD_TYPE),)
495 $(error AP_BUILD_TYPE is NULL)
496endif
497ifeq ($(AP_BUILD_TYPE),normal)
498 make normal_copybin
499endif
500ifeq ($(AP_BUILD_TYPE),recovery)
501 make recovery_copybin
502endif
503ifeq ($(AP_BUILD_TYPE),cap)
504 make cap_copybin
505endif
506
507normal_rootfs: normal_check
508 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs
509 rm -fr $(ROOTFS_DIR)/etc_rw
510 cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/rootfs/* $(ROOTFS_DIR)/
511 cp -v $(PRJ_BIN_DIR)/allbins/ap_userdata.img $(ROOTFS_DIR)/etc_ro/
512 @cd $(BUILD_DIR); bash ./install_libc.sh $(ROOTFS_DIR)
513 @cd $(BUILD_DIR); bash ./fix_userdata_link.sh $(ROOTFS_DIR)
514 @cd $(BUILD_DIR); bash ./check_file_mode.sh $(ROOTFS_DIR)
515 find $(ROOTFS_DIR)/ -name '.gitkeep' -print0 | xargs -0 rm -fr
516 find $(ROOTFS_DIR)/ -name '.git' -print0 | xargs -0 rm -fr
517 find $(ROOTFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr
518 find $(ROOTFS_DIR)/ -name '.svn' -print0 | xargs -0 rm -fr
519ifneq ($(USE_FOTA),yes)
520 rm -fr $(ROOTFS_DIR)/recovery
521else
522ifeq ($(USE_FOTA_AB),yes)
523 rm -fr $(ROOTFS_DIR)/recovery
524endif
525endif
526
527ifeq ($(ROOT_FS_TYPE),ubifs)
528 bash $(BUILD_DIR)/ubifs.sh rootfs $(ROOTFS_SIZE) $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img
529else
530ifeq ($(ROOT_FS_TYPE),jffs2)
531ifeq ($(PRJ_IS_MIN),yes)
532 bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzma
533else
534 bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzo
535endif
536else
537ifeq ($(ROOT_FS_TYPE),squashfs)
538 bash $(BUILD_DIR)/squashfs.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img
539endif
540endif
541endif
542 (cd $(ROOTFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../rootfs_attr.txt)
543 (cd $(ROOTFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt)
544 (cd $(ROOTFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt)
545 (cd $(ROOTFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/rootfs.tgz rootfs rootfs_attr.txt)
546 @rm $(ROOTFS_DIR)/../rootfs_attr.txt
547
548recovery_rootfs: recovery_check
549 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs
550 rm -fr $(RECOVERYFS_DIR)/etc_rw $(RECOVERYFS_DIR)/recovery
551 cp -afvp $(PRJ_PRODUCT_DIR)/fs/recovery/rootfs/* $(RECOVERYFS_DIR)/
552 @cd $(BUILD_DIR); bash ./install_libc.sh $(RECOVERYFS_DIR)
553 @cd $(BUILD_DIR); bash ./fix_userdata_link.sh $(RECOVERYFS_DIR)
554 @cd $(BUILD_DIR); bash ./check_file_mode.sh $(RECOVERYFS_DIR)
555 find $(RECOVERYFS_DIR)/ -name '.gitkeep' -print0 | xargs -0 rm -fr
556 find $(RECOVERYFS_DIR)/ -name '.git' -print0 | xargs -0 rm -fr
557 find $(RECOVERYFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr
558 find $(RECOVERYFS_DIR)/ -name '.svn' -print0 | xargs -0 rm -fr
559
560ifeq ($(ROOT_FS_TYPE),ubifs)
561 bash $(BUILD_DIR)/ubifs.sh recoveryfs $(RECOVERYFS_SIZE) $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img
562else
563ifeq ($(ROOT_FS_TYPE),jffs2)
564ifeq ($(PRJ_IS_MIN),yes)
565 bash $(BUILD_DIR)/jffs2_lzma.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img lzma
566else
567 bash $(BUILD_DIR)/jffs2_lzma.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img lzo
568endif
569else
570ifeq ($(ROOT_FS_TYPE),squashfs)
571 bash $(BUILD_DIR)/squashfs.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img
572endif
573endif
574endif
575 (cd $(RECOVERYFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../recoveryfs_attr.txt)
576 (cd $(RECOVERYFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../recoveryfs_attr.txt)
577 (cd $(RECOVERYFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../recoveryfs_attr.txt)
578 (cd $(RECOVERYFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/recoveryfs.tgz recoveryfs recoveryfs_attr.txt)
579 @rm $(RECOVERYFS_DIR)/../recoveryfs_attr.txt
580
581cap_rootfs:
582 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs
583 rm -fr $(CAP_ROOTFS_DIR)/etc_rw
584 cp -afvp $(PRJ_PRODUCT_DIR)/fs/cap/rootfs/* $(CAP_ROOTFS_DIR)/
585 cp -v $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img $(CAP_ROOTFS_DIR)/etc_ro/
586 chmod -R a+r $(CAP_ROOTFS_DIR)/etc_ro
587 find $(CAP_ROOTFS_DIR)/bin -type f | xargs chmod a+x
588 -find $(CAP_ROOTFS_DIR)/sbin -type f | xargs chmod a+x
589 chmod a+x $(CAP_ROOTFS_DIR)/etc/rc
590 @cd $(BUILD_DIR); bash ./install_libc.sh $(CAP_ROOTFS_DIR)
591 find $(CAP_ROOTFS_DIR)/ -name '.gitkeep' -print0 | xargs -0 rm -fr
592 find $(CAP_ROOTFS_DIR)/ -name '.git' -print0 | xargs -0 rm -fr
593 find $(CAP_ROOTFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr
594 find $(CAP_ROOTFS_DIR)/ -name '.svn' -print0 | xargs -0 rm -fr
595
596ifeq ($(ROOT_FS_TYPE),ubifs)
597 bash $(BUILD_DIR)/ubifs.sh rootfs $(CAP_ROOTFS_SIZE) $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img
598else
599ifeq ($(ROOT_FS_TYPE),jffs2)
600ifeq ($(PRJ_IS_MIN),yes)
601 bash $(BUILD_DIR)/jffs2_lzma.sh $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img lzma
602else
603 bash $(BUILD_DIR)/jffs2_lzma.sh $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img lzo
604endif
605endif
606endif
607
608 (cd $(CAP_ROOTFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../caprootfs_attr.txt)
609 (cd $(CAP_ROOTFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../caprootfs_attr.txt)
610 (cd $(CAP_ROOTFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../caprootfs_attr.txt)
611 (cd $(CAP_ROOTFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/caprootfs.tgz caprootfs caprootfs_attr.txt)
612 @rm $(CAP_ROOTFS_DIR)/../caprootfs_attr.txt
613
614imagefs:
615 mkdir -p $(IMAGEFS_DIR)
616 rm -frv $(IMAGEFS_DIR)/*
617 cp -v $(PRJ_BIN_DIR)/allbins/evb_cpuphy.bin $(IMAGEFS_DIR)/
618ifeq ($(LARGEFILE_SPLIT_ENABLE),yes)
619 (cd $(IMAGEFS_DIR) && split -b $(SPLIT_BLOCK_SIZE) evb_cpuphy.bin -d -a 2 cpuphy_)
620 (cd $(IMAGEFS_DIR) && ls -1 cpuphy_* | xargs -I {} minilzma -t $(LZMA_DICT) {})
621 rm -fv $(IMAGEFS_DIR)/evb_cpuphy.bin
622endif
623 cp -v $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(IMAGEFS_DIR)/
624ifeq ($(BUILD_CAP),yes)
625 cp -v $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin $(IMAGEFS_DIR)/
626ifeq ($(LARGEFILE_SPLIT_ENABLE),yes)
627 (cd $(IMAGEFS_DIR) && split -b $(SPLIT_BLOCK_SIZE) ap_cpucap.bin -d -a 2 cpucap_)
628 (cd $(IMAGEFS_DIR) && ls -1 cpucap_* | xargs -I {} minilzma -t $(LZMA_DICT) {})
629 rm -fv $(IMAGEFS_DIR)/ap_cpucap.bin
630endif
631endif
632
633ifeq ($(LARGEFILE_SPLIT_ENABLE),yes)
634 (cd $(IMAGEFS_DIR) && split -b $(SPLIT_BLOCK_SIZE) ap_cpuap.bin -d -a 2 cpuap_)
635 (cd $(IMAGEFS_DIR) && ls -1 cpuap_* | xargs -I {} minilzma -t $(LZMA_DICT) {})
636 rm -fv $(IMAGEFS_DIR)/ap_cpuap.bin
637endif
638ifeq ($(USE_FOTA),yes)
639ifneq ($(USE_FOTA_AB),yes)
640 cp -v $(PRJ_BIN_DIR)/allbins/ap_recovery.bin $(IMAGEFS_DIR)/
641ifeq ($(LARGEFILE_SPLIT_ENABLE),yes)
642 (cd $(IMAGEFS_DIR) && split -b $(SPLIT_BLOCK_SIZE) ap_recovery.bin -d -a 2 recovery_)
643 (cd $(IMAGEFS_DIR) && ls -1 recovery_* | xargs -I {} minilzma -t $(LZMA_DICT) {})
644 rm -fv $(IMAGEFS_DIR)/ap_recovery.bin
645endif
646endif
647endif
648 cp -v $(PRJ_BIN_DIR)/allbins/evb_cpurpm.img $(IMAGEFS_DIR)/
649 cp -v $(PRJ_BIN_DIR)/allbins/nvrwoall.bin $(IMAGEFS_DIR)/
650 cp -v $(PRJ_BIN_DIR)/allbins/nvrwall.bin $(IMAGEFS_DIR)/
651 md5sum $(IMAGEFS_DIR)/nvrwall.bin | awk '{printf $$1}' > $(IMAGEFS_DIR)/nvrwall.hash
652ifeq ($(USE_FOTA),yes)
653ifneq ($(USE_FOTA_AB),yes)
654 dd if=/dev/zero bs=1024 count=1 2> /dev/null | tr \\000 \\377 > $(IMAGEFS_DIR)/fotaflag
655endif
656endif
657 #minilzma -t $(LZMA_DICT) $(IMAGEFS_DIR)/nvrwall.bin
658ifeq ($(PRJ_IS_MIN),yes)
659 bash $(BUILD_DIR)/jffs2_lzma.sh $(IMAGEFS_DIR) $(IMAGE_DIR)/ap_imagefs.img lzma
660else
661 bash $(BUILD_DIR)/jffs2_lzma.sh $(IMAGEFS_DIR) $(IMAGE_DIR)/ap_imagefs.img lzo
662endif
663 cp -v $(IMAGE_DIR)/ap_imagefs.img $(PRJ_BIN_DIR)/allbins/
664
665 (cd $(IMAGEFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../imagefs_attr.txt)
666 (cd $(IMAGEFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../imagefs_attr.txt)
667 (cd $(IMAGEFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../imagefs_attr.txt)
668 (cd $(IMAGEFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/imagefs.tgz imagefs imagefs_attr.txt)
669 @rm $(IMAGEFS_DIR)/../imagefs_attr.txt
670
671nvrofs:
672 mkdir -p $(NVROFS_DIR)
673 cp -v $(PRJ_BIN_DIR)/allbins/nvroall.bin $(NVROFS_DIR)/
674ifeq ($(PRJ_IS_MIN),yes)
675 bash $(BUILD_DIR)/jffs2_lzma.sh $(NVROFS_DIR) $(IMAGE_DIR)/ap_nvrofs.img lzma
676else
677 bash $(BUILD_DIR)/jffs2_lzma.sh $(NVROFS_DIR) $(IMAGE_DIR)/ap_nvrofs.img lzo
678endif
679 cp -v $(IMAGE_DIR)/ap_nvrofs.img $(PRJ_BIN_DIR)/allbins/
680
681normal_copybin: normal_check
682 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/normalelfs
683 cp -v $(IMAGE_DIR)/rootfs.img $(PRJ_BIN_DIR)/allbins/ap_rootfs.img
684ifeq ($(CONFIG_SIGN_IMAGE),yes)
685 chmod a+x $(SIGN)
686 @$(SIGN) -s $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(PRIVATE_KEY_PATH)
687else
688 @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin
689endif
690 cp -v $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/elfs/
691 cp -v $(IMAGE_DIR)/System.map $(PRJ_BIN_DIR)/elfs/
692 mkdir -p $(PRJ_BIN_DIR)/test_tools/
693 cp -afvp $(APP_DIR)/test_tools/* $(PRJ_BIN_DIR)/test_tools/
694 find $(PRJ_BIN_DIR)/test_tools/ -type f -size +512k -exec ${STRIPTOOL} '{}' ';'
695
696 find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
697 find $(LIB_DIR)/ -name "l*.so*" -type f ! -path "*/.libs/*" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
698 find $(STAGEDIR)/libc/lib -type f -name "*.so*" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
699 find $(LINUX_DIR) -type f -name "*.ko" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
700
701cap_copybin:
702 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/capelfs
703 cp -v $(IMAGE_DIR)/ap_caprootfs.img $(PRJ_BIN_DIR)/allbins/
704ifeq ($(CONFIG_SIGN_IMAGE),yes)
705 chmod a+x $(SIGN)
706 @$(SIGN) -s $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin $(PRIVATE_KEY_PATH)
707else
708 @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin
709endif
710 cp -v $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/elfs/vmlinux_cap
711 cp -v $(IMAGE_DIR)/System.map $(PRJ_BIN_DIR)/elfs/System_cap.map
712 mkdir -p $(PRJ_BIN_DIR)/test_tools/
713 cp -afvp $(APP_DIR)/test_tools/* $(PRJ_BIN_DIR)/test_tools/
714 find $(PRJ_BIN_DIR)/test_tools/ -type f -size +512k -exec ${STRIPTOOL} '{}' ';'
715
716 find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/capelfs \;
717 find $(LIB_DIR)/ -type f -name "lib*.so" -exec cp {} $(PRJ_BIN_DIR)/elfs/capelfs \;
718 find $(STAGEDIR)/libc/lib -type f -name "*.so" -exec cp {} $(PRJ_BIN_DIR)/elfs/capelfs \;
719 find $(LINUX_DIR) -type f -name "*.ko" -exec cp {} $(PRJ_BIN_DIR)/elfs/capelfs \;
720
721recovery_copybin: recovery_check
722 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/recoveryelfs
723ifeq ($(USE_RECOVERYFS),yes)
724 cp -v $(IMAGE_DIR)/recoveryfs.img $(PRJ_BIN_DIR)/allbins/ap_recoveryfs.img
725endif
726ifeq ($(CONFIG_SIGN_IMAGE),yes)
727 chmod a+x $(SIGN)
728 @$(SIGN) -s $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_recovery.bin $(PRIVATE_KEY_PATH)
729else
730 @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_recovery.bin
731endif
732 cp -v $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/elfs/vmlinux.recovery
733 cp -v $(IMAGE_DIR)/System.map $(PRJ_BIN_DIR)/elfs/System.map.recovery
734ifeq ($(USE_RECOVERYFS),yes)
735 find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/recoveryelfs \;
736 find $(LIB_DIR)/ -name "l*.so*" -type f ! -path "*/.libs/*" -exec cp {} $(PRJ_BIN_DIR)/elfs/recoveryelfs \;
737 find $(STAGEDIR)/libc/lib -type f -name "*.so*" -exec cp {} $(PRJ_BIN_DIR)/elfs/recoveryelfs \;
738 find $(LINUX_DIR) -type f -name "*.ko" -exec cp {} $(PRJ_BIN_DIR)/elfs/recoveryelfs \;
739endif
740
741section_bin:
742 echo $(CROSS_COMPILE)
743 echo $(UIMAGE_LOADADDR)
744 rm -frv $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin
745 rm -frv $(PRJ_BIN_DIR)/allbins/modem_code.bin
746 rm -frv $(ROOTFS_DIR)/bin/modem_code.bin
747 $(CROSS_COMPILE)objcopy -O binary -j .modem.text $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/allbins/modem_code.bin
748 $(CROSS_COMPILE)objcopy -O binary -R .modem.text $(IMAGE_DIR)/vmlinux $(PRJ_BIN_DIR)/allbins/ap_tmp.bin
749 ./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
750 @$(SIGN) -s $(PRJ_BIN_DIR)/allbins/uap_tmp.bin $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(PRIVATE_KEY_PATH)
751 cp -v $(PRJ_BIN_DIR)/allbins/modem_code.bin $(ROOTFS_DIR)/bin/
752 rm -frv $(PRJ_BIN_DIR)/allbins/uap_tmp.bin
753 rm -frv $(PRJ_BIN_DIR)/allbins/ap_tmp.bin
754
755obfu:
756 bash $(BUILD_DIR)/obfu.sh