blob: 167ceb1e19b285363319dd879d11a97af87acbd7 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001
2include $(ZTE_PS_LINK_SCRIPT)
3-include $(OUTPUT_DIR)/sys_type.mk
4
5.PHONY: help all allclean app appclean lib libclean check
6
7help: check
8 @echo "=========================Make help start========================="
9 @echo "make [help] this help"
10 @echo "make all[clean] compile all, include recovery and normal system"
11 @echo "make normal[clean] compile normal system,include kernel uClibc lib and app"
12 @echo "make normal2 continue to compile normal system"
13 @echo "make normal_rootfs make rootfs for normal system"
14 @echo "make normal_copybin copy bins to project for normal system"
15 @echo "make rootfs make rootfs for normal or recovery automatically based on config"
16 @echo "make copybin copy bins to project for normal or recovery automatically based on config"
17 @echo "make lib[clean] compile lib"
18 @echo "make app[clean] compile app"
19 @echo "=========================Make help end========================="
20
21check:
22ifeq ($(PRJ_NAME),)
23 $(error ONLY execute the make command in the project/CHIP_NAME/prj_xxx/build directory)
24endif
25 bash $(BUILD_DIR)/env_check.sh
26
27normal_check:
28ifneq ($(AP_BUILD_TYPE),normal)
29 $(error current config is not normal,make normal first)
30endif
31
32all:
33 make AP_BUILD_TYPE=normal normal
34
35allclean: normalclean
36
37sys: check
38 make lib
39 make app
40 @echo "all modules build done"
41
42sysclean: check
43 make libclean
44 make appclean
45 -@rm -fr $(OUTPUT_DIR)
46 @echo "all modules clean done"
47
48app:
49 mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin
50 make -C app
51
52appclean:
53 make -C app clean
54
55lib:
56 mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin
57 make -C lib
58
59libclean:
60 make -C lib clean
61
62normal_conf:
63 mkdir -p $(OUTPUT_DIR)
64 mkdir -p $(IMAGE_DIR)
65 echo "AP_BUILD_TYPE = normal" > $(OUTPUT_DIR)/sys_type.mk
66 echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk
67
68normal:
69 make AP_BUILD_TYPE=normal sysclean
70 make AP_BUILD_TYPE=normal normal_conf
71 make AP_BUILD_TYPE=normal sys
72 make AP_BUILD_TYPE=normal normal_rootfs
73 make AP_BUILD_TYPE=normal normal_copybin
74
75normal2: sys normal_rootfs normal_copybin
76
77normalclean:
78 -make AP_BUILD_TYPE=normal sysclean
79 make normal_conf
80 make AP_BUILD_TYPE=normal sysclean
81
82rootfs:
83 make normal_rootfs
84
85copybin:
86
87 make normal_copybin
88
89normal_rootfs: normal_check
90 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs
91 rm -fr $(ROOTFS_DIR)/etc_rw
92 cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/rootfs/* $(ROOTFS_DIR)/
93 #cp -v $(PRJ_BIN_DIR)/allbins/ap_userdata.img $(ROOTFS_DIR)/etc_ro/
94 chmod -R a+r $(ROOTFS_DIR)/etc_ro
95 #find $(ROOTFS_DIR)/bin -type f | xargs chmod a+x
96 #-find $(ROOTFS_DIR)/sbin -type f | xargs chmod a+x
97 chmod a+x $(ROOTFS_DIR)/etc/rc
98 #@cd $(BUILD_DIR); bash ./install_libc.sh $(ROOTFS_DIR)
99 find $(ROOTFS_DIR)/ -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
100 find $(ROOTFS_DIR)/ -type d -name '.git' -print0 | xargs -0 rm -fr
101 find $(ROOTFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr
102
103ifeq ($(ROOT_FS_TYPE),ubifs)
104 bash $(BUILD_DIR)/ubifs.sh rootfs $(ROOTFS_SIZE) $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img
105else
106ifeq ($(ROOT_FS_TYPE),jffs2)
107ifeq ($(PRJ_IS_MIN),yes)
108 bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzma
109else
110 bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzo
111endif
112endif
113endif
114
115 (cd $(ROOTFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../rootfs_attr.txt)
116 (cd $(ROOTFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt)
117 (cd $(ROOTFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt)
118 (cd $(ROOTFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/rootfs.tgz rootfs rootfs_attr.txt)
119 @rm $(ROOTFS_DIR)/../rootfs_attr.txt
120
121normal_copybin: normal_check
122 mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/normalelfs
123 cp -v $(IMAGE_DIR)/rootfs.img $(PRJ_BIN_DIR)/allbins/ap_rootfs.img
124 find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
xf.libdd93d52023-05-12 07:10:14 -0700125 find $(LIB_DIR)/ -name "l*.so*" -type f ! -path "*/.libs/*" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
126 find $(STAGEDIR)/libc/lib -type f -name "*.so*" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;