提交 86ff6456 编写于 作者: R Roberto Sassu 提交者: Zheng Zengkai

init: Add kernel option to force usage of tmpfs for rootfs

hulk inclusion
category: feature
feature: IMA Digest Lists extension
bugzilla: 46797

-------------------------------------------------

This patch adds the new option initramtmpfs for the kernel command line, to
force usage of tmpfs instead of ramfs as filesystem for rootfs.

This option should be used when the initial ram disk contains xattrs, as
only tmpfs supports them.
Signed-off-by: NRoberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: NTianxing Zhang <zhangtianxing3@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7a9392b2
...@@ -32,6 +32,7 @@ int root_mountflags = MS_RDONLY | MS_SILENT; ...@@ -32,6 +32,7 @@ int root_mountflags = MS_RDONLY | MS_SILENT;
static char * __initdata root_device_name; static char * __initdata root_device_name;
static char __initdata saved_root_name[64]; static char __initdata saved_root_name[64];
static int root_wait; static int root_wait;
static int initramtmpfs;
dev_t ROOT_DEV; dev_t ROOT_DEV;
...@@ -355,9 +356,16 @@ static int __init root_delay_setup(char *str) ...@@ -355,9 +356,16 @@ static int __init root_delay_setup(char *str)
return 1; return 1;
} }
static int __init initramtmpfs_setup(char *str)
{
initramtmpfs = 1;
return 1;
}
__setup("rootflags=", root_data_setup); __setup("rootflags=", root_data_setup);
__setup("rootfstype=", fs_names_setup); __setup("rootfstype=", fs_names_setup);
__setup("rootdelay=", root_delay_setup); __setup("rootdelay=", root_delay_setup);
__setup("initramtmpfs", initramtmpfs_setup);
static void __init get_fs_names(char *page) static void __init get_fs_names(char *page)
{ {
...@@ -649,7 +657,8 @@ struct file_system_type rootfs_fs_type = { ...@@ -649,7 +657,8 @@ struct file_system_type rootfs_fs_type = {
void __init init_rootfs(void) void __init init_rootfs(void)
{ {
if (IS_ENABLED(CONFIG_TMPFS) && !saved_root_name[0] && if (IS_ENABLED(CONFIG_TMPFS) &&
(!saved_root_name[0] || initramtmpfs) &&
(!root_fs_names || strstr(root_fs_names, "tmpfs"))) (!root_fs_names || strstr(root_fs_names, "tmpfs")))
is_tmpfs = true; is_tmpfs = true;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册