lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | |
| 2 | include $(COMMON_BASE_MK) |
| 3 | |
| 4 | NAME=busybox |
| 5 | SRC_DIR=$(APP_DIR)/$(NAME)/src |
| 6 | INSTALL_DIR=$(APP_DIR)/$(NAME)/install |
| 7 | BUILD_DIR=$(APP_DIR)/$(NAME)/build |
| 8 | GEN_MAKEFILE=$(BUILD_DIR)/Makefile |
| 9 | INSTALLER=$(SRC_DIR)/install-romfs.sh |
| 10 | TARGETDIR=$(ROOTFS_DIR) |
| 11 | |
| 12 | all: $(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 | |
| 20 | clean: |
| 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 |
| 27 | romfs: $(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 |