提交 966a2b87 编写于 作者: H handyohos

feat: goto to shell if first stage init failed

1)在ramdisk中打包mksh和toybox
2)修改第一阶段启动时CloseStdio的调用时机,过早的话execv("/bin/sh", NULL)无法成功
Signed-off-by: Nhandyohos <zhangxiaotian@huawei.com>
Change-Id: Ibb23f79c66db78fe480622cce556db49b94e5c09
上级 a1b4438b
......@@ -126,7 +126,6 @@ static void EnableDevKmsg(void)
void LogInit(void)
{
CloseStdio();
int ret = mknod("/dev/kmsg", S_IFCHR | S_IWUSR | S_IRUSR,
makedev(MEM_MAJOR, DEV_KMSG_MINOR));
if (ret == 0) {
......@@ -200,6 +199,10 @@ static void StartInitSecondStage(void)
abort();
}
}
// It will panic if close stdio before execv("/bin/sh", NULL)
CloseStdio();
#ifndef DISABLE_INIT_TWO_STAGES
SwitchRoot("/usr");
// Execute init second stage
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册