Snap for 6465939 from 9842adf768
to mainline-release
Change-Id: Iefa042e6e7be25dad189263b07579decf32433b0
This commit is contained in:
commit
b68db40fc1
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "first_stage_console.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -88,18 +87,8 @@ void StartConsole() {
|
|||
_exit(127);
|
||||
}
|
||||
|
||||
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;
|
||||
bool FirstStageConsole(const std::string& cmdline) {
|
||||
return cmdline.find("androidboot.first_stage_console=1") != std::string::npos;
|
||||
}
|
||||
|
||||
} // namespace init
|
||||
|
|
|
@ -21,15 +21,8 @@
|
|||
namespace android {
|
||||
namespace init {
|
||||
|
||||
enum FirstStageConsoleParam {
|
||||
DISABLED = 0,
|
||||
CONSOLE_ON_FAILURE = 1,
|
||||
IGNORE_FAILURE = 2,
|
||||
MAX_PARAM_VALUE = IGNORE_FAILURE,
|
||||
};
|
||||
|
||||
void StartConsole();
|
||||
int FirstStageConsole(const std::string& cmdline);
|
||||
bool FirstStageConsole(const std::string& cmdline);
|
||||
|
||||
} // namespace init
|
||||
} // namespace android
|
||||
|
|
|
@ -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) : 0;
|
||||
auto want_console = ALLOW_FIRST_STAGE_CONSOLE && FirstStageConsole(cmdline);
|
||||
if (!m.LoadListedModules(!want_console)) {
|
||||
if (want_console != FirstStageConsoleParam::DISABLED) {
|
||||
if (want_console) {
|
||||
LOG(ERROR) << "Failed to load kernel modules, starting console";
|
||||
} else {
|
||||
LOG(FATAL) << "Failed to load kernel modules";
|
||||
}
|
||||
}
|
||||
|
||||
if (want_console == FirstStageConsoleParam::CONSOLE_ON_FAILURE) {
|
||||
if (want_console) {
|
||||
StartConsole();
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ void atrace_update_tags()
|
|||
}
|
||||
|
||||
#define WRITE_MSG(format_begin, format_end, name, value) { \
|
||||
char buf[ATRACE_MESSAGE_LENGTH]; \
|
||||
char buf[ATRACE_MESSAGE_LENGTH] __attribute__((uninitialized)); \
|
||||
int pid = getpid(); \
|
||||
int len = snprintf(buf, sizeof(buf), format_begin "%s" format_end, pid, \
|
||||
name, value); \
|
||||
|
|
Loading…
Reference in New Issue