Skip to content

Commit

Permalink
build: AOSP/CM14 fixes (API 24/25, mainly BusyBox-less environment)
Browse files Browse the repository at this point in the history
These changes are needed by any ROM where devices are configured to
use TOOLBOX/TOYBOX instead of BUSYBOX (i.e., TW_USE_TOOLBOX := true).

Change-Id: I68b88cc9fb857f32864556c4b6c9c8e6ee744051
  • Loading branch information
Hashcode authored and airend committed Jan 12, 2017
1 parent 7dde36d commit 5733215
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ LOCAL_SRC_FILES := \
asn1_decoder.cpp \
verifier.cpp \
ui.cpp
LOCAL_STATIC_LIBRARIES := libcrypto
LOCAL_STATIC_LIBRARIES := libcrypto_static
include $(BUILD_STATIC_LIBRARY)

commands_recovery_local_path := $(LOCAL_PATH)
Expand Down
2 changes: 1 addition & 1 deletion prebuilt/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ifneq ($(TW_USE_TOOLBOX), true)
else
RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/sh
RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so
ifneq (,$(filter $(PLATFORM_SDK_VERSION), 23))
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 23; echo $$?),0)
RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/toybox
ifneq ($(wildcard external/zip/Android.mk),)
RELINK_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/zip
Expand Down
21 changes: 12 additions & 9 deletions toolbox/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,29 @@ ifeq ($(TW_USE_TOOLBOX), true)
du \

OUR_TOOLS := \
df \
iftop \
ioctl \
ionice \
log \
ls \
lsof \
mount \
nandread \
newfs_msdos \
ps \
prlimit \
renice \
sendevent \
start \
stop \
top \
uptime \
watchprops \

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 25; echo $$?),0)
OUR_TOOLS += \
df \
ionice \
ls \
lsof \
mount \
renice \
uptime \
watchprops
endif
else
ifneq (,$(filter $(PLATFORM_SDK_VERSION), 21 22))
OUR_TOOLS += \
Expand Down Expand Up @@ -217,7 +220,7 @@ ifneq (,$(filter $(PLATFORM_SDK_VERSION), 21 22 23))
LOCAL_WHOLE_STATIC_LIBRARIES := $(patsubst %,libtoolbox_%,$(BSD_TOOLS))
endif

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0)
ifneq (,$(filter $(PLATFORM_SDK_VERSION), 23 24))
# Rule to make getprop and setprop in M trees where toybox normally
# provides these tools. Toybox does not allow for easy dynamic
# configuration, so we would have to include the entire toybox binary
Expand Down
157 changes: 147 additions & 10 deletions toybox/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ LOCAL_SRC_FILES := \
toys/other/freeramdisk.c \
toys/other/fsfreeze.c \
toys/other/help.c \
toys/other/ifconfig.c \
toys/other/inotifyd.c \
toys/other/insmod.c \
toys/other/losetup.c \
Expand All @@ -106,7 +105,6 @@ LOCAL_SRC_FILES := \
toys/other/modinfo.c \
toys/other/mountpoint.c \
toys/other/nbd_client.c \
toys/other/netcat.c \
toys/other/partprobe.c \
toys/other/pivot_root.c \
toys/other/pmap.c \
Expand All @@ -115,13 +113,11 @@ LOCAL_SRC_FILES := \
toys/other/readlink.c \
toys/other/realpath.c \
toys/other/rev.c \
toys/other/rfkill.c \
toys/other/rmmod.c \
toys/other/setsid.c \
toys/other/stat.c \
toys/other/swapoff.c \
toys/other/swapon.c \
toys/other/switch_root.c \
toys/other/sysctl.c \
toys/other/tac.c \
toys/other/taskset.c \
Expand All @@ -134,13 +130,9 @@ LOCAL_SRC_FILES := \
toys/other/yes.c \
toys/pending/dd.c \
toys/pending/expr.c \
toys/pending/hwclock.c \
toys/pending/more.c \
toys/pending/pgrep.c \
toys/pending/netstat.c \
toys/pending/route.c \
toys/pending/tar.c \
toys/pending/top.c \
toys/pending/tr.c \
toys/pending/traceroute.c \
toys/posix/basename.c \
Expand Down Expand Up @@ -196,7 +188,77 @@ LOCAL_SRC_FILES := \
toys/posix/uname.c \
toys/posix/uniq.c \
toys/posix/wc.c \
toys/posix/xargs.c \
toys/posix/xargs.c

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 24; echo $$?),0)
# there are some conflicts here with AOSP-7.1 and CM-14.1
# the following items have been removed for compatibility
# ifconfig, netcat, netstat, rfkill, switch_root
LOCAL_STATIC_LIBRARIES := libcrypto_static

LOCAL_C_INCLUDES += \
external/boringssl/include \
bionic/libc/dns/include

LOCAL_SRC_FILES += \
lib/linestack.c \
lib/password.c \
toys/other/flock.c \
toys/other/hwclock.c \
toys/other/ionice.c \
toys/other/lspci.c \
toys/other/readahead.c \
toys/other/reset.c \
toys/other/uptime.c \
toys/other/xxd.c \
toys/pending/arp.c \
toys/pending/diff.c \
toys/pending/ftpget.c \
toys/pending/lsof.c \
toys/pending/telnet.c \
toys/pending/test.c \
toys/pending/watch.c \
toys/pending/xzcat.c \
toys/posix/ps.c \
toys/posix/ulimit.c

# Account for master branch changes pulld into CM14.1
ifneq ($(CM_BUILD),)
LOCAL_SRC_FILES += \
toys/android/log.c \
toys/android/sendevent.c \
toys/android/start.c \
toys/net/ifconfig.c \
toys/net/netcat.c \
toys/net/netstat.c \
toys/net/rfkill.c \
toys/net/tunctl.c \
toys/other/setfattr.c \
toys/pending/chrt.c \
toys/pending/fdisk.c \
toys/pending/getfattr.c \
toys/pending/host.c \
toys/pending/resize.c \
toys/posix/file.c
else
LOCAL_SRC_FILES += \
toys/other/ifconfig.c \
toys/other/netcat.c \
toys/other/rfkill.c \
toys/other/switch_root.c \
toys/pending/netstat.c
endif
else
LOCAL_SRC_FILES += \
toys/other/ifconfig.c \
toys/other/netcat.c \
toys/other/rfkill.c \
toys/other/switch_root.c \
toys/pending/hwclock.c \
toys/pending/netstat.c \
toys/pending/pgrep.c \
toys/pending/top.c
endif

LOCAL_CFLAGS += \
-std=c99 \
Expand Down Expand Up @@ -344,7 +406,82 @@ ALL_TOOLS := \
which \
whoami \
xargs \
yes \
yes

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 24; echo $$?),0)
ALL_TOOLS += \
arp \
base64 \
chattr \
dd \
df \
diff \
du \
egrep \
fgrep \
flock \
freeramdisk \
fsfreeze \
fstype \
ftpget \
ftpput \
grep \
help \
install \
ionice \
iorenice \
iotop \
killall \
ls \
lsattr \
lsof \
lspci \
makedevs \
mkfifo \
mount \
nbd-client \
nc \
netcat \
nproc \
partprobe \
pivot_root \
ps \
pwdx \
readahead \
renice \
reset \
rev \
rfkill \
sha224sum \
sha256sum \
sha384sum \
sha512sum \
telnet \
test \
top \
traceroute \
traceroute6 \
tty \
tunctl \
ulimit \
uptime \
vconfig \
watch \
xxd \
xzcat
# Account for master branch changes pulld into CM14.1
ifneq ($(CM_BUILD),)
ALL_TOOLS += \
chrt \
fdisk \
file \
getfattr \
host \
log \
resize \
setfattr
endif
endif

# Install the symlinks.
LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_RECOVERY_ROOT_OUT)/sbin/$(t);)
Expand Down

0 comments on commit 5733215

Please sign in to comment.