From 361371009902150d332cb23575f5833a57cf0ef0 Mon Sep 17 00:00:00 2001 From: Dario Freni Date: Fri, 25 May 2018 16:07:19 +0100 Subject: [PATCH] Add support for /product-services partition. This CL is largely and adaptation of Ie996def20e25dc1afe0c74af2096af844934b2dc Bug: 80741439 Test: Successfully built product-services.img with one module in it, and flashed on device. Also successfully built image with /system/product-services and no dedicated /product-services partition. Change-Id: I1046dfe19bf874da929c9131b76a1f85422fbb80 Merged-In: I1046dfe19bf874da929c9131b76a1f85422fbb80 --- init/init.cpp | 3 +++ init/property_service.cpp | 1 + libcutils/fs_config.cpp | 5 +++-- rootdir/Android.mk | 6 ++++++ rootdir/etc/ld.config.txt | 14 ++++++++++++++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/init/init.cpp b/init/init.cpp index 6569871b8..73194bdd9 100644 --- a/init/init.cpp +++ b/init/init.cpp @@ -119,6 +119,9 @@ static void LoadBootScripts(ActionManager& action_manager, ServiceList& service_ if (!parser.ParseConfig("/product/etc/init")) { late_import_paths.emplace_back("/product/etc/init"); } + if (!parser.ParseConfig("/product-services/etc/init")) { + late_import_paths.emplace_back("/product-services/etc/init"); + } if (!parser.ParseConfig("/odm/etc/init")) { late_import_paths.emplace_back("/odm/etc/init"); } diff --git a/init/property_service.cpp b/init/property_service.cpp index d1c427dba..c0d811fc6 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -691,6 +691,7 @@ void property_load_boot_defaults() { } } load_properties_from_file("/product/build.prop", NULL); + load_properties_from_file("/product-services/build.prop", NULL); load_properties_from_file("/odm/default.prop", NULL); load_properties_from_file("/vendor/default.prop", NULL); diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp index 267b7b356..48def6f95 100644 --- a/libcutils/fs_config.cpp +++ b/libcutils/fs_config.cpp @@ -130,7 +130,7 @@ static const char* conf[][2] = { // Vendor entries should be done via a vendor or device specific config.fs. // See https://source.android.com/devices/tech/config/filesystem#using-file-system-capabilities static const struct fs_path_config android_files[] = { - // clang-format off + // clang-format off { 00644, AID_SYSTEM, AID_SYSTEM, 0, "data/app/*" }, { 00644, AID_SYSTEM, AID_SYSTEM, 0, "data/app-ephemeral/*" }, { 00644, AID_SYSTEM, AID_SYSTEM, 0, "data/app-private/*" }, @@ -149,6 +149,7 @@ static const struct fs_path_config android_files[] = { { 00444, AID_ROOT, AID_ROOT, 0, oem_conf_dir + 1 }, { 00444, AID_ROOT, AID_ROOT, 0, oem_conf_file + 1 }, { 00600, AID_ROOT, AID_ROOT, 0, "product/build.prop" }, + { 00600, AID_ROOT, AID_ROOT, 0, "product-services/build.prop" }, { 00750, AID_ROOT, AID_SHELL, 0, "sbin/fs_mgr" }, { 00755, AID_ROOT, AID_SHELL, 0, "system/bin/crash_dump32" }, { 00755, AID_ROOT, AID_SHELL, 0, "system/bin/crash_dump64" }, @@ -200,7 +201,7 @@ static const struct fs_path_config android_files[] = { { 00755, AID_ROOT, AID_SHELL, 0, "vendor/bin/*" }, { 00755, AID_ROOT, AID_SHELL, 0, "vendor/xbin/*" }, { 00644, AID_ROOT, AID_ROOT, 0, 0 }, - // clang-format on + // clang-format on }; #ifndef __ANDROID_VNDK__ auto __for_testing_only__android_files = android_files; diff --git a/rootdir/Android.mk b/rootdir/Android.mk index 478b8d094..87eb733d5 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -93,6 +93,11 @@ ifdef BOARD_USES_PRODUCTIMAGE else LOCAL_POST_INSTALL_CMD += ; ln -sf /system/product $(TARGET_ROOT_OUT)/product endif +ifdef BOARD_USES_PRODUCT_SERVICES_IMAGE + LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/product-services +else + LOCAL_POST_INSTALL_CMD += ; ln -sf /system/product-services $(TARGET_ROOT_OUT)/product-services +endif # For /odm partition. LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/odm @@ -202,6 +207,7 @@ $(2): $(1) $$(hide) sed -i -e 's?%SANITIZER_RUNTIME_LIBRARIES%?$$(PRIVATE_SANITIZER_RUNTIME_LIBRARIES)?g' $$@ $$(hide) sed -i -e 's?%VNDK_VER%?$$(PRIVATE_VNDK_VERSION)?g' $$@ $$(hide) sed -i -e 's?%PRODUCT%?$$(TARGET_COPY_OUT_PRODUCT)?g' $$@ + $$(hide) sed -i -e 's?%PRODUCTSERVICES%?$$(TARGET_COPY_OUT_PRODUCTSERVICES)?g' $$@ llndk_libraries_list := vndksp_libraries_list := diff --git a/rootdir/etc/ld.config.txt b/rootdir/etc/ld.config.txt index 42dc7abe7..7d22a3acc 100644 --- a/rootdir/etc/ld.config.txt +++ b/rootdir/etc/ld.config.txt @@ -8,6 +8,7 @@ dir.system = /system/bin/ dir.system = /system/xbin/ dir.system = /%PRODUCT%/bin/ +dir.system = /%PRODUCTSERVICES%/bin/ dir.vendor = /odm/bin/ dir.vendor = /vendor/bin/ @@ -40,6 +41,7 @@ namespace.default.isolated = true namespace.default.search.paths = /system/${LIB} namespace.default.search.paths += /%PRODUCT%/${LIB} +namespace.default.search.paths += /%PRODUCTSERVICES%/${LIB} # We can't have entire /system/${LIB} as permitted paths because doing so # makes it possible to load libs in /system/${LIB}/vndk* directories by @@ -52,6 +54,7 @@ namespace.default.permitted.paths = /system/${LIB}/drm namespace.default.permitted.paths += /system/${LIB}/extractors namespace.default.permitted.paths += /system/${LIB}/hw namespace.default.permitted.paths += /%PRODUCT%/${LIB} +namespace.default.permitted.paths += /%PRODUCTSERVICES%/${LIB} # These are where odex files are located. libart has to be able to dlopen the files namespace.default.permitted.paths += /system/framework namespace.default.permitted.paths += /system/app @@ -66,6 +69,9 @@ namespace.default.permitted.paths += /oem/app namespace.default.permitted.paths += /%PRODUCT%/framework namespace.default.permitted.paths += /%PRODUCT%/app namespace.default.permitted.paths += /%PRODUCT%/priv-app +namespace.default.permitted.paths += /%PRODUCTSERVICES%/framework +namespace.default.permitted.paths += /%PRODUCTSERVICES%/app +namespace.default.permitted.paths += /%PRODUCTSERVICES%/priv-app namespace.default.permitted.paths += /data namespace.default.permitted.paths += /mnt/expand @@ -73,6 +79,8 @@ namespace.default.asan.search.paths = /data/asan/system/${LIB} namespace.default.asan.search.paths += /system/${LIB} namespace.default.asan.search.paths += /data/asan/product/${LIB} namespace.default.asan.search.paths += /product/${LIB} +namespace.default.asan.search.paths += /data/asan/product-services/${LIB} +namespace.default.asan.search.paths += /product-services/${LIB} namespace.default.asan.permitted.paths = /data namespace.default.asan.permitted.paths += /system/${LIB}/drm @@ -92,6 +100,10 @@ namespace.default.asan.permitted.paths += /%PRODUCT%/${LIB} namespace.default.asan.permitted.paths += /%PRODUCT%/framework namespace.default.asan.permitted.paths += /%PRODUCT%/app namespace.default.asan.permitted.paths += /%PRODUCT%/priv-app +namespace.default.asan.permitted.paths += /%PRODUCTSERVICES%/${LIB} +namespace.default.asan.permitted.paths += /%PRODUCTSERVICES%/framework +namespace.default.asan.permitted.paths += /%PRODUCTSERVICES%/app +namespace.default.asan.permitted.paths += /%PRODUCTSERVICES%/priv-app namespace.default.asan.permitted.paths += /mnt/expand ############################################################################### @@ -328,6 +340,7 @@ namespace.system.isolated = false namespace.system.search.paths = /system/${LIB} namespace.system.search.paths += /%PRODUCT%/${LIB} +namespace.system.search.paths += /%PRODUCTSERVICES%/${LIB} namespace.system.asan.search.paths = /data/asan/system/${LIB} namespace.system.asan.search.paths += /system/${LIB} @@ -346,3 +359,4 @@ namespace.system.asan.search.paths += /product/${LIB} namespace.default.isolated = false namespace.default.search.paths = /system/${LIB} namespace.default.search.paths += /%PRODUCT%/${LIB} +namespace.default.search.paths += /%PRODUCTSERVICES%/${LIB}