From 57332151129716bf6edf2792226ae4f1622fa93b Mon Sep 17 00:00:00 2001 From: Hashcode Date: Tue, 20 Dec 2016 01:30:49 +0100 Subject: build: AOSP/CM14 fixes (API 24/25, mainly BusyBox-less environment) 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 --- Android.mk | 2 +- prebuilt/Android.mk | 2 +- toolbox/Android.mk | 21 ++++--- toybox/Android.mk | 157 ++++++++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 161 insertions(+), 21 deletions(-) diff --git a/Android.mk b/Android.mk index 971991845..d456bfc46 100644 --- a/Android.mk +++ b/Android.mk @@ -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) diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk index 3206346e0..0356197da 100644 --- a/prebuilt/Android.mk +++ b/prebuilt/Android.mk @@ -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 diff --git a/toolbox/Android.mk b/toolbox/Android.mk index 4c3e433c2..07e47389d 100644 --- a/toolbox/Android.mk +++ b/toolbox/Android.mk @@ -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 += \ @@ -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 diff --git a/toybox/Android.mk b/toybox/Android.mk index a879151fc..b34c2c301 100644 --- a/toybox/Android.mk +++ b/toybox/Android.mk @@ -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 \ @@ -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 \ @@ -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 \ @@ -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 \ @@ -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 \ @@ -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);) -- cgit v1.2.3