Loading init/first_stage_console.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include "first_stage_console.h" #include <stdio.h> #include <sys/stat.h> #include <sys/sysmacros.h> #include <sys/types.h> Loading Loading @@ -87,8 +88,18 @@ void StartConsole() { _exit(127); } bool FirstStageConsole(const std::string& cmdline) { return cmdline.find("androidboot.first_stage_console=1") != std::string::npos; int FirstStageConsole(const std::string& cmdline) { auto pos = cmdline.find("androidboot.first_stage_console="); if (pos != std::string::npos) { int val = 0; if (sscanf(cmdline.c_str() + pos, "androidboot.first_stage_console=%d", &val) != 1) { return FirstStageConsoleParam::DISABLED; } if (val <= FirstStageConsoleParam::MAX_PARAM_VALUE && val >= 0) { return val; } } return FirstStageConsoleParam::DISABLED; } } // namespace init Loading init/first_stage_console.h +8 −1 Original line number Diff line number Diff line Loading @@ -21,8 +21,15 @@ namespace android { namespace init { enum FirstStageConsoleParam { DISABLED = 0, CONSOLE_ON_FAILURE = 1, IGNORE_FAILURE = 2, MAX_PARAM_VALUE = IGNORE_FAILURE, }; void StartConsole(); bool FirstStageConsole(const std::string& cmdline); int FirstStageConsole(const std::string& cmdline); } // namespace init } // namespace android init/first_stage_init.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -200,16 +200,16 @@ int FirstStageMain(int argc, char** argv) { } Modprobe m({"/lib/modules"}, module_load_file); auto want_console = ALLOW_FIRST_STAGE_CONSOLE && FirstStageConsole(cmdline); auto want_console = ALLOW_FIRST_STAGE_CONSOLE ? FirstStageConsole(cmdline) : 0; if (!m.LoadListedModules(!want_console)) { if (want_console) { if (want_console != FirstStageConsoleParam::DISABLED) { LOG(ERROR) << "Failed to load kernel modules, starting console"; } else { LOG(FATAL) << "Failed to load kernel modules"; } } if (want_console) { if (want_console == FirstStageConsoleParam::CONSOLE_ON_FAILURE) { StartConsole(); } Loading Loading
init/first_stage_console.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include "first_stage_console.h" #include <stdio.h> #include <sys/stat.h> #include <sys/sysmacros.h> #include <sys/types.h> Loading Loading @@ -87,8 +88,18 @@ void StartConsole() { _exit(127); } bool FirstStageConsole(const std::string& cmdline) { return cmdline.find("androidboot.first_stage_console=1") != std::string::npos; int FirstStageConsole(const std::string& cmdline) { auto pos = cmdline.find("androidboot.first_stage_console="); if (pos != std::string::npos) { int val = 0; if (sscanf(cmdline.c_str() + pos, "androidboot.first_stage_console=%d", &val) != 1) { return FirstStageConsoleParam::DISABLED; } if (val <= FirstStageConsoleParam::MAX_PARAM_VALUE && val >= 0) { return val; } } return FirstStageConsoleParam::DISABLED; } } // namespace init Loading
init/first_stage_console.h +8 −1 Original line number Diff line number Diff line Loading @@ -21,8 +21,15 @@ namespace android { namespace init { enum FirstStageConsoleParam { DISABLED = 0, CONSOLE_ON_FAILURE = 1, IGNORE_FAILURE = 2, MAX_PARAM_VALUE = IGNORE_FAILURE, }; void StartConsole(); bool FirstStageConsole(const std::string& cmdline); int FirstStageConsole(const std::string& cmdline); } // namespace init } // namespace android
init/first_stage_init.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -200,16 +200,16 @@ int FirstStageMain(int argc, char** argv) { } Modprobe m({"/lib/modules"}, module_load_file); auto want_console = ALLOW_FIRST_STAGE_CONSOLE && FirstStageConsole(cmdline); auto want_console = ALLOW_FIRST_STAGE_CONSOLE ? FirstStageConsole(cmdline) : 0; if (!m.LoadListedModules(!want_console)) { if (want_console) { if (want_console != FirstStageConsoleParam::DISABLED) { LOG(ERROR) << "Failed to load kernel modules, starting console"; } else { LOG(FATAL) << "Failed to load kernel modules"; } } if (want_console) { if (want_console == FirstStageConsoleParam::CONSOLE_ON_FAILURE) { StartConsole(); } Loading