1 BUSYBOX_URL
=http
://busybox.net
/downloads
2 BUSYBOX_SOURCE
=busybox-1.1
.3.
tar.bz2
3 BUSYBOX_DIR
=$(BUILD_DIR
)/busybox
4 BUSYBOX_SRC_DIR
=$(BUSYBOX_DIR
)/busybox-1.1
.3
5 BUSYBOX_STAMP_DIR
=$(BUSYBOX_DIR
)/stamps
6 BUSYBOX_LOG_DIR
=$(BUSYBOX_DIR
)/logs
7 BUSYBOX_PATCHES
=$(PACKAGE_DIR
)/busybox
/testfix.patch
$(PACKAGE_DIR
)/busybox
/regex.patch
8 BUSYBOX_PATCHES
+= $(PACKAGE_DIR
)/busybox
/ipaddress.patch
10 ifeq ($(CONFIG_VERBOSE
),y
)
11 BUSYBOX_BUILD_LOG
=/dev
/stdout
12 BUSYBOX_INSTALL_LOG
=/dev
/stdout
14 BUSYBOX_BUILD_LOG
=$(BUSYBOX_LOG_DIR
)/build.log
15 BUSYBOX_INSTALL_LOG
=$(BUSYBOX_LOG_DIR
)/install.log
18 BUSYBOX_CONFIG ?
= defconfig
20 ifeq ($(findstring defconfig
,$(BUSYBOX_CONFIG
)),defconfig
)
21 ifeq ($(shell if
[ -f
$(PACKAGE_DIR
)/busybox
/conf
/customconfig--
$(PAYLOAD
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
) ]; then echo
1; fi
),1)
22 BUSYBOX_CONFIG
= customconfig--
$(PAYLOAD
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
)
26 $(SOURCE_DIR
)/$(BUSYBOX_SOURCE
):
27 @ echo
"Downloading busybox..."
28 @ mkdir
-p
$(SOURCE_DIR
)
29 @ wget
-P
$(SOURCE_DIR
) $(BUSYBOX_URL
)/$(BUSYBOX_SOURCE
)
31 $(BUSYBOX_STAMP_DIR
)/.unpacked
: $(SOURCE_DIR
)/$(BUSYBOX_SOURCE
) |
$(BUSYBOX_STAMP_DIR
) $(BUSYBOX_DIR
)
32 @ echo
"Unpacking busybox..."
33 @
tar -C
$(BUSYBOX_DIR
) -jxf
$(SOURCE_DIR
)/$(BUSYBOX_SOURCE
)
36 $(BUSYBOX_STAMP_DIR
)/.patched
: $(BUSYBOX_STAMP_DIR
)/.unpacked
37 @ echo
"Patching busybox..."
38 @
$(BIN_DIR
)/doquilt.sh
$(BUSYBOX_SRC_DIR
) $(BUSYBOX_PATCHES
)
41 $(BUSYBOX_SRC_DIR
)/.config
: $(BUSYBOX_STAMP_DIR
)/.patched
42 @ cp
-f
$(PACKAGE_DIR
)/busybox
/conf
/$(BUSYBOX_CONFIG
) $@
44 $(BUSYBOX_SRC_DIR
)/busybox
: $(BUSYBOX_SRC_DIR
)/.config |
$(BUSYBOX_LOG_DIR
)
45 @ echo
"Building busybox..."
46 ifneq ($(findstring defconfig
,$(BUSYBOX_CONFIG
)),defconfig
)
47 @ echo
"Using custom config $(PACKAGE_DIR)/busybox/conf/$(BUSYBOX_CONFIG)"
49 @
( unset CFLAGS
; unset LDFLAGS
; \
50 export EXTRA_CFLAGS
="$(CFLAGS)";\
51 export LDFLAGS
="$(LDFLAGS_orig)";\
52 $(MAKE
) -C
$(BUSYBOX_SRC_DIR
) VERBOSE
=y \
53 LIBRARIES
="$(LIBS)" all > $(BUSYBOX_BUILD_LOG
) 2>&1)
54 @ mkdir
-p
$(OUTPUT_DIR
)/config
/busybox
55 @ cp
$(BUSYBOX_SRC_DIR
)/.config
$(OUTPUT_DIR
)/config
/busybox
/
58 $(INITRD_DIR
)/bin
/busybox
: $(BUSYBOX_SRC_DIR
)/busybox |
$(BUSYBOX_LOG_DIR
)
59 @
$(MAKE
) -C
$(BUSYBOX_SRC_DIR
) \
60 PREFIX
=$(INITRD_DIR
) install > $(BUSYBOX_INSTALL_LOG
) 2>&1
62 $(BUSYBOX_STAMP_DIR
) $(BUSYBOX_LOG_DIR
) $(BUSYBOX_DIR
):
65 busybox
: $(INITRD_DIR
)/bin
/busybox
68 @ echo
"Cleaning busybox..."
69 ifneq ($(wildcard "$(BUSYBOX_SRC_DIR)/Makefile"),)
70 @
$(MAKE
) -C
$(BUSYBOX_SRC_DIR
) clean > /dev
/null
2>&1
74 @
rm -rf
$(BUSYBOX_DIR
)/*
77 @ echo
"Package: busybox"
78 @ echo
"Source: $(BUSYBOX_URL)/$(BUSYBOX_SOURCE)"
81 busybox-extract
: $(BUSYBOX_STAMP_DIR
)/.patched
83 busybox-config
: |
$(BUSYBOX_SRC_DIR
)/.config
84 ifeq ($(shell if
[ -f
$(PACKAGE_DIR
)/busybox
/conf
/customconfig--
$(PAYLOAD
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
) ]; then echo
1; fi
),1)
85 @ cp
-f
$(PACKAGE_DIR
)/busybox
/conf
/customconfig--
$(PAYLOAD
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
) $(BUSYBOX_SRC_DIR
)/.config
87 ifeq (busybox
,$(filter busybox
,$(PAYLOAD-y
)))
88 @ echo
"Configure busybox..."
89 @
$(MAKE
) -C
$(BUSYBOX_SRC_DIR
) menuconfig
91 ifeq ($(shell if
[ -f
$(PACKAGE_DIR
)/busybox
/conf
/customconfig--
$(PAYLOAD
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
) ]; then echo
1; fi
),1)
92 @ echo
"Found an existing custom configuration file:"
93 @ echo
" $(PACKAGE_DIR)/busybox/conf/customconfig--$(PAYLOAD)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD)"
94 @ echo
"I've copied it back to the source directory for modification."
95 @ echo
"Remove the above file and re-run this command if you want to create a new custom configuration from scratch for this payload/board."
98 @ cp
-f
$(BUSYBOX_SRC_DIR
)/.config
$(PACKAGE_DIR
)/busybox
/conf
/customconfig--
$(PAYLOAD
)--$(COREBOOT_VENDOR
)-$(COREBOOT_BOARD
)
99 @ echo
"Your custom busybox config file has been saved as $(PACKAGE_DIR)/busybox/conf/customconfig--$(PAYLOAD)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD)."
102 @ echo
"Your payload does not require busybox."