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