Read .rc files from bootstrap apexes
To start an early_hal service from a bootstrap vendor apex, init now reads .rc files from bootstrap apexes as well. In this change, perform_apex_config command is re-purposed to support bootstrap mode. Now we have some similarity between two apexd calls: - for bootstrap apexes (in the bootstrap mount namespace): exec_start apexd-bootstrap perform_apex_config --bootstrap - for normal apexes (in the default mount namespace): restart apexd ... wait_for_prop apexd.status activated perform_apex_config Note that some tasks in perform_apex_config are not needed in the bootstrap. For example, we don't need to create apexdata directories for bootstrap apexes. Bug: 290148081 Test: VendorApexHostTestCases Change-Id: I8f683a4dcd7cd9a2466a4b1b417d84c025c37761
This commit is contained in:
parent
370ee1bbda
commit
5c4217cf6e
3 changed files with 22 additions and 10 deletions
|
@ -674,11 +674,12 @@ provides the `aidl_lazy_test_1` interface.
|
|||
_options_ include "barrier=1", "noauto\_da\_alloc", "discard", ... as
|
||||
a comma separated string, e.g. barrier=1,noauto\_da\_alloc
|
||||
|
||||
`perform_apex_config`
|
||||
`perform_apex_config [--bootstrap]`
|
||||
> Performs tasks after APEXes are mounted. For example, creates data directories
|
||||
for the mounted APEXes, parses config file(s) from them, and updates linker
|
||||
configurations. Intended to be used only once when apexd notifies the mount
|
||||
event by setting `apexd.status` to ready.
|
||||
Use --bootstrap when invoking in the bootstrap mount namespace.
|
||||
|
||||
`restart [--only-if-running] <service>`
|
||||
> Stops and restarts a running service, does nothing if the service is currently
|
||||
|
|
|
@ -1292,10 +1292,21 @@ static Result<void> create_apex_data_dirs() {
|
|||
}
|
||||
|
||||
static Result<void> do_perform_apex_config(const BuiltinArguments& args) {
|
||||
auto create_dirs = create_apex_data_dirs();
|
||||
if (!create_dirs.ok()) {
|
||||
return create_dirs.error();
|
||||
bool bootstrap = false;
|
||||
if (args.size() == 2) {
|
||||
if (args[1] != "--bootstrap") {
|
||||
return Error() << "Unexpected argument: " << args[1];
|
||||
}
|
||||
bootstrap = true;
|
||||
}
|
||||
|
||||
if (!bootstrap) {
|
||||
auto create_dirs = create_apex_data_dirs();
|
||||
if (!create_dirs.ok()) {
|
||||
return create_dirs.error();
|
||||
}
|
||||
}
|
||||
|
||||
auto parse_configs = ParseApexConfigs(/*apex_name=*/"");
|
||||
if (!parse_configs.ok()) {
|
||||
return parse_configs.error();
|
||||
|
@ -1306,8 +1317,10 @@ static Result<void> do_perform_apex_config(const BuiltinArguments& args) {
|
|||
return update_linker_config.error();
|
||||
}
|
||||
|
||||
// Now start delayed services
|
||||
ServiceList::GetInstance().MarkServicesUpdate();
|
||||
if (!bootstrap) {
|
||||
// Now start delayed services
|
||||
ServiceList::GetInstance().MarkServicesUpdate();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -1362,7 +1375,7 @@ const BuiltinFunctionMap& GetBuiltinFunctionMap() {
|
|||
// mount and umount are run in the same context as mount_all for symmetry.
|
||||
{"mount_all", {0, kMax, {false, do_mount_all}}},
|
||||
{"mount", {3, kMax, {false, do_mount}}},
|
||||
{"perform_apex_config", {0, 0, {false, do_perform_apex_config}}},
|
||||
{"perform_apex_config", {0, 1, {false, do_perform_apex_config}}},
|
||||
{"umount", {1, 1, {false, do_umount}}},
|
||||
{"umount_all", {0, 1, {false, do_umount_all}}},
|
||||
{"update_linker_config", {0, 0, {false, do_update_linker_config}}},
|
||||
|
|
|
@ -74,9 +74,7 @@ on early-init
|
|||
# become available. Note that this is executed as exec_start to ensure that
|
||||
# the libraries are available to the processes started after this statement.
|
||||
exec_start apexd-bootstrap
|
||||
|
||||
# Generate linker config based on apex mounted in bootstrap namespace
|
||||
update_linker_config
|
||||
perform_apex_config --bootstrap
|
||||
|
||||
# These must already exist by the time boringssl_self_test32 / boringssl_self_test64 run.
|
||||
mkdir /dev/boringssl 0755 root root
|
||||
|
|
Loading…
Reference in a new issue