Shared libs are supported in recovery mode am: 011ee12b1d
am: 4ebda908de
Change-Id: I538e886d5a7b946ca2fea6dfad156bbbc8e485c2
This commit is contained in:
commit
058aa0c3e1
12 changed files with 61 additions and 9 deletions
|
|
@ -77,3 +77,4 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/vndksp.libraries.txt)
|
||||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/ld.config.txt)
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/ld.config.txt)
|
||||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/llndk.libraries.txt)
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/llndk.libraries.txt)
|
||||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/vndksp.libraries.txt)
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/vndksp.libraries.txt)
|
||||||
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/)
|
||||||
|
|
|
||||||
|
|
@ -302,8 +302,6 @@ cc_binary {
|
||||||
name: "adbd",
|
name: "adbd",
|
||||||
defaults: ["adb_defaults"],
|
defaults: ["adb_defaults"],
|
||||||
|
|
||||||
// adbd must be static, as it is copied into the recovery image.
|
|
||||||
static_executable: true,
|
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
|
|
||||||
srcs: [
|
srcs: [
|
||||||
|
|
@ -344,7 +342,6 @@ cc_binary {
|
||||||
"libselinux",
|
"libselinux",
|
||||||
"libsquashfs_utils",
|
"libsquashfs_utils",
|
||||||
"libqemu_pipe",
|
"libqemu_pipe",
|
||||||
"libdebuggerd_handler",
|
|
||||||
|
|
||||||
"libbase",
|
"libbase",
|
||||||
"libcutils",
|
"libcutils",
|
||||||
|
|
@ -371,6 +368,7 @@ cc_test {
|
||||||
"liblog",
|
"liblog",
|
||||||
"libusb",
|
"libusb",
|
||||||
"libmdnssd",
|
"libmdnssd",
|
||||||
|
"libselinux",
|
||||||
],
|
],
|
||||||
test_suites: ["device-tests"],
|
test_suites: ["device-tests"],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@
|
||||||
#include <scoped_minijail.h>
|
#include <scoped_minijail.h>
|
||||||
|
|
||||||
#include <private/android_filesystem_config.h>
|
#include <private/android_filesystem_config.h>
|
||||||
#include "debuggerd/handler.h"
|
|
||||||
#include "selinux/android.h"
|
#include "selinux/android.h"
|
||||||
|
|
||||||
#include "adb.h"
|
#include "adb.h"
|
||||||
|
|
@ -274,7 +273,6 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
close_stdin();
|
close_stdin();
|
||||||
|
|
||||||
debuggerd_init(nullptr);
|
|
||||||
adb_trace_init(argv);
|
adb_trace_init(argv);
|
||||||
|
|
||||||
D("Handling main()");
|
D("Handling main()");
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@
|
||||||
#include <android-base/properties.h>
|
#include <android-base/properties.h>
|
||||||
#include <android-base/stringprintf.h>
|
#include <android-base/stringprintf.h>
|
||||||
#include <private/android_logger.h>
|
#include <private/android_logger.h>
|
||||||
|
#include <selinux/android.h>
|
||||||
|
|
||||||
#include "adb.h"
|
#include "adb.h"
|
||||||
#include "adb_io.h"
|
#include "adb_io.h"
|
||||||
|
|
@ -343,6 +344,24 @@ bool Subprocess::ForkAndExec(std::string* error) {
|
||||||
adb_write(oom_score_adj_fd, oom_score_adj_value, strlen(oom_score_adj_value)));
|
adb_write(oom_score_adj_fd, oom_score_adj_value, strlen(oom_score_adj_value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __ANDROID_RECOVERY__
|
||||||
|
// Special routine for recovery. Switch to shell domain when adbd is
|
||||||
|
// is running with dropped privileged (i.e. not running as root) and
|
||||||
|
// is built for the recovery mode. This is required because recovery
|
||||||
|
// rootfs is not labeled and everything is labeled just as rootfs.
|
||||||
|
char* con = nullptr;
|
||||||
|
if (getcon(&con) == 0) {
|
||||||
|
if (!strcmp(con, "u:r:adbd:s0")) {
|
||||||
|
if (selinux_android_setcon("u:r:shell:s0") < 0) {
|
||||||
|
LOG(FATAL) << "Could not set SELinux context for subprocess";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freecon(con);
|
||||||
|
} else {
|
||||||
|
LOG(FATAL) << "Failed to get SELinux context";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (command_.empty()) {
|
if (command_.empty()) {
|
||||||
// Spawn a login shell if we don't have a command.
|
// Spawn a login shell if we don't have a command.
|
||||||
execle(_PATH_BSHELL, "-" _PATH_BSHELL, nullptr, cenv.data());
|
execle(_PATH_BSHELL, "-" _PATH_BSHELL, nullptr, cenv.data());
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ cc_library_shared {
|
||||||
cc_library_static {
|
cc_library_static {
|
||||||
name: "libtombstoned_client_static",
|
name: "libtombstoned_client_static",
|
||||||
defaults: ["debuggerd_defaults"],
|
defaults: ["debuggerd_defaults"],
|
||||||
|
recovery_available: true,
|
||||||
srcs: [
|
srcs: [
|
||||||
"tombstoned/tombstoned_client.cpp",
|
"tombstoned/tombstoned_client.cpp",
|
||||||
"util.cpp",
|
"util.cpp",
|
||||||
|
|
@ -90,7 +91,6 @@ cc_library_static {
|
||||||
cc_library_static {
|
cc_library_static {
|
||||||
name: "libdebuggerd_handler",
|
name: "libdebuggerd_handler",
|
||||||
defaults: ["debuggerd_defaults"],
|
defaults: ["debuggerd_defaults"],
|
||||||
recovery_available: true,
|
|
||||||
srcs: ["handler/debuggerd_fallback_nop.cpp"],
|
srcs: ["handler/debuggerd_fallback_nop.cpp"],
|
||||||
|
|
||||||
whole_static_libs: [
|
whole_static_libs: [
|
||||||
|
|
@ -104,6 +104,7 @@ cc_library_static {
|
||||||
cc_library_static {
|
cc_library_static {
|
||||||
name: "libdebuggerd_handler_fallback",
|
name: "libdebuggerd_handler_fallback",
|
||||||
defaults: ["debuggerd_defaults"],
|
defaults: ["debuggerd_defaults"],
|
||||||
|
recovery_available: true,
|
||||||
srcs: [
|
srcs: [
|
||||||
"handler/debuggerd_fallback.cpp",
|
"handler/debuggerd_fallback.cpp",
|
||||||
],
|
],
|
||||||
|
|
@ -120,6 +121,12 @@ cc_library_static {
|
||||||
"liblzma",
|
"liblzma",
|
||||||
"libcutils",
|
"libcutils",
|
||||||
],
|
],
|
||||||
|
target: {
|
||||||
|
recovery: {
|
||||||
|
cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
|
||||||
|
exclude_static_libs: ["libdexfile"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
export_include_dirs: ["include"],
|
export_include_dirs: ["include"],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ cc_library_headers {
|
||||||
cc_defaults {
|
cc_defaults {
|
||||||
name: "libutils_defaults",
|
name: "libutils_defaults",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
vndk: {
|
vndk: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
support_system_process: true,
|
support_system_process: true,
|
||||||
|
|
@ -90,6 +91,10 @@ cc_defaults {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
recovery: {
|
||||||
|
exclude_shared_libs: ["libvndksupport"],
|
||||||
|
},
|
||||||
|
|
||||||
host: {
|
host: {
|
||||||
cflags: ["-DLIBUTILS_NATIVE=1"],
|
cflags: ["-DLIBUTILS_NATIVE=1"],
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
#include <utils/Vector.h>
|
#include <utils/Vector.h>
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__) && !defined(__ANDROID_RECOVERY__)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <vndksupport/linker.h>
|
#include <vndksupport/linker.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -70,7 +70,7 @@ void add_sysprop_change_callback(sysprop_change_callback cb, int priority) {
|
||||||
void add_sysprop_change_callback(sysprop_change_callback, int) {}
|
void add_sysprop_change_callback(sysprop_change_callback, int) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__) && !defined(__ANDROID_RECOVERY__)
|
||||||
void (*get_report_sysprop_change_func())() {
|
void (*get_report_sysprop_change_func())() {
|
||||||
void (*func)() = nullptr;
|
void (*func)() = nullptr;
|
||||||
void* handle = android_load_sphal_library("libutils.so", RTLD_NOW);
|
void* handle = android_load_sphal_library("libutils.so", RTLD_NOW);
|
||||||
|
|
@ -85,7 +85,7 @@ void (*get_report_sysprop_change_func())() {
|
||||||
void report_sysprop_change() {
|
void report_sysprop_change() {
|
||||||
do_report_sysprop_change();
|
do_report_sysprop_change();
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__) && !defined(__ANDROID_RECOVERY__)
|
||||||
// libutils.so is double loaded; from the default namespace and from the
|
// libutils.so is double loaded; from the default namespace and from the
|
||||||
// 'sphal' namespace. Redirect the sysprop change event to the other instance
|
// 'sphal' namespace. Redirect the sysprop change event to the other instance
|
||||||
// of libutils.so loaded in the 'sphal' namespace so that listeners attached
|
// of libutils.so loaded in the 'sphal' namespace so that listeners attached
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ cc_library {
|
||||||
name: "libziparchive",
|
name: "libziparchive",
|
||||||
host_supported: true,
|
host_supported: true,
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
vndk: {
|
vndk: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -308,6 +308,16 @@ endif # ifeq ($(_enforce_vndk_lite_at_runtime),false)
|
||||||
_enforce_vndk_at_runtime :=
|
_enforce_vndk_at_runtime :=
|
||||||
_enforce_vndk_lite_at_runtime :=
|
_enforce_vndk_lite_at_runtime :=
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# ld.config.txt for recovery
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := ld.config.recovery.txt
|
||||||
|
LOCAL_MODULE_CLASS := ETC
|
||||||
|
LOCAL_SRC_FILES := etc/ld.config.recovery.txt
|
||||||
|
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/etc
|
||||||
|
LOCAL_MODULE_STEM := ld.config.txt
|
||||||
|
include $(BUILD_PREBUILT)
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# llndk.libraries.txt
|
# llndk.libraries.txt
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
|
||||||
9
rootdir/etc/ld.config.recovery.txt
Normal file
9
rootdir/etc/ld.config.recovery.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Copyright (C) 2018 The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Bionic loader config file for recovery mode
|
||||||
|
#
|
||||||
|
|
||||||
|
dir.recovery = /system/bin
|
||||||
|
|
||||||
|
[recovery]
|
||||||
|
namespace.default.search.paths = /system/${LIB}
|
||||||
|
|
@ -12,10 +12,13 @@ phony {
|
||||||
"mkshrc_vendor",
|
"mkshrc_vendor",
|
||||||
"reboot",
|
"reboot",
|
||||||
"sh",
|
"sh",
|
||||||
|
"sh.recovery",
|
||||||
"sh_vendor",
|
"sh_vendor",
|
||||||
"toolbox",
|
"toolbox",
|
||||||
|
"toolbox.recovery",
|
||||||
"toolbox_vendor",
|
"toolbox_vendor",
|
||||||
"toybox",
|
"toybox",
|
||||||
|
"toybox.recovery",
|
||||||
"toybox_vendor",
|
"toybox_vendor",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ cc_defaults {
|
||||||
cc_binary {
|
cc_binary {
|
||||||
name: "toolbox",
|
name: "toolbox",
|
||||||
defaults: ["toolbox_binary_defaults"],
|
defaults: ["toolbox_binary_defaults"],
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_binary {
|
cc_binary {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue