blob: c0a819bf9e942e6e2ef14ecfa6dac08ad3e26891 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001
2include $(COMMON_BASE_MK)
3
4NAME=busybox
5SRC_DIR=$(APP_DIR)/$(NAME)/src
6INSTALL_DIR=$(APP_DIR)/$(NAME)/install
7BUILD_DIR=$(APP_DIR)/$(NAME)/build
8GEN_MAKEFILE=$(BUILD_DIR)/Makefile
9INSTALLER=$(SRC_DIR)/install-romfs.sh
10TARGETDIR=$(ROOTFS_DIR)
11
12all: $(GEN_MAKEFILE)
13 make -C $(SRC_DIR) O=$(BUILD_DIR) all
14 cp -v $(BUILD_DIR)/busybox_unstripped $(BUILD_DIR)/busybox_unstripped.elf
15
16$(GEN_MAKEFILE):
17 mkdir -p $(BUILD_DIR)
18 make -C $(SRC_DIR) O=$(BUILD_DIR) zte_defconfig
19
20clean:
21 -rm -fr $(BUILD_DIR) $(INSTALL_DIR)
22
23$(BUILD_DIR)/busybox.links:
24 make -C $(SRC_DIR) O=$(BUILD_DIR) busybox.links
25
26# Before copying, remove all existing busybox links
27romfs: $(INSTALLER) $(BUILD_DIR)/busybox.links
28 mkdir -p $(TARGETDIR)/bin $(TARGETDIR)/etc
29 if [ -f "$(TARGETDIR)/bin/busybox" ]; then \
30 inode=`ls -i $(TARGETDIR)/bin/busybox | awk '{print $$1}'`; \
31 ls -iL "$(TARGETDIR)/bin" | grep "^ *$$inode" | awk '{print $$2}' | \
32 sed "s:^:$(TARGETDIR)/bin/:" | env -i xargs rm -f; \
33 fi
34 $(ROMFSINST) $(BUILD_DIR)/busybox /bin/busybox
35 bash $(INSTALLER) $(TARGETDIR) $(BUILD_DIR)/busybox.links