[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPnZJGBeV-E_AN8GnTfkaJvRtBmCeMYYCt+O0XMsc3kDULRuKg@mail.gmail.com>
Date: Fri, 22 Dec 2023 01:58:19 +0300
From: Askar Safin <safinaskar@...il.com>
To: Rob Landley <rob@...dley.net>, stefanb@...ux.ibm.com
Cc: gregkh@...uxfoundation.org, initramfs@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org, zohar@...ux.ibm.com
Subject: Re: [PATCH v3] rootfs: Fix support for rootfstype= when root= is given
Hi, Rob. And Stefan.
First of all, this patch got to linux-next (
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/?qt=author&q=Stefan+Berger
), so it seems it soon will be in mainline.
On Thu, Dec 21, 2023 at 12:24 PM Rob Landley <rob@...dley.net> wrote:
> Can you build tmpfs on a nommu system? Last I checked the plumbing expects swap,
> but it's been a while...
Okay, I agree, let's not remove ramfs.
Still, I don't like this (already applied) patch. init= and rdinit=
are two different options, and this is good. So, I think we should
have two different options. Analogously they should be rootfstype= and
rdrootfstype=. rootfstype= should be read by kernel when deciding how
to mount real root (i. e. not initramfs or initrd) only and
rdrootfstype= when deciding how to mount initramfs only. This will
make everything cleaner. Also note that userspace tools read
rootfstype= and assume that it always applies to real root. For
example, this is Debian's rdinit:
https://salsa.debian.org/kernel-team/initramfs-tools/-/blob/cf964bfb4362019fd7fba1e839e403ff950dca8e/init#L103
As you can see, this shell script parses /proc/cmdline and assumes
that rootfstype= always applies to real root. So, if someone sets
rootfstype= to tmpfs or ramfs, this will likely break this script.
So, I think the code should look so:
+if (IS_ENABLED(CONFIG_TMPFS)) {
+ if (!rd_root_fs_names) // We assume rd_root_fs_names is set
by rdrootfstype=
+ is_tmpfs = true; // Use tmpfs if rdrootfstype= is not
set. To get all tmpfs benefits
+ else if (rd_root_fs_names && !!strstr(rd_root_fs_names, "tmpfs"))
+ is_tmpfs = true;
+}
Yes, this will slightly break compatibility. I. e. this will make
Linux always choose tmpfs if rdrootfstype= is not present. But I think
there is nothing wrong with it. If a user cares, he will set
rdrootfstype= . And early boot code will become a lot more clean and
logical.
Rob, do you agree? Stefan, do you agree? Then I will write a patch,
with doc changes (currently I use gmail web interface, of course I
will use git send-email when I sent actual patch)
--
Askar Safin
Powered by blists - more mailing lists