Messages in this thread Patch in this message | | | From | Stefan Berger <> | Subject | [RFC PATCH] rootfs: Use tmpfs for rootfs even if root= is given | Date | Tue, 31 Oct 2023 11:44:17 -0400 |
| |
rootfs currently does not use tmpfs if the root= boot option is passed even though the documentation about rootfs (added in 6e19eded3684) in Documentation/filesystems/ramfs-rootfs-initramfs.rst states:
If CONFIG_TMPFS is enabled, rootfs will use tmpfs instead of ramfs by default. To force ramfs, add "rootfstype=ramfs" to the kernel command line.
However, this currently does not work when root= is passed on the boot command line since then saved_root_name contains a string and prevents usage of tmpfs. Therefore, remove the check on saved_root_name to enable tmpfs for rootfs.
Fixes: 6e19eded3684 ("initmpfs: use initramfs if rootfstype= or root= specified") Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Cc: "Milton D. Miller II" <mdmii@outlook.com> Cc: Rob Landley <rob@landley.net> Cc: Jeff Layton <jlayton@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Mimi Zohar <zohar@linux.ibm.com> --- init/do_mounts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/do_mounts.c b/init/do_mounts.c index 5dfd30b13f48..6567cf5807ee 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -510,7 +510,7 @@ struct file_system_type rootfs_fs_type = { void __init init_rootfs(void) { - if (IS_ENABLED(CONFIG_TMPFS) && !saved_root_name[0] && + if (IS_ENABLED(CONFIG_TMPFS) && (!root_fs_names || strstr(root_fs_names, "tmpfs"))) is_tmpfs = true; } -- 2.40.1
| |