Export active dsu slot to system prop

The prop can be consumed by init scripts to do customized setup:

on property:ro.gsid.dsu_slot=oemtest
    # Do setup for test
on property:ro.gsid.dsu_slot=oemdemo
    # Do setup for demo

Bug: 277691885
Test: m
Change-Id: I7bd78b9ba31021b27d57c6f092dad5d7ebf6e59b
Merged-In: I7bd78b9ba31021b27d57c6f092dad5d7ebf6e59b
Cherry-picked from aosp/2588465
This commit is contained in:
JW Wang 2023-02-18 15:16:17 +08:00 committed by Chun-Wei Wang
parent 301026fad9
commit ce09cdff62

View file

@ -1043,6 +1043,12 @@ int SecondStageMain(int argc, char** argv) {
SetProperty(gsi::kGsiBootedProp, is_running);
auto is_installed = android::gsi::IsGsiInstalled() ? "1" : "0";
SetProperty(gsi::kGsiInstalledProp, is_installed);
if (android::gsi::IsGsiRunning()) {
std::string dsu_slot;
if (android::gsi::GetActiveDsu(&dsu_slot)) {
SetProperty(gsi::kDsuSlotProp, dsu_slot);
}
}
am.QueueBuiltinAction(SetupCgroupsAction, "SetupCgroups");
am.QueueBuiltinAction(SetKptrRestrictAction, "SetKptrRestrict");