init: add ro.boot.init_rc

SoC vendors and ODMs need a way to run different init scripts under
different boot modes. This patch adds a new ro.boot.init_rc kernel
cmdline argument to support this.

Bug: 26639863
Test: Tested on bullhead with androidboot.init_rc given a
non-existent .rc file which leads to expected boot failures.
Boot succeeds if androidboot.init_rc is not specified.

Change-Id: I2bca1cc3de6720feced041fe87266fb8afcce8b0
This commit is contained in:
Hung-ying Tyan 2017-01-18 09:39:36 +08:00
parent bde89da5fc
commit 959aeb17d5
1 changed files with 6 additions and 1 deletions

View File

@ -800,7 +800,12 @@ int main(int argc, char** argv) {
parser.AddSectionParser("service",std::make_unique<ServiceParser>());
parser.AddSectionParser("on", std::make_unique<ActionParser>());
parser.AddSectionParser("import", std::make_unique<ImportParser>());
parser.ParseConfig("/init.rc");
std::string bootscript = property_get("ro.boot.init_rc");
if (bootscript.empty()) {
parser.ParseConfig("/init.rc");
} else {
parser.ParseConfig(bootscript);
}
ActionManager& am = ActionManager::GetInstance();