lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | |
| 2 | include $(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 | |
| 8 | help: 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" |
| 27 | ifeq ($(CONFIG_SINGLECORE),yes) |
| 28 | @echo "make ps[clean] compile libps" |
| 29 | endif |
| 30 | @echo "=========================Make help end=========================" |
| 31 | |
| 32 | check: |
| 33 | ifeq ($(PRJ_NAME),) |
| 34 | $(error ONLY execute the make command in the project/CHIP_NAME/prj_xxx/build directory) |
| 35 | endif |
| 36 | bash $(BUILD_DIR)/env_check.sh |
| 37 | |
| 38 | normal_check: |
| 39 | ifneq ($(AP_BUILD_TYPE),normal) |
| 40 | $(error current config is not normal,make normal first) |
| 41 | endif |
| 42 | |
| 43 | recovery_check: |
| 44 | ifneq ($(AP_BUILD_TYPE),recovery) |
| 45 | $(error current config is not recovery,make recovery first) |
| 46 | endif |
| 47 | |
| 48 | copy: |
| 49 | @bash $(BUILD_DIR)/modcopy.sh |
| 50 | |
| 51 | all: |
| 52 | ifeq ($(USE_FOTA),yes) |
| 53 | ifneq ($(USE_FOTA_AB),yes) |
| 54 | make recovery |
| 55 | endif |
| 56 | endif |
| 57 | ifeq ($(BUILD_CAP),yes) |
| 58 | make cap |
| 59 | endif |
| 60 | make normal |
| 61 | |
| 62 | allclean: normalclean |
| 63 | |
| 64 | sys: check |
| 65 | ifeq ($(CONFIG_SINGLECORE),yes) |
| 66 | ifeq ($(AP_BUILD_TYPE),normal) |
| 67 | make ps |
| 68 | endif |
| 69 | endif |
| 70 | make kernel |
| 71 | ifeq ($(CONFIG_SINGLECORE),yes) |
| 72 | ifeq ($(AP_BUILD_TYPE),normal) |
| 73 | ifeq ($(USE_CPPS_KO),yes) |
| 74 | make cpko |
| 75 | endif |
| 76 | endif |
| 77 | endif |
| 78 | make libc |
| 79 | make lib |
| 80 | make app |
| 81 | @echo "all modules build done" |
| 82 | |
| 83 | sysclean: check |
| 84 | ifeq ($(CONFIG_SINGLECORE),yes) |
| 85 | ifeq ($(AP_BUILD_TYPE),normal) |
| 86 | make psclean |
| 87 | endif |
| 88 | endif |
| 89 | make kerneldistclean |
| 90 | ifeq ($(CONFIG_SINGLECORE),yes) |
| 91 | ifeq ($(AP_BUILD_TYPE),normal) |
| 92 | ifeq ($(USE_CPPS_KO),yes) |
| 93 | make cpkoclean |
| 94 | endif |
| 95 | endif |
| 96 | endif |
| 97 | make libcclean |
| 98 | -make libclean |
| 99 | -make appclean |
| 100 | -@rm -fr $(OUTPUT_DIR) $(STAGEDIR) |
| 101 | @echo "all modules clean done" |
| 102 | |
| 103 | ps: |
| 104 | mkdir -p $(LIBPS_PATH) |
| 105 | ifeq ($(CONFIG_SINGLECORE),yes) |
| 106 | make -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) prepare |
| 107 | ifneq ($(MK_SDK_VERSION),yes) |
| 108 | (cd $(PS_BUILD_DIR) && bash $(LIBPS_BUILD_SHELL) all) |
| 109 | else |
| 110 | (cd $(PS_BUILD_DIR) && bash $(LIBPS_BUILD_SHELL) sdk) |
| 111 | endif |
| 112 | else |
| 113 | $(error libps in NOT on AP) |
| 114 | endif |
| 115 | |
| 116 | psclean: |
| 117 | ifeq ($(CONFIG_SINGLECORE),yes) |
| 118 | ifneq ($(MK_SDK_VERSION),yes) |
| 119 | (cd $(PS_BUILD_DIR) && bash $(LIBPS_BUILD_SHELL) allclean) |
| 120 | -rm -fr $(LIBPS_PATH)/* |
| 121 | else |
| 122 | (cd $(PS_BUILD_DIR) && bash $(LIBPS_BUILD_SHELL) sdkclean) |
| 123 | endif |
| 124 | else |
| 125 | $(error libps in NOT on AP) |
| 126 | endif |
| 127 | |
| 128 | kernel: |
| 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 |
| 134 | ifeq ($(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 |
| 137 | endif |
| 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 | |
| 147 | kernelclean: |
| 148 | make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) clean |
| 149 | @echo "kernel clean done" |
| 150 | |
| 151 | kernel2: |
| 152 | make kernel |
| 153 | ifeq ($(CONFIG_SINGLECORE),yes) |
| 154 | ifeq ($(AP_BUILD_TYPE),normal) |
| 155 | ifeq ($(USE_CPPS_KO),yes) |
| 156 | make cpkoclean cpko |
| 157 | endif |
| 158 | endif |
| 159 | endif |
| 160 | make rootfs |
| 161 | make copybin |
| 162 | |
| 163 | kerneldistclean: |
| 164 | make ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) distclean |
| 165 | -rm -f $(LINUX_DIR)/include/linux/autoconf.h |
| 166 | |
| 167 | kernel_menuconfig: |
| 168 | make ARCH=arm -C $(LINUX_DIR) menuconfig |
| 169 | |
| 170 | kernellink: |
| 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 |
| 175 | ifeq ($(CONFIG_SIGN_IMAGE),yes) |
| 176 | chmod a+x $(SIGN) |
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 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) |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 182 | else |
| 183 | @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin |
| 184 | endif |
| 185 | |
| 186 | busybox_menuconfig: |
| 187 | ifeq ($(AP_BUILD_TYPE),normal) |
| 188 | make -C $(APP_DIR)/busybox/src O=$(APP_DIR)/busybox/build menuconfig |
| 189 | else |
| 190 | make -C $(APP_DIR)/busybox/src O=$(APP_DIR)/busybox_recovery/build menuconfig |
| 191 | endif |
| 192 | |
| 193 | cpko: |
| 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) |
| 196 | ifeq ($(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) |
| 198 | else |
| 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) |
| 200 | endif |
| 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) |
| 202 | ifeq ($(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) |
| 204 | else |
| 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) |
| 207 | endif |
| 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 | |
| 217 | ifeq ($(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 |
| 229 | endif |
| 230 | ifeq ($(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 |
| 235 | endif |
| 236 | |
| 237 | cpkoclean: |
| 238 | make V=1 -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_DIR) M=drivers/cpko clean |
| 239 | |
| 240 | app: |
| 241 | mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin |
| 242 | make -C app |
| 243 | |
| 244 | appclean: |
| 245 | make -C app clean |
| 246 | |
| 247 | lib: |
| 248 | mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin |
| 249 | make -C lib |
| 250 | |
| 251 | libclean: |
| 252 | make -C lib clean |
| 253 | |
| 254 | populate_sdk: |
| 255 | make -C lib populate_sdk |
| 256 | |
| 257 | libc: |
| 258 | make -C $(LIBC_DIR) |
| 259 | |
| 260 | libcclean: |
| 261 | make -C $(LIBC_DIR) clean |
| 262 | |
| 263 | normal_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 |
| 269 | ifeq ($(LIBC_TYPE),uClibc) |
| 270 | @cp -v $(PRJ_CONF_DIR)/normal/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config |
| 271 | endif |
| 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 | |
| 278 | cap_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 |
| 283 | ifeq ($(LIBC_TYPE),uClibc) |
| 284 | @cp -v $(PRJ_CONF_DIR)/cap/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config |
| 285 | endif |
| 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 | |
| 292 | userdata: |
| 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 |
| 299 | ifeq ($(USERDATA_FS_TYPE),ubifs) |
| 300 | bash $(BUILD_DIR)/ubifs.sh userdata $(USERDATA_SIZE) $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img |
| 301 | else |
| 302 | ifeq ($(PRJ_IS_MIN),yes) |
| 303 | bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img lzma |
| 304 | else |
| 305 | bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_userdata.img lzo |
| 306 | endif |
| 307 | endif |
| 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 | |
| 316 | capuserdata: |
| 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 |
| 324 | ifeq ($(USERDATA_FS_TYPE),ubifs) |
| 325 | bash $(BUILD_DIR)/ubifs.sh userdata $(CAP_USERDATA_SIZE) $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img |
| 326 | else |
| 327 | ifeq ($(PRJ_IS_MIN),yes) |
| 328 | bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img lzma |
| 329 | else |
| 330 | bash $(BUILD_DIR)/jffs2_lzma.sh $(USERDATA_DIR) $(PRJ_BIN_DIR)/allbins/ap_capuserdata.img lzo |
| 331 | endif |
| 332 | endif |
| 333 | @echo "=========> Make cap userdata FS Image End! <===================" |
| 334 | |
| 335 | resource: |
| 336 | ifneq ($(USE_RESOURCE),yes) |
| 337 | $(error NO USE_RESOURCE) |
| 338 | endif |
| 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 | |
| 350 | ifeq ($(PRJ_IS_MIN),yes) |
| 351 | bash $(BUILD_DIR)/jffs2_lzma.sh $(RESOURCE_DIR) $(PRJ_BIN_DIR)/allbins/ap_resource.img lzma |
| 352 | else |
| 353 | bash $(BUILD_DIR)/jffs2_lzma.sh $(RESOURCE_DIR) $(PRJ_BIN_DIR)/allbins/ap_resource.img lzo |
| 354 | endif |
| 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 | |
| 363 | oem_fs: |
| 364 | ifneq ($(USE_OEM_FS),yes) |
| 365 | $(error NO USE_OEM_FS) |
| 366 | endif |
| 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 |
| 372 | ifeq ($(PRJ_IS_MIN),yes) |
| 373 | bash $(BUILD_DIR)/jffs2_lzma.sh $(OEM_FS_DIR) $(PRJ_BIN_DIR)/allbins/ap_oem.img lzma |
| 374 | else |
| 375 | bash $(BUILD_DIR)/jffs2_lzma.sh $(OEM_FS_DIR) $(PRJ_BIN_DIR)/allbins/ap_oem.img lzo |
| 376 | endif |
| 377 | @echo "=========> Make oem FS Image End! <===================" |
| 378 | |
| 379 | normal: |
| 380 | make AP_BUILD_TYPE=normal sysclean |
| 381 | make userdata |
| 382 | ifeq ($(USE_RESOURCE),yes) |
| 383 | make resource |
| 384 | endif |
| 385 | ifeq ($(USE_OEM_FS),yes) |
| 386 | make oem_fs |
| 387 | endif |
| 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 | |
| 395 | normal2: |
| 396 | make AP_BUILD_TYPE=normal sys |
| 397 | make AP_BUILD_TYPE=normal rootfs |
| 398 | make AP_BUILD_TYPE=normal copybin |
| 399 | |
| 400 | normalclean: |
| 401 | -make AP_BUILD_TYPE=normal sysclean |
| 402 | make normal_conf |
| 403 | make AP_BUILD_TYPE=normal sysclean |
| 404 | |
| 405 | cap: |
| 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 | |
| 415 | cap2: |
| 416 | make AP_BUILD_TYPE=cap sys |
| 417 | make AP_BUILD_TYPE=cap rootfs |
| 418 | make AP_BUILD_TYPE=cap copybin |
| 419 | |
| 420 | capclean: |
| 421 | make AP_BUILD_TYPE=cap sysclean |
| 422 | make cap_conf |
| 423 | make AP_BUILD_TYPE=cap sysclean |
| 424 | |
| 425 | recovery_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) |
| 430 | ifeq ($(USE_RECOVERYFS),yes) |
| 431 | @cp -v $(PRJ_CONF_DIR)/recovery/config.busybox $(APP_DIR)/busybox/src/configs/zte_defconfig |
| 432 | ifeq ($(LIBC_TYPE),uClibc) |
| 433 | @cp -v $(PRJ_CONF_DIR)/recovery/config.uClibc $(LIBC_DIR)/$(LIBC_VERSION)/.config |
| 434 | endif |
| 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) |
| 439 | endif |
| 440 | echo "AP_BUILD_TYPE = recovery" > $(OUTPUT_DIR)/sys_type.mk |
| 441 | echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk |
| 442 | |
| 443 | recovery: |
| 444 | ifeq ($(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 |
| 451 | else |
| 452 | make kerneldistclean |
| 453 | make recovery_conf |
| 454 | make kerneldistclean |
| 455 | make recovery_conf |
| 456 | make kernel |
| 457 | endif |
| 458 | make AP_BUILD_TYPE=recovery copybin |
| 459 | |
| 460 | recovery2: |
| 461 | ifeq ($(USE_RECOVERYFS),yes) |
| 462 | make AP_BUILD_TYPE=recovery sys |
| 463 | make AP_BUILD_TYPE=recovery rootfs |
| 464 | else |
| 465 | make kernel |
| 466 | endif |
| 467 | make AP_BUILD_TYPE=recovery copybin |
| 468 | |
| 469 | recoveryclean: |
| 470 | ifeq ($(USE_RECOVERYFS),yes) |
| 471 | -make AP_BUILD_TYPE=recovery sysclean |
| 472 | make recovery_conf |
| 473 | make AP_BUILD_TYPE=recovery sysclean |
| 474 | else |
| 475 | make kerneldistclean |
| 476 | make recovery_conf |
| 477 | make kerneldistclean |
| 478 | endif |
| 479 | |
| 480 | |
| 481 | rootfs: |
| 482 | ifeq ($(AP_BUILD_TYPE),) |
| 483 | $(error AP_BUILD_TYPE is NULL) |
| 484 | endif |
| 485 | ifeq ($(AP_BUILD_TYPE),normal) |
| 486 | make normal_rootfs |
| 487 | endif |
| 488 | ifeq ($(AP_BUILD_TYPE),cap) |
| 489 | make cap_rootfs |
| 490 | endif |
| 491 | ifeq ($(USE_RECOVERYFS),yes) |
| 492 | ifeq ($(AP_BUILD_TYPE),recovery) |
| 493 | make recovery_rootfs |
| 494 | endif |
| 495 | endif |
| 496 | |
| 497 | copybin: |
| 498 | ifeq ($(AP_BUILD_TYPE),) |
| 499 | $(error AP_BUILD_TYPE is NULL) |
| 500 | endif |
| 501 | ifeq ($(AP_BUILD_TYPE),normal) |
| 502 | make normal_copybin |
| 503 | endif |
| 504 | ifeq ($(AP_BUILD_TYPE),recovery) |
| 505 | make recovery_copybin |
| 506 | endif |
| 507 | ifeq ($(AP_BUILD_TYPE),cap) |
| 508 | make cap_copybin |
| 509 | endif |
| 510 | |
| 511 | normal_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 |
| 523 | ifneq ($(USE_FOTA),yes) |
| 524 | rm -fr $(ROOTFS_DIR)/recovery |
| 525 | else |
| 526 | ifeq ($(USE_FOTA_AB),yes) |
| 527 | rm -fr $(ROOTFS_DIR)/recovery |
| 528 | endif |
| 529 | endif |
| 530 | |
| 531 | ifeq ($(ROOT_FS_TYPE),ubifs) |
| 532 | bash $(BUILD_DIR)/ubifs.sh rootfs $(ROOTFS_SIZE) $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img |
| 533 | else |
| 534 | ifeq ($(ROOT_FS_TYPE),jffs2) |
| 535 | ifeq ($(PRJ_IS_MIN),yes) |
| 536 | bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzma |
| 537 | else |
| 538 | bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzo |
| 539 | endif |
| 540 | else |
| 541 | ifeq ($(ROOT_FS_TYPE),squashfs) |
| 542 | bash $(BUILD_DIR)/squashfs.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img |
| 543 | endif |
| 544 | endif |
| 545 | endif |
| 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 | |
| 552 | recovery_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 | |
| 564 | ifeq ($(ROOT_FS_TYPE),ubifs) |
| 565 | bash $(BUILD_DIR)/ubifs.sh recoveryfs $(RECOVERYFS_SIZE) $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img |
| 566 | else |
| 567 | ifeq ($(ROOT_FS_TYPE),jffs2) |
| 568 | ifeq ($(PRJ_IS_MIN),yes) |
| 569 | bash $(BUILD_DIR)/jffs2_lzma.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img lzma |
| 570 | else |
| 571 | bash $(BUILD_DIR)/jffs2_lzma.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img lzo |
| 572 | endif |
| 573 | else |
| 574 | ifeq ($(ROOT_FS_TYPE),squashfs) |
| 575 | bash $(BUILD_DIR)/squashfs.sh $(RECOVERYFS_DIR) $(IMAGE_DIR)/recoveryfs.img |
| 576 | endif |
| 577 | endif |
| 578 | endif |
| 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 | |
| 585 | cap_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 | |
| 600 | ifeq ($(ROOT_FS_TYPE),ubifs) |
| 601 | bash $(BUILD_DIR)/ubifs.sh rootfs $(CAP_ROOTFS_SIZE) $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img |
| 602 | else |
| 603 | ifeq ($(ROOT_FS_TYPE),jffs2) |
| 604 | ifeq ($(PRJ_IS_MIN),yes) |
| 605 | bash $(BUILD_DIR)/jffs2_lzma.sh $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img lzma |
| 606 | else |
| 607 | bash $(BUILD_DIR)/jffs2_lzma.sh $(CAP_ROOTFS_DIR) $(IMAGE_DIR)/ap_caprootfs.img lzo |
| 608 | endif |
| 609 | endif |
| 610 | endif |
| 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 | |
| 618 | imagefs: |
| 619 | mkdir -p $(IMAGEFS_DIR) |
| 620 | rm -frv $(IMAGEFS_DIR)/* |
| 621 | cp -v $(PRJ_BIN_DIR)/allbins/evb_cpuphy.bin $(IMAGEFS_DIR)/ |
| 622 | ifeq ($(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 |
| 626 | endif |
| 627 | cp -v $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin $(IMAGEFS_DIR)/ |
| 628 | ifeq ($(BUILD_CAP),yes) |
| 629 | cp -v $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin $(IMAGEFS_DIR)/ |
| 630 | ifeq ($(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 |
| 634 | endif |
| 635 | endif |
| 636 | |
| 637 | ifeq ($(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 |
| 641 | endif |
| 642 | ifeq ($(USE_FOTA),yes) |
| 643 | ifneq ($(USE_FOTA_AB),yes) |
| 644 | cp -v $(PRJ_BIN_DIR)/allbins/ap_recovery.bin $(IMAGEFS_DIR)/ |
| 645 | ifeq ($(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 |
| 649 | endif |
| 650 | endif |
| 651 | endif |
| 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 |
| 656 | ifeq ($(USE_FOTA),yes) |
| 657 | ifneq ($(USE_FOTA_AB),yes) |
| 658 | dd if=/dev/zero bs=1024 count=1 2> /dev/null | tr \\000 \\377 > $(IMAGEFS_DIR)/fotaflag |
| 659 | endif |
| 660 | endif |
| 661 | #minilzma -t $(LZMA_DICT) $(IMAGEFS_DIR)/nvrwall.bin |
| 662 | ifeq ($(PRJ_IS_MIN),yes) |
| 663 | bash $(BUILD_DIR)/jffs2_lzma.sh $(IMAGEFS_DIR) $(IMAGE_DIR)/ap_imagefs.img lzma |
| 664 | else |
| 665 | bash $(BUILD_DIR)/jffs2_lzma.sh $(IMAGEFS_DIR) $(IMAGE_DIR)/ap_imagefs.img lzo |
| 666 | endif |
| 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 | |
| 675 | nvrofs: |
| 676 | mkdir -p $(NVROFS_DIR) |
| 677 | cp -v $(PRJ_BIN_DIR)/allbins/nvroall.bin $(NVROFS_DIR)/ |
| 678 | ifeq ($(PRJ_IS_MIN),yes) |
| 679 | bash $(BUILD_DIR)/jffs2_lzma.sh $(NVROFS_DIR) $(IMAGE_DIR)/ap_nvrofs.img lzma |
| 680 | else |
| 681 | bash $(BUILD_DIR)/jffs2_lzma.sh $(NVROFS_DIR) $(IMAGE_DIR)/ap_nvrofs.img lzo |
| 682 | endif |
| 683 | cp -v $(IMAGE_DIR)/ap_nvrofs.img $(PRJ_BIN_DIR)/allbins/ |
| 684 | |
| 685 | normal_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 |
| 688 | ifeq ($(CONFIG_SIGN_IMAGE),yes) |
| 689 | chmod a+x $(SIGN) |
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 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) |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 695 | else |
| 696 | @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin |
| 697 | endif |
| 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 | |
| 709 | cap_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/ |
| 712 | ifeq ($(CONFIG_SIGN_IMAGE),yes) |
| 713 | chmod a+x $(SIGN) |
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 714 | @$(SIGN) -i $(IMAGE_DIR)/linux_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin -k $(PRIVATE_KEY_PATH) |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 715 | else |
| 716 | @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_cpucap.bin |
| 717 | endif |
| 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 | |
| 729 | recovery_copybin: recovery_check |
| 730 | mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/recoveryelfs |
| 731 | ifeq ($(USE_RECOVERYFS),yes) |
| 732 | cp -v $(IMAGE_DIR)/recoveryfs.img $(PRJ_BIN_DIR)/allbins/ap_recoveryfs.img |
| 733 | endif |
| 734 | ifeq ($(CONFIG_SIGN_IMAGE),yes) |
| 735 | chmod a+x $(SIGN) |
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 736 | @$(SIGN) -i $(IMAGE_DIR)/linux_kernel.img -o $(PRJ_BIN_DIR)/allbins/ap_recovery.bin -k $(PRIVATE_KEY_PATH) |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 737 | else |
| 738 | @cp -v $(IMAGE_DIR)/linux_kernel.img $(PRJ_BIN_DIR)/allbins/ap_recovery.bin |
| 739 | endif |
| 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 |
| 742 | ifeq ($(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 \; |
| 747 | endif |
| 748 | |
| 749 | section_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 |
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 758 | @$(SIGN) -i $(PRJ_BIN_DIR)/allbins/uap_tmp.bin -o $(PRJ_BIN_DIR)/allbins/ap_cpuap.bin -k $(PRIVATE_KEY_PATH) |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 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 | |
| 763 | obfu: |
| 764 | bash $(BUILD_DIR)/obfu.sh |