diff options
author | Jaesoo Lee <jaesoo@google.com> | 2017-03-03 13:07:39 +0900 |
---|---|---|
committer | Jaesoo Lee <jaesoo@google.com> | 2017-03-15 11:07:02 +0900 |
commit | 95a47feaf39ce17847247d4876a7ab88706b64b9 (patch) | |
tree | 7307f20470dcdfae4fc2274859a8130ea5f327d5 | |
parent | 180f3c7f4bef0a64f86df0569ab85af664b7da7a (diff) | |
download | android_external_toybox-95a47feaf39ce17847247d4876a7ab88706b64b9.tar.gz android_external_toybox-95a47feaf39ce17847247d4876a7ab88706b64b9.tar.bz2 android_external_toybox-95a47feaf39ce17847247d4876a7ab88706b64b9.zip |
added a new build module for statically linked toybox (toybox_static)
In order to enable modprobe in recovery mode (for Treble), this change
add a target for building statically linked toybox (toybox_static). The
binary is installed in /sbin of root file system along with symbolic
link to it for 'modprobe'.
Bug: 35633646
Test: Build and tested it works in recovery
Change-Id: I589c4a248e135c6c0e25aadd063717c87369ef40
-rw-r--r-- | Android.mk | 47 |
1 files changed, 42 insertions, 5 deletions
@@ -44,9 +44,7 @@ LOCAL_PATH := $(call my-dir) # # If you just want to use it as "toybox x" rather than "x", you can stop now. # # If you want this toy to have a symbolic link in /system/bin, add the toy to ALL_TOOLS. -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ +common_SRC_FILES := \ lib/args.c \ lib/dirtree.c \ lib/getmountlist.c \ @@ -210,7 +208,7 @@ LOCAL_SRC_FILES := \ toys/posix/wc.c \ toys/posix/xargs.c \ -LOCAL_CFLAGS += \ +common_CFLAGS := \ -std=c99 \ -Os \ -Wno-char-subscripts \ @@ -226,7 +224,16 @@ toybox_upstream_version := $(shell awk 'match($$0, /TOYBOX_VERSION.*"(.*)"/, ary toybox_sha := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null) toybox_version := $(toybox_upstream_version)-$(toybox_sha)-android -LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"' + +common_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"' + +############################################ +# toybox for /system +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(common_SRC_FILES) + +LOCAL_CFLAGS := $(common_CFLAGS) LOCAL_CLANG := true @@ -395,3 +402,33 @@ ALL_TOOLS := \ LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);) include $(BUILD_EXECUTABLE) + +############################################ +# static version to be installed in recovery + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(common_SRC_FILES) + +LOCAL_CFLAGS := $(common_CFLAGS) + +LOCAL_CLANG := true + +LOCAL_STATIC_LIBRARIES := liblog libcutils libselinux libcrypto libm libc + +# libc++_static is needed by static liblog +LOCAL_CXX_STL := libc++_static + +LOCAL_MODULE := toybox_static + +LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/sbin + +LOCAL_FORCE_STATIC_EXECUTABLE := true + +ALL_TOOLS := \ + modprobe \ + +# Install the symlinks. +LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf ${LOCAL_MODULE} $(LOCAL_MODULE_PATH)/$(t);) + +include $(BUILD_EXECUTABLE) |