Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 2 | BB_PATH := $(LOCAL_PATH) |
Koushik Dutta | 129a798 | 2011-11-16 18:27:02 -0800 | [diff] [blame] | 3 | |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 4 | # Bionic Branches Switches (CM7/AOSP/ICS) |
| 5 | BIONIC_ICS := true |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 6 | |
Tanguy Pruvot | 29d8ebe | 2011-10-29 15:15:34 +0200 | [diff] [blame] | 7 | |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 8 | # Make a static library for regex. |
| 9 | include $(CLEAR_VARS) |
| 10 | LOCAL_SRC_FILES := android/regex/regex.c |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 11 | LOCAL_C_INCLUDES := $(BB_PATH)/android/regex |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 12 | LOCAL_MODULE := libclearsilverregex |
| 13 | include $(BUILD_STATIC_LIBRARY) |
| 14 | |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 15 | # Make a static library for RPC library (coming from uClibc). |
| 16 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 17 | LOCAL_SRC_FILES := $(shell cat $(BB_PATH)/android/librpc.sources) |
| 18 | LOCAL_C_INCLUDES := $(BB_PATH)/android/librpc |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 19 | LOCAL_MODULE := libuclibcrpc |
| 20 | include $(BUILD_STATIC_LIBRARY) |
| 21 | |
Tanguy Pruvot | 29d8ebe | 2011-10-29 15:15:34 +0200 | [diff] [blame] | 22 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 23 | LOCAL_PATH := $(BB_PATH) |
| 24 | include $(CLEAR_VARS) |
| 25 | |
| 26 | # Each profile require a compressed usage/config, outside the source tree for git history |
| 27 | # We keep the uncompressed headers in local include-<profile> to track config changes. |
| 28 | |
| 29 | BB_INCLUDES_OUT := $(TARGET_OUT_INTERMEDIATES)/include |
| 30 | $(BB_INCLUDES_OUT): |
| 31 | mkdir -p $(ANDROID_BUILD_TOP)/$(BB_INCLUDES_OUT) |
| 32 | |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 33 | # Execute make clean, make prepare and copy profiles required for normal & static busybox (recovery) |
| 34 | |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 35 | KERNEL_MODULES_DIR ?= /system/lib/modules |
| 36 | BUSYBOX_CONFIG := minimal full |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 37 | $(BUSYBOX_CONFIG): |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 38 | @echo -e ${CL_PFX}"prepare config for busybox $@ profile"${CL_RST} |
| 39 | @cd $(BB_PATH) && make clean |
| 40 | @cd $(BB_PATH) && git clean -f -- ./include-$@/ |
| 41 | cp $(BB_PATH)/.config-$@ $(BB_PATH)/.config |
| 42 | cd $(BB_PATH) && make prepare |
| 43 | @#cp $(BB_PATH)/.config $(BB_PATH)/.config-$@ |
| 44 | @mkdir -p $(BB_PATH)/include-$@ |
| 45 | cp $(BB_PATH)/include/*.h $(BB_PATH)/include-$@/ |
| 46 | @mkdir -p $(BB_INCLUDES_OUT)/busybox-$@ |
| 47 | @cp $(BB_PATH)/include/*.h $(BB_INCLUDES_OUT)/busybox-$@/ |
| 48 | @rm $(BB_PATH)/include/usage_compressed.h |
| 49 | @rm $(BB_PATH)/include/autoconf.h |
| 50 | @rm -f $(BB_PATH)/.config-old |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 51 | |
| 52 | busybox_prepare: $(BUSYBOX_CONFIG) |
| 53 | LOCAL_MODULE := busybox_prepare |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 54 | LOCAL_MODULE_TAGS := eng debug |
Tanguy Pruvot | b2ccaf3 | 2011-07-05 18:22:26 +0200 | [diff] [blame] | 55 | include $(BUILD_STATIC_LIBRARY) |
| 56 | |
| 57 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 58 | LOCAL_PATH := $(BB_PATH) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 59 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 60 | |
Tanguy Pruvot | eba4519 | 2011-07-15 20:38:12 +0200 | [diff] [blame] | 61 | KERNEL_MODULES_DIR ?= /system/lib/modules |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 62 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 63 | SUBMAKE := make -s -C $(BB_PATH) CC=$(CC) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 64 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 65 | BUSYBOX_SRC_FILES = $(shell cat $(BB_PATH)/busybox-$(BUSYBOX_CONFIG).sources) \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 66 | libbb/android.c |
| 67 | |
| 68 | ifeq ($(TARGET_ARCH),arm) |
| 69 | BUSYBOX_SRC_FILES += \ |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 70 | android/libc/arch-arm/syscalls/adjtimex.S \ |
| 71 | android/libc/arch-arm/syscalls/getsid.S \ |
| 72 | android/libc/arch-arm/syscalls/stime.S \ |
| 73 | android/libc/arch-arm/syscalls/swapon.S \ |
| 74 | android/libc/arch-arm/syscalls/swapoff.S \ |
| 75 | android/libc/arch-arm/syscalls/sysinfo.S |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 76 | endif |
| 77 | |
Rocky Zhang | 8f997da | 2011-10-03 21:11:37 +0800 | [diff] [blame] | 78 | ifeq ($(TARGET_ARCH),mips) |
| 79 | BUSYBOX_SRC_FILES += \ |
| 80 | android/libc/arch-mips/syscalls/adjtimex.S \ |
| 81 | android/libc/arch-mips/syscalls/getsid.S \ |
| 82 | android/libc/arch-mips/syscalls/stime.S \ |
| 83 | android/libc/arch-mips/syscalls/swapon.S \ |
| 84 | android/libc/arch-mips/syscalls/swapoff.S \ |
| 85 | android/libc/arch-mips/syscalls/sysinfo.S |
| 86 | endif |
| 87 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 88 | BUSYBOX_C_INCLUDES = \ |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 89 | $(BB_INCLUDES_OUT)/busybox-$(BUSYBOX_CONFIG) \ |
| 90 | $(BB_PATH)/include-$(BUSYBOX_CONFIG) \ |
| 91 | $(BB_PATH)/include $(BB_PATH)/libbb \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 92 | bionic/libc/private \ |
| 93 | bionic/libm/include \ |
| 94 | bionic/libm \ |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 95 | libc/kernel/common \ |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 96 | $(BB_PATH)/android/regex \ |
| 97 | $(BB_PATH)/android/librpc |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 98 | |
| 99 | BUSYBOX_CFLAGS = \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 100 | -Werror=implicit \ |
| 101 | -DNDEBUG \ |
Tanguy Pruvot | c81b2cf | 2011-07-04 10:18:25 +0200 | [diff] [blame] | 102 | -DANDROID \ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 103 | -include include-$(BUSYBOX_CONFIG)/autoconf.h \ |
| 104 | -D'CONFIG_DEFAULT_MODULES_DIR="$(KERNEL_MODULES_DIR)"' \ |
| 105 | -D'BB_VER="$(strip $(shell $(SUBMAKE) kernelversion)) $(BUSYBOX_SUFFIX)"' -DBB_BT=AUTOCONF_TIMESTAMP |
| 106 | |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 107 | # to handle differences in ICS (ipv6) |
| 108 | ifeq ($(BIONIC_ICS),true) |
| 109 | BUSYBOX_CFLAGS += -DBIONIC_ICS |
| 110 | endif |
Tanguy Pruvot | 64baaf5 | 2011-07-04 09:41:45 +0200 | [diff] [blame] | 111 | |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 112 | |
| 113 | # Build the static lib for the recovery tool |
| 114 | |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 115 | BUSYBOX_CONFIG:=minimal |
| 116 | BUSYBOX_SUFFIX:=static |
| 117 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) |
| 118 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 119 | LOCAL_CFLAGS := -Dmain=busybox_driver $(BUSYBOX_CFLAGS) |
| 120 | LOCAL_CFLAGS += \ |
| 121 | -Dgetusershell=busybox_getusershell \ |
| 122 | -Dsetusershell=busybox_setusershell \ |
| 123 | -Dendusershell=busybox_endusershell \ |
| 124 | -Dttyname_r=busybox_ttyname_r \ |
| 125 | -Dgetmntent=busybox_getmntent \ |
| 126 | -Dgetmntent_r=busybox_getmntent_r \ |
| 127 | -Dgenerate_uuid=busybox_generate_uuid |
| 128 | LOCAL_MODULE := libbusybox |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 129 | LOCAL_MODULE_TAGS := eng debug |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 130 | LOCAL_STATIC_LIBRARIES := libcutils libc libm |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 131 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | d0fce6d | 2011-07-04 04:46:06 +0200 | [diff] [blame] | 132 | include $(BUILD_STATIC_LIBRARY) |
| 133 | |
| 134 | |
| 135 | # Bionic Busybox /system/xbin |
| 136 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 137 | LOCAL_PATH := $(BB_PATH) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 138 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 139 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 140 | BUSYBOX_CONFIG:=full |
| 141 | BUSYBOX_SUFFIX:=bionic |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 142 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) |
| 143 | ifeq ($(BIONIC_ICS),true) |
| 144 | LOCAL_SRC_FILES += android/libc/__set_errno.c |
| 145 | endif |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 146 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 147 | LOCAL_CFLAGS := $(BUSYBOX_CFLAGS) |
| 148 | LOCAL_MODULE := busybox |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 149 | LOCAL_MODULE_TAGS := eng debug |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 150 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) |
Tanguy Pruvot | 36efc94 | 2011-11-20 14:41:41 +0100 | [diff] [blame] | 151 | LOCAL_SHARED_LIBRARIES := libc libcutils libm |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 152 | LOCAL_STATIC_LIBRARIES := libclearsilverregex libuclibcrpc |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 153 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 154 | include $(BUILD_EXECUTABLE) |
| 155 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 156 | BUSYBOX_LINKS := $(shell cat $(BB_PATH)/busybox-$(BUSYBOX_CONFIG).links) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 157 | # nc is provided by external/netcat |
| 158 | exclude := nc |
| 159 | SYMLINKS := $(addprefix $(TARGET_OUT_OPTIONAL_EXECUTABLES)/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS)))) |
| 160 | $(SYMLINKS): BUSYBOX_BINARY := $(LOCAL_MODULE) |
| 161 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) |
| 162 | @echo "Symlink: $@ -> $(BUSYBOX_BINARY)" |
| 163 | @mkdir -p $(dir $@) |
| 164 | @rm -rf $@ |
| 165 | $(hide) ln -sf $(BUSYBOX_BINARY) $@ |
| 166 | |
| 167 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 168 | |
| 169 | # We need this so that the installed files could be picked up based on the |
| 170 | # local module name |
| 171 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 172 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |
| 173 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 174 | |
codeworkx | 258ba0c | 2011-09-08 21:25:43 +0200 | [diff] [blame] | 175 | # Static Busybox |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 176 | |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 177 | LOCAL_PATH := $(BB_PATH) |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 178 | include $(CLEAR_VARS) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 179 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 180 | BUSYBOX_CONFIG:=full |
| 181 | BUSYBOX_SUFFIX:=static |
| 182 | LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES) |
| 183 | LOCAL_C_INCLUDES := $(BUSYBOX_C_INCLUDES) |
| 184 | LOCAL_CFLAGS := $(BUSYBOX_CFLAGS) |
| 185 | LOCAL_CFLAGS += \ |
| 186 | -Dgetusershell=busybox_getusershell \ |
| 187 | -Dsetusershell=busybox_setusershell \ |
| 188 | -Dendusershell=busybox_endusershell \ |
| 189 | -Dttyname_r=busybox_ttyname_r \ |
| 190 | -Dgetmntent=busybox_getmntent \ |
| 191 | -Dgetmntent_r=busybox_getmntent_r \ |
| 192 | -Dgenerate_uuid=busybox_generate_uuid |
| 193 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 194 | LOCAL_MODULE := static_busybox |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame^] | 195 | LOCAL_MODULE_STEM := busybox |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 196 | LOCAL_MODULE_TAGS := optional |
Patrick Schaaf | 2dd59ef | 2012-02-27 22:27:31 +0100 | [diff] [blame] | 197 | LOCAL_STATIC_LIBRARIES := libclearsilverregex libc libcutils libm libuclibcrpc |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 198 | LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES |
codeworkx | 258ba0c | 2011-09-08 21:25:43 +0200 | [diff] [blame] | 199 | LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 200 | LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities |
Tanguy Pruvot | 985c411 | 2011-10-10 21:28:29 +0200 | [diff] [blame] | 201 | $(LOCAL_MODULE): busybox_prepare |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 202 | include $(BUILD_EXECUTABLE) |