summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorJiyong Park2018-06-01 05:26:42 -0500
committerJiyong Park2018-06-09 18:32:33 -0500
commit787322c55f997c1ab88f01f031e189d8fbb3378b (patch)
treefa9ebc61d3d8690a0ea3d3069312ba697a2f8c55 /init
parent011ee12b1def041d71621da7740bf5784a5e6488 (diff)
downloadplatform-system-core-787322c55f997c1ab88f01f031e189d8fbb3378b.tar.gz
platform-system-core-787322c55f997c1ab88f01f031e189d8fbb3378b.tar.xz
platform-system-core-787322c55f997c1ab88f01f031e189d8fbb3378b.zip
Build init with shared libraries
recovery partition now supports shared librarys. Therefore, init can now be built as a dynamic executable both for normal and recovery modes. To save save in the recovery mode, not all libs are dynamically linked. Libs that are only used by init in the recovery mode are still statically linked. Note: init is still a static executable for legacy devices where system-as-root is not on, because the dynamic linker and shared libs which are in /system are not available when init starts. Bug: 63673171 Test: `adb reboot recovery; adb devices` shows the device ID Test: device boots to the UI in normal mode. Test: do that for both walleye (system-as-root) and bullhead (legacy ramdisk). Change-Id: I30c84ae6a8e507e507ad0bb71acad281316d9e90
Diffstat (limited to 'init')
-rw-r--r--init/Android.bp22
-rw-r--r--init/Android.mk30
2 files changed, 31 insertions, 21 deletions
diff --git a/init/Android.bp b/init/Android.bp
index 25877c083..7d863c884 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -67,24 +67,26 @@ cc_defaults {
67 "libsquashfs_utils", 67 "libsquashfs_utils",
68 "liblogwrap", 68 "liblogwrap",
69 "libext4_utils", 69 "libext4_utils",
70 "libcutils",
71 "libbase",
72 "libc",
73 "libseccomp_policy", 70 "libseccomp_policy",
74 "libselinux",
75 "liblog",
76 "libcrypto_utils", 71 "libcrypto_utils",
77 "libcrypto",
78 "libc++_static",
79 "libdl",
80 "libsparse", 72 "libsparse",
81 "libz",
82 "libprocessgroup", 73 "libprocessgroup",
83 "libavb", 74 "libavb",
84 "libkeyutils", 75 "libkeyutils",
85 "libprotobuf-cpp-lite", 76 "libprotobuf-cpp-lite",
86 "libpropertyinfoserializer", 77 "libpropertyinfoserializer",
87 "libpropertyinfoparser", 78 "libpropertyinfoparser",
79 "libselinux",
80 ],
81 shared_libs: [
82 "libcutils",
83 "libbase",
84 "libc",
85 "liblog",
86 "libcrypto",
87 "libc++",
88 "libdl",
89 "libz",
88 ], 90 ],
89} 91}
90 92
@@ -166,7 +168,6 @@ cc_binary {
166cc_test { 168cc_test {
167 name: "init_tests", 169 name: "init_tests",
168 defaults: ["init_defaults"], 170 defaults: ["init_defaults"],
169 static_executable: true,
170 srcs: [ 171 srcs: [
171 "devices_test.cpp", 172 "devices_test.cpp",
172 "init_test.cpp", 173 "init_test.cpp",
@@ -187,7 +188,6 @@ cc_test {
187 188
188cc_benchmark { 189cc_benchmark {
189 name: "init_benchmarks", 190 name: "init_benchmarks",
190 static_executable: true,
191 defaults: ["init_defaults"], 191 defaults: ["init_defaults"],
192 srcs: [ 192 srcs: [
193 "subcontext_benchmark.cpp", 193 "subcontext_benchmark.cpp",
diff --git a/init/Android.mk b/init/Android.mk
index c4a6a50e5..da27a73f4 100644
--- a/init/Android.mk
+++ b/init/Android.mk
@@ -45,7 +45,6 @@ LOCAL_SRC_FILES := main.cpp
45 45
46LOCAL_MODULE:= init 46LOCAL_MODULE:= init
47 47
48LOCAL_FORCE_STATIC_EXECUTABLE := true
49LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 48LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
50LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) 49LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
51 50
@@ -59,18 +58,10 @@ LOCAL_STATIC_LIBRARIES := \
59 libsquashfs_utils \ 58 libsquashfs_utils \
60 liblogwrap \ 59 liblogwrap \
61 libext4_utils \ 60 libext4_utils \
62 libcutils \
63 libbase \
64 libc \
65 libseccomp_policy \ 61 libseccomp_policy \
66 libselinux \
67 liblog \
68 libcrypto_utils \ 62 libcrypto_utils \
69 libcrypto \
70 libc++_static \
71 libdl \
72 libsparse \ 63 libsparse \
73 libz \ 64 libselinux \
74 libprocessgroup \ 65 libprocessgroup \
75 libavb \ 66 libavb \
76 libkeyutils \ 67 libkeyutils \
@@ -78,6 +69,25 @@ LOCAL_STATIC_LIBRARIES := \
78 libpropertyinfoserializer \ 69 libpropertyinfoserializer \
79 libpropertyinfoparser \ 70 libpropertyinfoparser \
80 71
72shared_libs := \
73 libcutils \
74 libbase \
75 liblog \
76 libcrypto \
77 libdl \
78 libz \
79
80ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
81# init is static executable for non-system-as-root devices, because the dynamic linker
82# and shared libs are not available before /system is mounted, but init has to run
83# before the partition is mounted.
84LOCAL_STATIC_LIBRARIES += $(shared_libs) libc++_static
85LOCAL_FORCE_STATIC_EXECUTABLE := true
86else
87LOCAL_SHARED_LIBRARIES := $(shared_libs) libc++
88endif
89shared_libs :=
90
81LOCAL_REQUIRED_MODULES := \ 91LOCAL_REQUIRED_MODULES := \
82 e2fsdroid \ 92 e2fsdroid \
83 mke2fs \ 93 mke2fs \