[Vous ne recevez pas souvent de courriers de safinaskar@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
This is preparation for initrd removal
Squash patch 1 and patch 2 together and say this is cleanup of two options deprecated by commit c8376994c86c ("initrd: remove support for multiple floppies") with the documentation by commit 6b99e6e6aa62 ("Documentation/admin-guide: blockdev/ramdisk: remove use of "rdev"")
Christophe
@@ -5229,8 +5229,6 @@ Param: <number> - step/bucket size as a power of 2 for statistical time based profiling.- prompt_ramdisk= [RAM] [Deprecated]- prot_virt= [S390] enable hosting protected virtual machines isolated from the hypervisor (if hardware supports that). If enabled, the default kernel base address
[Vous ne recevez pas souvent de courriers de safinaskar@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
There is no any reason for having special mechanism
for setting ramdisk size.
That's you opinion.
You should explain why.
Also this allows us to change rd_size variable to static
Signed-off-by: Askar Safin <redacted>
---
arch/arm/kernel/atags_parse.c | 12 ------------
drivers/block/brd.c | 8 ++++----
include/linux/initrd.h | 3 ---
What about:
arch/mips/kernel/setup.c:early_param("rd_size", rd_size_early);
Is it unrelated ?
@@ -27,6 +27,10 @@#include<linux/uaccess.h>+staticunsignedlongrd_size=CONFIG_BLK_DEV_RAM_SIZE;+module_param(rd_size,ulong,0444);+MODULE_PARM_DESC(rd_size,"Size of each RAM disk in kbytes.");+/**Eachblockramdiskdevicehasaxarraybrd_pagesofpagesthatstores*thepagescontainingtheblockdevice'scontents.
@@ -209,10 +213,6 @@ static int rd_nr = CONFIG_BLK_DEV_RAM_COUNT;module_param(rd_nr,int,0444);MODULE_PARM_DESC(rd_nr,"Maximum number of brd devices");-unsignedlongrd_size=CONFIG_BLK_DEV_RAM_SIZE;-module_param(rd_size,ulong,0444);-MODULE_PARM_DESC(rd_size,"Size of each RAM disk in kbytes.");-staticintmax_part=1;module_param(max_part,int,0444);MODULE_PARM_DESC(max_part,"Num Minors to reserve between devices");
@@ -5,9 +5,6 @@#define INITRD_MINOR 250 /* shouldn't collide with /dev/ram* too soon ... */-/* size of a single RAM disk */-externunsignedlongrd_size;-/* 1 if it is not an error if initrd_start < memory_start */externintinitrd_below_start_ok;--
[Vous ne recevez pas souvent de courriers de safinaskar@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
They are unused since previous commit
@@ -35,8 +35,8 @@ below: ===== ======================== bit 0 1 = mount root read only bit 1 unused- bit 2 0 = load ramdisk- bit 3 0 = prompt for ramdisk+ bit 2 unused+ bit 3 unused ===== ======================== rootdev
[Vous ne recevez pas souvent de courriers de safinaskar@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
It was used mostly for initrd. It could be used only if
brd is built-in. Use "brd.rd_size" instead
For me it would make more sense to remove ramdisk_start and ramdisk_size at the same time.
@@ -5279,9 +5279,6 @@ raid= [HW,RAID] See Documentation/admin-guide/md.rst.- ramdisk_size= [RAM] Sizes of RAM disks in kilobytes- See Documentation/admin-guide/blockdev/ramdisk.rst.- random.trust_cpu=off [KNL,EARLY] Disable trusting the use of the CPU's random number generator (if available) to
@@ -215,27 +215,11 @@ Devices possible for Atari: seconds.-2.6) ramdisk_size=---------------------:Syntax: ramdisk_size=<size>--This option instructs the kernel to set up a ramdisk of the given-size in KBytes. Do not use this option if the ramdisk contents are-passed by bootstrap! In this case, the size is selected automatically-and should not be overwritten.--The only application is for root filesystems on floppy disks, that-should be loaded into memory. To do that, select the corresponding-size of the disk as ramdisk size, and set the root device to the disk-drive (with "root=").---2.7) swap=+2.5) swap= I can't find any sign of this option in 2.2.6.-2.8) buff=+2.6) buff= ----------- I can't find any sign of this option in 2.2.6.
Have a simpler subject,
Le 13/09/2025 à 02:37, Askar Safin a écrit :
[Vous ne recevez pas souvent de courriers de safinaskar@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
This is preparation for initrd removal
and make a more interesting message.
For me it would make more sense to remove ramdisk_start and ramdisk_size at the same time.
Christophe
@@ -74,12 +74,11 @@ arch/x86/boot/Makefile. Some of the kernel command line boot options that may apply here are::- ramdisk_start=N ramdisk_size=M If you make a boot disk that has LILO, then for the above, you would use::- append = "ramdisk_start=N ramdisk_size=M"+ append = "ramdisk_size=M"4) An Example of Creating a Compressed RAM Disk -----------------------------------------------
@@ -5285,8 +5285,6 @@ ramdisk_size= [RAM] Sizes of RAM disks in kilobytes See Documentation/admin-guide/blockdev/ramdisk.rst.- ramdisk_start= [RAM] RAM disk image start address- random.trust_cpu=off [KNL,EARLY] Disable trusting the use of the CPU's random number generator (if available) to
@@ -17,13 +17,6 @@staticstructfile*in_file,*out_file;staticloff_tin_pos,out_pos;-staticint__initramdisk_start_setup(char*str)-{-/* will be removed in next commit */-return1;-}-__setup("ramdisk_start=",ramdisk_start_setup);-staticint__initcrd_load(decompress_fndeco);/*--
[Vous ne recevez pas souvent de courriers de safinaskar@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
There is no any reason for having special mechanism
for setting ramdisk size.
Also this allows us to change rd_size variable to static
@@ -27,6 +27,10 @@#include<linux/uaccess.h>+staticunsignedlongrd_size=CONFIG_BLK_DEV_RAM_SIZE;+module_param(rd_size,ulong,0444);+MODULE_PARM_DESC(rd_size,"Size of each RAM disk in kbytes.");+/**Eachblockramdiskdevicehasaxarraybrd_pagesofpagesthatstores*thepagescontainingtheblockdevice'scontents.
@@ -209,10 +213,6 @@ static int rd_nr = CONFIG_BLK_DEV_RAM_COUNT;module_param(rd_nr,int,0444);MODULE_PARM_DESC(rd_nr,"Maximum number of brd devices");-unsignedlongrd_size=CONFIG_BLK_DEV_RAM_SIZE;-module_param(rd_size,ulong,0444);-MODULE_PARM_DESC(rd_size,"Size of each RAM disk in kbytes.");-staticintmax_part=1;module_param(max_part,int,0444);MODULE_PARM_DESC(max_part,"Num Minors to reserve between devices");
@@ -5,9 +5,6 @@#define INITRD_MINOR 250 /* shouldn't collide with /dev/ram* too soon ... */-/* size of a single RAM disk */-externunsignedlongrd_size;-/* 1 if it is not an error if initrd_start < memory_start */externintinitrd_below_start_ok;--
From: Christian Brauner <brauner@kernel.org> Date: 2025-09-15 13:34:40
On Sat, Sep 13, 2025 at 12:37:39AM +0000, Askar Safin wrote:
Intro
====
This patchset removes classic initrd (initial RAM disk) support,
which was deprecated in 2020.
This is a good idea but the patchset does a bit too much and it's pretty
convoluted and mixes cleanups with the removal of initrd support and so
it's not that great to review let alone merge especially considering
that a revert might be needed.
Split it up into multiple patch series. Send a first series that
focusses only on removing the generic infrastructure keeping it as
contained as possible. Only do non-generic cleanups that are absolutely
essential for the removal. Then the cleanups can go in separate series
later.
As usual I'm happy to try to shed old code but I wouldn't be too
optimistic that we'll get away with this and if so it needs to be
surgical.
From: Rob Landley <hidden> Date: 2025-09-15 21:16:43
On 9/12/25 19:37, Askar Safin wrote:
Update it to reflect initrd removal.
Also I specified that error reports should
go to linux-doc@vger.kernel.org , because
Rob Landley said that he keeps getting
reports about this document and is unable
to fix them
Do you think emailing a list I could forward stuff to will improve matters?
I find the community an elaborate bureaucracy unresponsive to hobbyists. Documentation/process/submitting-patches.rst being a 934 line document with a bibliography, plus a 24 step checklist not counting the a) b) c) subsections are just symptoms. The real problem is following those is not sufficient to navigate said bureaucracy.
quoted hunk
What is ramfs?
--------------
@@ -101,9 +103,9 @@ archive is extracted into it, the kernel will fall through to the older code to locate and mount a root partition, then exec some variant of /sbin/init out of that.-All this differs from the old initrd in several ways:+All this differs from the old initrd (removed in 2025) in several ways:
Why keep the section when you removed the old mechanism? You took away their choices, you don't need to sell them on it.
(Unless you're trying to sell them on using a current linux kernel rather than 2.6 or bsd or qnx or something. But if they _do_ remove 32 bit support, or stick a rust dependency in the base build, I suspect that ship has sailed...)
quoted hunk
- - The old initrd was always a separate file, while the initramfs archive is+ - The old initrd was always a separate file, while the initramfs archive can be linked into the linux kernel image. (The directory ``linux-*/usr`` is devoted to generating this archive during the build.)
@@ -137,7 +139,7 @@ Populating initramfs: The 2.6 kernel build process always creates a gzipped cpio format initramfs archive and links it into the resulting kernel binary. By default, this-archive is empty (consuming 134 bytes on x86).+archive is nearly empty (consuming 134 bytes on x86).
Those two lines you just touched contradict each other.
For historical reference, commit c33df4eaaf41 in 2007 added a second codepath to special case NOT having an initramfs, for some reason. That's how static linked cpio in the kernel image and external initrd= loaded cpio from the bootloader wound up having different behavior.
The init/noinitramfs.c file does init/mkdir("/dev") and init_mknod("/dev/console") because calling the syscall_blah() functions directly was considered icky so they created gratuitous wrappers to do it for you instead, because that's cleaner somehow. (Presumably the same logic as C++ having get and set methods that perform a simple assignment and return a value. Because YOU can't be trusted to touch MY code.)
Note that ONLY init/noinitramfs.c creates /dev/console. You'd THINK the logical thing to do would be to detect failure of the filp_open() in console_on_rootfs() and do the mkdir/mknod there and retry (since that's __init code too), but no...
My VERY vague recollection from back in the dark ages is if you didn't specify any INITRAMFS_SOURCE in kconfig then gen_init_cpio got called with no arguments and spit out a "usage" section that got interpreted as scripts/gen_initramfs_list.sh output, back when the plumbing ignored lines it didn't understand but there was an "example: a simple initramfs" section in the usage with "dir /dev" and "nod /dev/console" lines that created a cpio archive with /dev/console in it which would get statically linked in as a "default", and code reached out and used this because it was there without understanding WHY it was there. So it initially worked by coincidence, and rather than make it explicit they went "two codepaths, half the testing!" and thus...
Anyway, that's why the 130+ byte archive was there. It wasn't actually empty, even when initramfs was disabled.
One of the "cleanups that didn't actually fix it" was https://github.com/mpe/linux-fullhistory/commit/2bd3a997befc if you want to dig into the history yourself. I wrote my docs in 2005 and that was 2010 so "somewhere in there"...
quoted hunk
-If the kernel has initrd support enabled, an external cpio.gz archive can also-be passed into a 2.6 kernel in place of an initrd. In this case, the kernel-will autodetect the type (initramfs, not initrd) and extract the external cpio+If the kernel has CONFIG_BLK_DEV_INITRD enabled, an external cpio.gz archive can also
You renamed that symbol, then even you use the old name here.
quoted hunk
+be passed into a 2.6 kernel. In this case, the kernel will extract the external cpio archive into rootfs before trying to run /init.-This has the memory efficiency advantages of initramfs (no ramdisk block-device) but the separate packaging of initrd (which is nice if you have+This is nice if you have non-GPL code you'd like to run from initramfs, without conflating it with-the GPL licensed Linux kernel binary).+the GPL licensed Linux kernel binary.
IANAL: Whether or not this qualifies as "mere aggregation" had yet to go to court last I heard.
Which is basically why https://hackmd.io/@starnight/Load_Firmware_Files_Later_in_Linux_Kernel was so screwed up in the first place: the logical thing to do would be put the firmware in a static initramfs and have the module initialization happen after initramfs was populated... BUT LICENSING! We must have a much more complicated implementation because license. I believe I suggested passing said initramfs in via the initrd mechanism so it remains a separate file until boot time, and was ignored. *shrug* The usual...
quoted hunk
It can also be used to supplement the kernel's built-in initramfs image. The
files in the external archive will overwrite any conflicting files in
@@ -278,7 +278,7 @@ User Mode Linux, like so:: EOF gcc -static hello.c -o init echo init | cpio -o -H newc | gzip > test.cpio.gz- # Testing external initramfs using the initrd loading mechanism.+ # Testing external initramfs.
A) they added -hda so you don't have to give it a dummy /dev/zero anymore.
B) there's no longer a "qemu" defaulting to the current architecture, you have to explicitly specify qemu-system-blah unless you create the symlink yourself by hand. This was considered an "improvement" by IBM bureaucrats. (Not a regression, a "feature". Oh well...)
C) to be honest I'd just point people at mkroot for examples these days, but I'm biased. (It smells like me.)
Rob
On Mon, Sep 15, 2025 at 4:34 PM Christian Brauner [off-list ref] wrote:
Split it up into multiple patch series. Send a first series that
focusses only on removing the generic infrastructure keeping it as
contained as possible. Only do non-generic cleanups that are absolutely
essential for the removal. Then the cleanups can go in separate series
later.
Ok, I will do this.
I will send a minimal patchset with arch/ changes kept to absolute minimum
or even absent. Nearly all of the changes will be in init/ and docs.
Hopefully it will pass via the VFS tree.
If it gets to kernel release, I will consider sending more patchsets.
--
Askar Safin
On 13 Sep 2025, at 01:37, Askar Safin [off-list ref] wrote:
[...]
For example, I renamed the following global variables:
__initramfs_start
__initramfs_size
[...]
to:
__builtin_initramfs_start
__builtin_initramfs_size
I strongly suggest picking different names given __builtin_foo is the
naming scheme used for GNU C builtins/intrinsics. I leave you and
others to bikeshed that one.
Jessica
From: Nicolas Schichan <hidden> Date: 2025-09-18 15:29:45
Hello,
Intro
====
This patchset removes classic initrd (initial RAM disk) support,
which was deprecated in 2020.
This serie came a bit as a surprise, because even though the message
notifying of the initrd deprecation was added in July 2020, the message
was never displayed on our kernels.
When booting with root=/dev/ram0 in the kernel commandline,
handle_initrd() where the deprecation message resides is never called,
which is rather unfortunate (init/do_mounts_initrd.c):
if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) {
init_unlink("/initrd.image");
handle_initrd(root_device_name); // shows the deprecation msg
return true;
}
It is likely we are not the alone booting with that particular
configuration, so other people are probably going to be surprised when
initrd support is removed, because they never saw the deprecation
message.
We do depend on initrd support a lot on our embedded platforms (more
than a million devices with a yearlyish upgrade to the latest
kernel). If it eventually becomes removed this is going to impact us.
We use an initrd squashfs4 image, because coming from a time where
embedded flash devices were fragile, we avoid having the root
filesystem directly mounted (even when read only) on the flash
block/mtd device, and have the bootloader load the root filesystem as
an initrd.
We use a squashfs4 because we can mount it and keep it compressed. The
kernel would decompress data on demand in the page cache, and evict it
as needed.
Regards,
--
Nicolas Schichan
When booting with root=/dev/ram0 in the kernel commandline,
handle_initrd() where the deprecation message resides is never called,
which is rather unfortunate (init/do_mounts_initrd.c):
Yes, this is unfortunate.
I personally still think that initrd should be removed.
I suggest using workaround I described in cover letter.
Also, for unknown reasons I didn't get your letter in my inbox.
(Not even in spam folder.) I ocasionally found it on lore.kernel.org .
--
Askar Safin
From: Nicolas Schichan <hidden> Date: 2025-09-19 15:25:01
Hello,
quoted
When booting with root=/dev/ram0 in the kernel commandline,
handle_initrd() where the deprecation message resides is never called,
which is rather unfortunate (init/do_mounts_initrd.c):
Yes, this is unfortunate.
I personally still think that initrd should be removed.
Considering that the deprecation message didn't get displayed in some
configurations, maybe it's a bit early at the very least.
I suggest using workaround I described in cover letter.
I'm not too keen on having an initramfs just to loop-mount
/sys/firmware/initrd, after all current kernels are able to handle the
use case just fine.
It looks like there is a lot of code calling into specific filesystems
so that the initrd code can guess the size of the file system before
copying into /dev/ram0, and I believe this is what causes the main
gripe against initrd today. What is wrong with just copying
/initrd.image using its actual size into /dev/ram0 instead of guessing
it with the help of filesystem specific code ?
Also, for unknown reasons I didn't get your letter in my inbox.
(Not even in spam folder.) I ocasionally found it on lore.kernel.org .
Sorry about that, When I used git-send-email yesterday to reply, the
SMTP server I used wasn't authenticated to google, so all gmail
recipients were dropped. Hopefully this work better today.
Regards,
--
Nicolas Schichan
On Fri, Sep 19, 2025 at 6:25 PM Nicolas Schichan [off-list ref] wrote:
Considering that the deprecation message didn't get displayed in some
configurations, maybe it's a bit early at the very least.
I changed my opinion.
Breaking users, who did not see a deprecation message at all,
is unfair.
I will send a patchset soon, which will remove initrd codepath,
which currently contains deprecation notice. And I will put
deprecation notice to
other codepath.
Then in September 2026 I will fully remove initrd.
SMTP server I used wasn't authenticated to google, so all gmail
recipients were dropped. Hopefully this work better today.
From: Nicolas Schichan <hidden> Date: 2025-09-22 14:29:06
[resending to the lists and Cc, sorry I initially replied only to Askar]
On Sat, Sep 20, 2025 at 5:55 AM Askar Safin [off-list ref] wrote:
On Fri, Sep 19, 2025 at 6:25 PM Nicolas Schichan [off-list ref] wrote:
quoted
Considering that the deprecation message didn't get displayed in some
configurations, maybe it's a bit early at the very least.
I changed my opinion.
Breaking users, who did not see a deprecation message at all,
is unfair.
I will send a patchset soon, which will remove initrd codepath,
which currently contains deprecation notice. And I will put
deprecation notice to
other codepath.
Thanks
Then in September 2026 I will fully remove initrd.
Is there a way to find some kind of middle ground here ?
I'm lead to believe that the main issue with the current code is that
it needs to parse the superblocks of the ramdisk image in order to get
the amount to data to copy into /dev/ram0.
It looks like it is partly because of the ramdisk_start= kernel
command line parameter which looks to be a remnant of the time it was
possible to boot on floppy disk on x86.
This kernel command line allows to look for a rootfs image at an
offset into the initrd data.
If we assume now that the rootfs image data starts at the beginning of
the initrd image and is the only part of the initrd image this would
indeed remove a lot of complexity.
Maybe it would be possible to remove the identify_ramdisk_image()
function and just copy the actual size of /initrd.image into
/dev/ram0. This would allow any file system to be used in an initrd
image (no just romfs, cramfs, minixfs, ext2fs and squashfs), and this
would simplify the code in init/do_mounts_rd.c greatly, with just the
function rd_load_image() and nr_blocks() remaining in this file.
I can send a patch for that but first I need to sort out my SMTP
issues from the other day.
Regards,
--
Nicolas Schichan
[Vous ne recevez pas souvent de courriers de safinaskar@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
Intro
====
This patchset removes classic initrd (initial RAM disk) support,
which was deprecated in 2020.
Initramfs still stays, and RAM disk itself (brd) still stays, too.
init/do_mounts* and init/*initramfs* are listed in VFS entry in
MAINTAINERS, so I think this patchset should go through VFS tree.
This patchset touchs every subdirectory in arch/, so I tested it
on 8 (!!!) archs in Qemu (see details below).
Warning: this patchset renames CONFIG_BLK_DEV_INITRD (!!!) to CONFIG_INITRAMFS
and CONFIG_RD_* to CONFIG_INITRAMFS_DECOMPRESS_* (for example,
CONFIG_RD_GZIP to CONFIG_INITRAMFS_DECOMPRESS_GZIP).
If you still use initrd, see below for workaround.
Apologise if my question looks stupid, but I'm using QEMU for various tests, and the way QEMU is started is something like:
qemu-system-ppc -kernel ./vmlinux -cpu g4 -M mac99 -initrd ./qemu/rootfs.cpio.gz
I was therefore expecting (and fearing) it to fail with your series applied, but surprisingly it still works.
Therefore is it really initrd you are removing or just some corner case ? If it is really initrd, then how does QEMU still work with that -initrd parameter ?
Thanks
Christophe
Details
====
I not only removed initrd, I also removed a lot of code, which
became dead, including a lot of code in arch/.
Still I think the only two architectures I touched in non-trivial
way are sh and 32-bit arm.
Also I renamed some files, functions and variables (which became misnomers) to proper names,
moved some code around, removed a lot of mentions of initrd
in code and comments. Also I cleaned up some docs.
For example, I renamed the following global variables:
__initramfs_start
__initramfs_size
phys_initrd_start
phys_initrd_size
initrd_start
initrd_end
to:
__builtin_initramfs_start
__builtin_initramfs_size
phys_external_initramfs_start
phys_external_initramfs_size
virt_external_initramfs_start
virt_external_initramfs_end
New names precisely capture meaning of these variables.
Also I renamed CONFIG_BLK_DEV_INITRD (which became total misnomer)
to CONFIG_INITRAMFS. And CONFIG_RD_* to CONFIG_INITRAMFS_DECOMPRESS_*.
This will break all configs out there (update your configs!).
Still I think this is okay,
because config names never were part of stable API.
Still, I don't have strong opinion here, so I can drop these renamings
if needed.
Other user-visible changes:
- Removed kernel command line parameters "load_ramdisk" and
"prompt_ramdisk", which did nothing and were deprecated
- Removed kernel command line parameter "ramdisk_start",
which was used for initrd only (not for initramfs)
- Removed kernel command line parameter "noinitrd",
which was inconsistent: it controlled initrd only
(not initramfs), except for EFI boot, where it
controlled both initramfs and initrd. EFI users
still can disable initramfs simply by not passing it
- Removed kernel command line parameter "ramdisk_size",
which used for controlling ramdisk (brd), but only
in non-modular mode. Use brd.rd_size instead, it
always works
- Removed /proc/sys/kernel/real-root-dev . It was used
for initrd only
This patchset is based on v6.17-rc5.
Testing
====
I tested my patchset on many architectures in Qemu using my Rust
program, heavily based on mkroot [1].
I used the following cross-compilers:
aarch64-linux-musleabi
armv4l-linux-musleabihf
armv5l-linux-musleabihf
armv7l-linux-musleabihf
i486-linux-musl
i686-linux-musl
mips-linux-musl
mips64-linux-musl
mipsel-linux-musl
powerpc-linux-musl
powerpc64-linux-musl
powerpc64le-linux-musl
riscv32-linux-musl
riscv64-linux-musl
s390x-linux-musl
sh4-linux-musl
sh4eb-linux-musl
x86_64-linux-musl
taken from this directory [2].
So, as you can see, there are 18 triplets, which correspond to 8 subdirs in arch/.
And note that this list contains two archs (arm and sh) touched in non-trivial way.
For every triplet I tested that:
- Initramfs still works (both builtin and external)
- Direct boot from disk still works
Workaround
====
If "retain_initrd" is passed to kernel, then initramfs/initrd,
passed by bootloader, is retained and becomes available after boot
as read-only magic file /sys/firmware/initrd [3].
No copies are involved. I. e. /sys/firmware/initrd is simply
a reference to original blob passed by bootloader.
This works even if initrd/initramfs is not recognized by kernel
in any way, i. e. even if it is not valid cpio archive, nor
a fs image supported by classic initrd.
This works both with my patchset and without it.
This means that you can emulate classic initrd so:
link builtin initramfs to kernel. In /init in this initramfs
copy /sys/firmware/initrd to some file in / and loop-mount it.
This is even better than classic initrd, because:
- You can use fs not supported by classic initrd, for example erofs
- One copy is involved (from /sys/firmware/initrd to some file in /)
as opposed to two when using classic initrd
Still, I don't recommend using this workaround, because
I want everyone to migrate to proper modern initramfs.
But still you can use this workaround if you want.
Also: it is not possible to directly loop-mount
/sys/firmware/initrd . Theoretically kernel can be changed
to allow this (and/or to make it writable), but I think nobody needs this.
And I don't want to implement this.
P. S. When I sent this patchset first time, zoho mail banned me for
too much email. So I resend this using gmail. The only change is
email change, there are no other changes
[1] https://github.com/landley/toybox/tree/master/mkroot
[2] https://landley.net/toybox/downloads/binaries/toolchains/latest
[3] https://lore.kernel.org/all/20231207235654.16622-1-graf@amazon.com/
Askar Safin (62):
init: remove deprecated "load_ramdisk" command line parameter, which
does nothing
init: remove deprecated "prompt_ramdisk" command line parameter, which
does nothing
init: sh, sparc, x86: remove unused constants RAMDISK_PROMPT_FLAG and
RAMDISK_LOAD_FLAG
init: x86, arm, sh, sparc: remove variable rd_image_start, which
controls starting block number of initrd
init: remove "ramdisk_start" command line parameter, which controls
starting block number of initrd
arm: init: remove special logic for setting brd.rd_size
arm: init: remove ATAG_RAMDISK
arm: init: remove FLAG_RDLOAD and FLAG_RDPROMPT
arm: init: document rd_start (in param_struct) as obsolete
initrd: remove initrd (initial RAM disk) support
init, efi: remove "noinitrd" command line parameter
init: remove /proc/sys/kernel/real-root-dev
ext2: remove ext2_image_size and associated code
init: m68k, mips, powerpc, s390, sh: remove Root_RAM0
doc: modernize Documentation/admin-guide/blockdev/ramdisk.rst
brd: remove "ramdisk_size" command line parameter
doc: modernize Documentation/filesystems/ramfs-rootfs-initramfs.rst
doc: modernize
Documentation/driver-api/early-userspace/early_userspace_support.rst
init: remove mentions of "ramdisk=" command line parameter
doc: remove Documentation/power/swsusp-dmcrypt.rst
init: remove all mentions of root=/dev/ram*
doc: remove obsolete mentions of pivot_root
init: rename __initramfs_{start,size} to
__builtin_initramfs_{start,size}
init: remove wrong comment
init: rename phys_initrd_{start,size} to
phys_external_initramfs_{start,size}
init: move phys_external_initramfs_{start,size} to init/initramfs.c
init: alpha: remove "extern unsigned long initrd_start, initrd_end"
init: alpha, arc, arm, arm64, csky, m68k, microblaze, mips, nios2,
openrisc, parisc, powerpc, s390, sh, sparc, um, x86, xtensa: rename
initrd_{start,end} to virt_external_initramfs_{start,end}
init: move virt_external_initramfs_{start,end} to init/initramfs.c
doc: remove documentation for block device 4 0
init: rename initrd_below_start_ok to initramfs_below_start_ok
init: move initramfs_below_start_ok to init/initramfs.c
init: remove init/do_mounts_initrd.c
init: inline create_dev into the only caller
init: make mount_root_generic static
init: make mount_root static
init: remove root_mountflags from init/do_mounts.h
init: remove most headers from init/do_mounts.h
init: make console_on_rootfs static
init: rename free_initrd_mem to free_initramfs_mem
init: rename reserve_initrd_mem to reserve_initramfs_mem
init: rename <linux/initrd.h> to <linux/initramfs.h>
setsid: inline ksys_setsid into the only caller
doc: kernel-parameters: remove [RAM] from reserve_mem=
doc: kernel-parameters: replace [RAM] with [INITRAMFS]
init: edit docs for initramfs-related configs
init: fix typo: virtul => virtual
init: fix comment
init: rename ramdisk_execute_command to initramfs_execute_command
init: rename ramdisk_command_access to initramfs_command_access
init: rename get_boot_config_from_initrd to
get_boot_config_from_initramfs
init: rename do_retain_initrd to retain_initramfs
init: rename kexec_free_initrd to kexec_free_initramfs
init: arm, x86: deal with some references to initrd
init: rename CONFIG_BLK_DEV_INITRD to CONFIG_INITRAMFS
init: rename CONFIG_RD_GZIP to CONFIG_INITRAMFS_DECOMPRESS_GZIP
init: rename CONFIG_RD_BZIP2 to CONFIG_INITRAMFS_DECOMPRESS_BZIP2
init: rename CONFIG_RD_LZMA to CONFIG_INITRAMFS_DECOMPRESS_LZMA
init: rename CONFIG_RD_XZ to CONFIG_INITRAMFS_DECOMPRESS_XZ
init: rename CONFIG_RD_LZO to CONFIG_INITRAMFS_DECOMPRESS_LZO
init: rename CONFIG_RD_LZ4 to CONFIG_INITRAMFS_DECOMPRESS_LZ4
init: rename CONFIG_RD_ZSTD to CONFIG_INITRAMFS_DECOMPRESS_ZSTD
.../admin-guide/blockdev/ramdisk.rst | 104 +----
.../admin-guide/device-mapper/dm-init.rst | 4 +-
Documentation/admin-guide/devices.txt | 12 -
Documentation/admin-guide/index.rst | 1 -
Documentation/admin-guide/initrd.rst | 383 ------------------
.../admin-guide/kernel-parameters.rst | 4 +-
.../admin-guide/kernel-parameters.txt | 38 +-
Documentation/admin-guide/nfs/nfsroot.rst | 4 +-
Documentation/admin-guide/sysctl/kernel.rst | 6 -
Documentation/arch/arm/ixp4xx.rst | 4 +-
Documentation/arch/arm/setup.rst | 6 +-
Documentation/arch/m68k/kernel-options.rst | 29 +-
Documentation/arch/x86/boot.rst | 4 +-
.../early_userspace_support.rst | 18 +-
.../filesystems/ramfs-rootfs-initramfs.rst | 20 +-
Documentation/power/index.rst | 1 -
Documentation/power/swsusp-dmcrypt.rst | 140 -------
Documentation/security/ipe.rst | 2 +-
.../translations/zh_CN/power/index.rst | 1 -
arch/alpha/kernel/core_irongate.c | 12 +-
arch/alpha/kernel/proto.h | 2 +-
arch/alpha/kernel/setup.c | 32 +-
arch/arc/configs/axs101_defconfig | 2 +-
arch/arc/configs/axs103_defconfig | 2 +-
arch/arc/configs/axs103_smp_defconfig | 2 +-
arch/arc/configs/haps_hs_defconfig | 2 +-
arch/arc/configs/haps_hs_smp_defconfig | 2 +-
arch/arc/configs/hsdk_defconfig | 2 +-
arch/arc/configs/nsim_700_defconfig | 2 +-
arch/arc/configs/nsimosci_defconfig | 2 +-
arch/arc/configs/nsimosci_hs_defconfig | 2 +-
arch/arc/configs/nsimosci_hs_smp_defconfig | 2 +-
arch/arc/configs/tb10x_defconfig | 4 +-
arch/arc/configs/vdk_hs38_defconfig | 2 +-
arch/arc/configs/vdk_hs38_smp_defconfig | 2 +-
arch/arc/mm/init.c | 14 +-
arch/arm/Kconfig | 2 +-
arch/arm/boot/dts/arm/integratorap.dts | 2 +-
arch/arm/boot/dts/arm/integratorcp.dts | 2 +-
.../dts/aspeed/aspeed-bmc-facebook-cmm.dts | 2 +-
.../aspeed/aspeed-bmc-facebook-galaxy100.dts | 2 +-
.../aspeed/aspeed-bmc-facebook-minipack.dts | 2 +-
.../aspeed/aspeed-bmc-facebook-wedge100.dts | 2 +-
.../aspeed/aspeed-bmc-facebook-wedge40.dts | 2 +-
.../dts/aspeed/aspeed-bmc-facebook-yamp.dts | 2 +-
.../ast2600-facebook-netbmc-common.dtsi | 2 +-
arch/arm/boot/dts/hisilicon/hi3620-hi4511.dts | 2 +-
.../ixp/intel-ixp42x-welltech-epbx100.dts | 2 +-
arch/arm/boot/dts/nspire/nspire-classic.dtsi | 2 +-
arch/arm/boot/dts/nspire/nspire-cx.dts | 2 +-
.../boot/dts/samsung/exynos4210-origen.dts | 2 +-
.../boot/dts/samsung/exynos4210-smdkv310.dts | 2 +-
.../boot/dts/samsung/exynos4412-smdk4412.dts | 2 +-
.../boot/dts/samsung/exynos5250-smdk5250.dts | 2 +-
arch/arm/boot/dts/st/ste-nomadik-nhk15.dts | 2 +-
arch/arm/boot/dts/st/ste-nomadik-s8815.dts | 2 +-
arch/arm/boot/dts/st/stm32429i-eval.dts | 2 +-
arch/arm/boot/dts/st/stm32746g-eval.dts | 2 +-
arch/arm/boot/dts/st/stm32f429-disco.dts | 2 +-
arch/arm/boot/dts/st/stm32f469-disco.dts | 2 +-
arch/arm/boot/dts/st/stm32f746-disco.dts | 2 +-
arch/arm/boot/dts/st/stm32f769-disco.dts | 2 +-
arch/arm/boot/dts/st/stm32h743i-disco.dts | 2 +-
arch/arm/boot/dts/st/stm32h743i-eval.dts | 2 +-
arch/arm/boot/dts/st/stm32h747i-disco.dts | 2 +-
arch/arm/boot/dts/st/stm32h750i-art-pi.dts | 2 +-
arch/arm/configs/aspeed_g4_defconfig | 8 +-
arch/arm/configs/aspeed_g5_defconfig | 8 +-
arch/arm/configs/assabet_defconfig | 4 +-
arch/arm/configs/at91_dt_defconfig | 4 +-
arch/arm/configs/axm55xx_defconfig | 2 +-
arch/arm/configs/bcm2835_defconfig | 2 +-
arch/arm/configs/clps711x_defconfig | 4 +-
arch/arm/configs/collie_defconfig | 4 +-
arch/arm/configs/davinci_all_defconfig | 2 +-
arch/arm/configs/exynos_defconfig | 4 +-
arch/arm/configs/footbridge_defconfig | 2 +-
arch/arm/configs/gemini_defconfig | 2 +-
arch/arm/configs/h3600_defconfig | 2 +-
arch/arm/configs/hisi_defconfig | 4 +-
arch/arm/configs/imx_v4_v5_defconfig | 2 +-
arch/arm/configs/imx_v6_v7_defconfig | 4 +-
arch/arm/configs/integrator_defconfig | 2 +-
arch/arm/configs/ixp4xx_defconfig | 2 +-
arch/arm/configs/keystone_defconfig | 2 +-
arch/arm/configs/lpc18xx_defconfig | 12 +-
arch/arm/configs/lpc32xx_defconfig | 4 +-
arch/arm/configs/milbeaut_m10v_defconfig | 2 +-
arch/arm/configs/multi_v4t_defconfig | 2 +-
arch/arm/configs/multi_v5_defconfig | 2 +-
arch/arm/configs/multi_v7_defconfig | 2 +-
arch/arm/configs/mvebu_v7_defconfig | 2 +-
arch/arm/configs/mxs_defconfig | 2 +-
arch/arm/configs/neponset_defconfig | 4 +-
arch/arm/configs/nhk8815_defconfig | 2 +-
arch/arm/configs/omap1_defconfig | 2 +-
arch/arm/configs/omap2plus_defconfig | 2 +-
arch/arm/configs/pxa910_defconfig | 2 +-
arch/arm/configs/pxa_defconfig | 4 +-
arch/arm/configs/qcom_defconfig | 2 +-
arch/arm/configs/rpc_defconfig | 2 +-
arch/arm/configs/s3c6400_defconfig | 4 +-
arch/arm/configs/s5pv210_defconfig | 4 +-
arch/arm/configs/sama5_defconfig | 4 +-
arch/arm/configs/sama7_defconfig | 2 +-
arch/arm/configs/shmobile_defconfig | 2 +-
arch/arm/configs/socfpga_defconfig | 2 +-
arch/arm/configs/sp7021_defconfig | 12 +-
arch/arm/configs/spear13xx_defconfig | 2 +-
arch/arm/configs/spear3xx_defconfig | 2 +-
arch/arm/configs/spear6xx_defconfig | 2 +-
arch/arm/configs/spitz_defconfig | 2 +-
arch/arm/configs/stm32_defconfig | 2 +-
arch/arm/configs/sunxi_defconfig | 2 +-
arch/arm/configs/tegra_defconfig | 2 +-
arch/arm/configs/u8500_defconfig | 4 +-
arch/arm/configs/versatile_defconfig | 2 +-
arch/arm/configs/vexpress_defconfig | 2 +-
arch/arm/configs/vf610m4_defconfig | 10 +-
arch/arm/configs/vt8500_v6_v7_defconfig | 2 +-
arch/arm/configs/wpcm450_defconfig | 2 +-
arch/arm/include/uapi/asm/setup.h | 10 -
arch/arm/kernel/atags_compat.c | 10 -
arch/arm/kernel/atags_parse.c | 16 +-
arch/arm/kernel/setup.c | 2 +-
arch/arm/mm/init.c | 24 +-
arch/arm64/configs/defconfig | 2 +-
arch/arm64/kernel/setup.c | 2 +-
arch/arm64/mm/init.c | 17 +-
arch/csky/kernel/setup.c | 24 +-
arch/csky/mm/init.c | 2 +-
arch/hexagon/configs/comet_defconfig | 2 +-
arch/loongarch/configs/loongson3_defconfig | 2 +-
arch/loongarch/kernel/mem.c | 2 +-
arch/loongarch/kernel/setup.c | 4 +-
arch/m68k/configs/amiga_defconfig | 2 +-
arch/m68k/configs/apollo_defconfig | 2 +-
arch/m68k/configs/atari_defconfig | 2 +-
arch/m68k/configs/bvme6000_defconfig | 2 +-
arch/m68k/configs/hp300_defconfig | 2 +-
arch/m68k/configs/mac_defconfig | 2 +-
arch/m68k/configs/multi_defconfig | 2 +-
arch/m68k/configs/mvme147_defconfig | 2 +-
arch/m68k/configs/mvme16x_defconfig | 2 +-
arch/m68k/configs/q40_defconfig | 2 +-
arch/m68k/configs/stmark2_defconfig | 2 +-
arch/m68k/configs/sun3_defconfig | 2 +-
arch/m68k/configs/sun3x_defconfig | 2 +-
arch/m68k/kernel/setup_mm.c | 12 +-
arch/m68k/kernel/setup_no.c | 12 +-
arch/m68k/kernel/uboot.c | 17 +-
arch/microblaze/kernel/cpu/mb.c | 2 +-
arch/microblaze/kernel/setup.c | 2 +-
arch/microblaze/mm/init.c | 12 +-
arch/mips/ath79/prom.c | 12 +-
arch/mips/configs/ath25_defconfig | 12 +-
arch/mips/configs/ath79_defconfig | 4 +-
arch/mips/configs/bcm47xx_defconfig | 2 +-
arch/mips/configs/bigsur_defconfig | 2 +-
arch/mips/configs/bmips_be_defconfig | 2 +-
arch/mips/configs/bmips_stb_defconfig | 14 +-
arch/mips/configs/cavium_octeon_defconfig | 2 +-
arch/mips/configs/eyeq5_defconfig | 2 +-
arch/mips/configs/eyeq6_defconfig | 2 +-
arch/mips/configs/generic_defconfig | 2 +-
arch/mips/configs/gpr_defconfig | 2 +-
arch/mips/configs/lemote2f_defconfig | 2 +-
arch/mips/configs/loongson2k_defconfig | 2 +-
arch/mips/configs/loongson3_defconfig | 2 +-
arch/mips/configs/malta_defconfig | 2 +-
arch/mips/configs/mtx1_defconfig | 2 +-
arch/mips/configs/rb532_defconfig | 2 +-
arch/mips/configs/rbtx49xx_defconfig | 2 +-
arch/mips/configs/rt305x_defconfig | 4 +-
arch/mips/configs/sb1250_swarm_defconfig | 2 +-
arch/mips/configs/xway_defconfig | 4 +-
arch/mips/kernel/setup.c | 53 ++-
arch/mips/mm/init.c | 2 +-
arch/mips/sibyte/common/cfe.c | 36 +-
arch/mips/sibyte/swarm/setup.c | 2 +-
arch/nios2/kernel/setup.c | 20 +-
arch/openrisc/configs/or1klitex_defconfig | 2 +-
arch/openrisc/configs/or1ksim_defconfig | 4 +-
arch/openrisc/configs/simple_smp_defconfig | 14 +-
arch/openrisc/configs/virt_defconfig | 2 +-
arch/openrisc/kernel/setup.c | 24 +-
arch/openrisc/kernel/vmlinux.h | 2 +-
arch/parisc/boot/compressed/misc.c | 2 +-
arch/parisc/configs/generic-32bit_defconfig | 2 +-
arch/parisc/configs/generic-64bit_defconfig | 2 +-
arch/parisc/defpalo.conf | 2 +-
arch/parisc/kernel/pdt.c | 6 +-
arch/parisc/kernel/setup.c | 8 +-
arch/parisc/mm/init.c | 32 +-
arch/powerpc/configs/44x/akebono_defconfig | 2 +-
arch/powerpc/configs/44x/arches_defconfig | 2 +-
arch/powerpc/configs/44x/bamboo_defconfig | 2 +-
arch/powerpc/configs/44x/bluestone_defconfig | 2 +-
.../powerpc/configs/44x/canyonlands_defconfig | 2 +-
arch/powerpc/configs/44x/ebony_defconfig | 2 +-
arch/powerpc/configs/44x/eiger_defconfig | 2 +-
arch/powerpc/configs/44x/fsp2_defconfig | 10 +-
arch/powerpc/configs/44x/icon_defconfig | 2 +-
arch/powerpc/configs/44x/iss476-smp_defconfig | 2 +-
arch/powerpc/configs/44x/katmai_defconfig | 2 +-
arch/powerpc/configs/44x/rainier_defconfig | 2 +-
arch/powerpc/configs/44x/redwood_defconfig | 2 +-
arch/powerpc/configs/44x/sam440ep_defconfig | 2 +-
arch/powerpc/configs/44x/sequoia_defconfig | 2 +-
arch/powerpc/configs/44x/taishan_defconfig | 2 +-
arch/powerpc/configs/44x/warp_defconfig | 2 +-
arch/powerpc/configs/52xx/cm5200_defconfig | 2 +-
arch/powerpc/configs/52xx/lite5200b_defconfig | 2 +-
arch/powerpc/configs/52xx/motionpro_defconfig | 2 +-
arch/powerpc/configs/52xx/tqm5200_defconfig | 2 +-
arch/powerpc/configs/83xx/asp8347_defconfig | 2 +-
.../configs/83xx/mpc8313_rdb_defconfig | 2 +-
.../configs/83xx/mpc8315_rdb_defconfig | 2 +-
.../configs/83xx/mpc832x_rdb_defconfig | 2 +-
.../configs/83xx/mpc834x_itx_defconfig | 2 +-
.../configs/83xx/mpc834x_itxgp_defconfig | 2 +-
.../configs/83xx/mpc836x_rdk_defconfig | 2 +-
.../configs/83xx/mpc837x_rdb_defconfig | 2 +-
arch/powerpc/configs/85xx/ge_imp3a_defconfig | 2 +-
arch/powerpc/configs/85xx/ksi8560_defconfig | 2 +-
arch/powerpc/configs/85xx/socrates_defconfig | 2 +-
arch/powerpc/configs/85xx/stx_gp3_defconfig | 2 +-
arch/powerpc/configs/85xx/tqm8540_defconfig | 2 +-
arch/powerpc/configs/85xx/tqm8541_defconfig | 2 +-
arch/powerpc/configs/85xx/tqm8548_defconfig | 2 +-
arch/powerpc/configs/85xx/tqm8555_defconfig | 2 +-
arch/powerpc/configs/85xx/tqm8560_defconfig | 2 +-
.../configs/85xx/xes_mpc85xx_defconfig | 2 +-
arch/powerpc/configs/amigaone_defconfig | 2 +-
arch/powerpc/configs/cell_defconfig | 2 +-
arch/powerpc/configs/chrp32_defconfig | 2 +-
arch/powerpc/configs/fsl-emb-nonhw.config | 2 +-
arch/powerpc/configs/g5_defconfig | 2 +-
arch/powerpc/configs/gamecube_defconfig | 2 +-
arch/powerpc/configs/holly_defconfig | 2 +-
arch/powerpc/configs/linkstation_defconfig | 2 +-
arch/powerpc/configs/mgcoge_defconfig | 4 +-
arch/powerpc/configs/microwatt_defconfig | 2 +-
arch/powerpc/configs/mpc512x_defconfig | 2 +-
arch/powerpc/configs/mpc5200_defconfig | 2 +-
arch/powerpc/configs/mpc83xx_defconfig | 2 +-
arch/powerpc/configs/pasemi_defconfig | 2 +-
arch/powerpc/configs/pmac32_defconfig | 2 +-
arch/powerpc/configs/powernv_defconfig | 2 +-
arch/powerpc/configs/ppc44x_defconfig | 2 +-
arch/powerpc/configs/ppc64_defconfig | 2 +-
arch/powerpc/configs/ppc64e_defconfig | 2 +-
arch/powerpc/configs/ppc6xx_defconfig | 2 +-
arch/powerpc/configs/ps3_defconfig | 2 +-
arch/powerpc/configs/skiroot_defconfig | 12 +-
arch/powerpc/configs/wii_defconfig | 2 +-
arch/powerpc/kernel/prom.c | 22 +-
arch/powerpc/kernel/prom_init.c | 6 +-
arch/powerpc/kernel/setup-common.c | 25 +-
arch/powerpc/kernel/setup_32.c | 2 +-
arch/powerpc/kernel/setup_64.c | 2 +-
arch/powerpc/mm/init_32.c | 2 +-
arch/powerpc/platforms/52xx/lite5200.c | 2 +-
arch/powerpc/platforms/83xx/km83xx.c | 2 +-
arch/powerpc/platforms/85xx/mpc85xx_mds.c | 2 +-
arch/powerpc/platforms/chrp/setup.c | 2 +-
.../platforms/embedded6xx/linkstation.c | 2 +-
.../platforms/embedded6xx/storcenter.c | 2 +-
arch/powerpc/platforms/powermac/setup.c | 8 +-
arch/riscv/configs/defconfig | 2 +-
arch/riscv/configs/nommu_k210_defconfig | 16 +-
arch/riscv/configs/nommu_virt_defconfig | 12 +-
arch/riscv/mm/init.c | 4 +-
arch/s390/boot/ipl_parm.c | 2 +-
arch/s390/boot/startup.c | 4 +-
arch/s390/configs/zfcpdump_defconfig | 2 +-
arch/s390/kernel/setup.c | 10 +-
arch/s390/mm/init.c | 2 +-
arch/sh/configs/apsh4a3a_defconfig | 2 +-
arch/sh/configs/apsh4ad0a_defconfig | 2 +-
arch/sh/configs/ecovec24-romimage_defconfig | 2 +-
arch/sh/configs/edosk7760_defconfig | 2 +-
arch/sh/configs/kfr2r09-romimage_defconfig | 2 +-
arch/sh/configs/kfr2r09_defconfig | 2 +-
arch/sh/configs/magicpanelr2_defconfig | 2 +-
arch/sh/configs/migor_defconfig | 2 +-
arch/sh/configs/rsk7201_defconfig | 2 +-
arch/sh/configs/rsk7203_defconfig | 2 +-
arch/sh/configs/sdk7786_defconfig | 8 +-
arch/sh/configs/se7206_defconfig | 2 +-
arch/sh/configs/se7705_defconfig | 2 +-
arch/sh/configs/se7722_defconfig | 2 +-
arch/sh/configs/se7751_defconfig | 2 +-
arch/sh/configs/secureedge5410_defconfig | 2 +-
arch/sh/configs/sh03_defconfig | 2 +-
arch/sh/configs/sh7757lcr_defconfig | 2 +-
arch/sh/configs/titan_defconfig | 2 +-
arch/sh/configs/ul2_defconfig | 2 +-
arch/sh/configs/urquell_defconfig | 2 +-
arch/sh/include/asm/setup.h | 1 -
arch/sh/kernel/head_32.S | 2 +-
arch/sh/kernel/setup.c | 27 +-
arch/sparc/boot/piggyback.c | 4 +-
arch/sparc/configs/sparc32_defconfig | 2 +-
arch/sparc/configs/sparc64_defconfig | 2 +-
arch/sparc/kernel/head_32.S | 4 +-
arch/sparc/kernel/head_64.S | 6 +-
arch/sparc/kernel/setup_32.c | 9 +-
arch/sparc/kernel/setup_64.c | 9 +-
arch/sparc/mm/init_32.c | 22 +-
arch/sparc/mm/init_64.c | 20 +-
arch/um/kernel/Makefile | 2 +-
arch/um/kernel/initrd.c | 6 +-
arch/x86/Kconfig | 2 +-
arch/x86/boot/header.S | 2 +-
arch/x86/boot/startup/sme.c | 2 +-
arch/x86/configs/i386_defconfig | 2 +-
arch/x86/configs/x86_64_defconfig | 2 +-
arch/x86/include/uapi/asm/bootparam.h | 7 +-
arch/x86/kernel/cpu/microcode/amd.c | 2 +-
arch/x86/kernel/cpu/microcode/core.c | 12 +-
arch/x86/kernel/cpu/microcode/intel.c | 2 +-
arch/x86/kernel/cpu/microcode/internal.h | 2 +-
arch/x86/kernel/devicetree.c | 2 +-
arch/x86/kernel/setup.c | 39 +-
arch/x86/mm/init.c | 8 +-
arch/x86/mm/init_32.c | 2 +-
arch/x86/mm/init_64.c | 2 +-
arch/x86/tools/relocs.c | 2 +-
arch/xtensa/Kconfig | 2 +-
arch/xtensa/boot/dts/csp.dts | 2 +-
arch/xtensa/configs/audio_kc705_defconfig | 2 +-
arch/xtensa/configs/cadence_csp_defconfig | 12 +-
arch/xtensa/configs/generic_kc705_defconfig | 2 +-
arch/xtensa/configs/nommu_kc705_defconfig | 12 +-
arch/xtensa/configs/smp_lx200_defconfig | 2 +-
arch/xtensa/configs/virt_defconfig | 2 +-
arch/xtensa/configs/xip_kc705_defconfig | 2 +-
arch/xtensa/kernel/setup.c | 26 +-
drivers/acpi/Kconfig | 2 +-
drivers/acpi/tables.c | 10 +-
drivers/base/firmware_loader/main.c | 2 +-
drivers/block/Kconfig | 8 +-
drivers/block/brd.c | 20 +-
drivers/firmware/efi/efi.c | 10 +-
.../firmware/efi/libstub/efi-stub-helper.c | 5 +-
drivers/gpu/drm/ci/arm.config | 2 +-
drivers/gpu/drm/ci/arm64.config | 2 +-
drivers/gpu/drm/ci/x86_64.config | 2 +-
drivers/of/fdt.c | 18 +-
fs/ext2/ext2.h | 9 -
fs/init.c | 14 -
include/asm-generic/vmlinux.lds.h | 8 +-
include/linux/ext2_fs.h | 13 -
include/linux/init_syscalls.h | 1 -
include/linux/initramfs.h | 26 ++
include/linux/initrd.h | 37 --
include/linux/root_dev.h | 1 -
include/linux/syscalls.h | 1 -
include/uapi/linux/sysctl.h | 1 -
init/.kunitconfig | 2 +-
init/Kconfig | 28 +-
init/Makefile | 6 +-
init/do_mounts.c | 28 +-
init/do_mounts.h | 42 --
init/do_mounts_initrd.c | 154 -------
init/do_mounts_rd.c | 334 ---------------
init/initramfs.c | 152 ++++---
init/main.c | 66 +--
kernel/sys.c | 7 +-
kernel/sysctl.c | 2 +-
kernel/umh.c | 2 +-
scripts/package/builddeb | 2 +-
.../ktest/examples/bootconfigs/tracing.bconf | 3 -
tools/testing/selftests/bpf/config.aarch64 | 2 +-
tools/testing/selftests/bpf/config.ppc64el | 2 +-
tools/testing/selftests/bpf/config.riscv64 | 2 +-
tools/testing/selftests/bpf/config.s390x | 2 +-
tools/testing/selftests/kho/vmtest.sh | 2 +-
.../testing/selftests/nolibc/Makefile.nolibc | 4 +-
tools/testing/selftests/vsock/config | 2 +-
.../selftests/wireguard/qemu/kernel.config | 2 +-
usr/Kconfig | 70 ++--
usr/Makefile | 2 +-
usr/initramfs_data.S | 4 +-
385 files changed, 969 insertions(+), 2346 deletions(-)
delete mode 100644 Documentation/admin-guide/initrd.rst
delete mode 100644 Documentation/power/swsusp-dmcrypt.rst
create mode 100644 include/linux/initramfs.h
delete mode 100644 include/linux/initrd.h
delete mode 100644 init/do_mounts_initrd.c
delete mode 100644 init/do_mounts_rd.c
base-commit: 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c
--
2.47.2
From: Alexander Patrakov <hidden> Date: 2025-09-24 16:18:06
On Tue, Sep 23, 2025 at 8:22 PM Christophe Leroy
[off-list ref] wrote:
Le 13/09/2025 à 02:37, Askar Safin a écrit :
quoted
[Vous ne recevez pas souvent de courriers de safinaskar@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
Intro
====
This patchset removes classic initrd (initial RAM disk) support,
which was deprecated in 2020.
Initramfs still stays, and RAM disk itself (brd) still stays, too.
init/do_mounts* and init/*initramfs* are listed in VFS entry in
MAINTAINERS, so I think this patchset should go through VFS tree.
This patchset touchs every subdirectory in arch/, so I tested it
on 8 (!!!) archs in Qemu (see details below).
Warning: this patchset renames CONFIG_BLK_DEV_INITRD (!!!) to CONFIG_INITRAMFS
and CONFIG_RD_* to CONFIG_INITRAMFS_DECOMPRESS_* (for example,
CONFIG_RD_GZIP to CONFIG_INITRAMFS_DECOMPRESS_GZIP).
If you still use initrd, see below for workaround.
Apologise if my question looks stupid, but I'm using QEMU for various
tests, and the way QEMU is started is something like:
qemu-system-ppc -kernel ./vmlinux -cpu g4 -M mac99 -initrd
./qemu/rootfs.cpio.gz
I was therefore expecting (and fearing) it to fail with your series
applied, but surprisingly it still works.
Therefore is it really initrd you are removing or just some corner case
? If it is really initrd, then how does QEMU still work with that
-initrd parameter ?
The QEMU -initrd parameter is a misnomer. It can be used to pass an
initrd or an initramfs, and the kernel automatically figures out what
it is. What you are passing is an initramfs (a gzipped cpio archive
with all the files), which is a modern and supported use case.
--
Alexander Patrakov
From: Rob Landley <hidden> Date: 2025-09-24 19:26:12
On 9/24/25 11:17, Alexander Patrakov wrote:
quoted
Therefore is it really initrd you are removing or just some corner case
? If it is really initrd, then how does QEMU still work with that
-initrd parameter ?
The QEMU -initrd parameter is a misnomer. It can be used to pass an
initrd or an initramfs, and the kernel automatically figures out what
it is.
It's not a misnomer, initrams has always been able to make use of the existing initrd loading mechanism to read images externally supplied by the bootloader. It's what grub calls it too. I documented it in the "External initramfs images" section of https://kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt back in 2005. The mechanism itself is 30 years old (Documentation/initrd.txt was written by Werner Almsberger in linux 1.3.73 from March 7, 1996, ala https://github.com/mpe/linux-fullhistory/commit/afc106342783 ).
Since initrd contents could always be in a bunch of different autodetected formats (and optionally compressed just like the kernel), initramfs just hooked in to the staircase and said "if the format is cpio, call this function to handle it". The patch series proposes removing all the other formats, but not otherwise changing the existing external image loader mechanism. (Personally I think removing the architecture-specific hacks but leaving the generic support under init/ would probably have made more sense as a first step.)
The bootloader hands off an initrd image, initramfs is the boot-time cpio extraction plumbing that's _init tagged and gets freed, and rootfs is the persistent mounted instance of ramfs or tmpfs that's always there and is analogous to the init task (PID 1) except for the mount tree. (And is often overmounted so it's not visible, but it's still there. And is NOT SPECIAL: overmounts aren't a new concept, nor is hiding them in things like "df".)
There's a REASON my documentation file was called ramfs-rootfs-initramfs.txt: the naming's always been a bit... layered. (And yes, I have always spelled initmpfs with only one t.)
Rob
From: Nicolas Schichan <redacted>
- drop prompt_ramdisk and ramdisk_start kernel parameters
- drop compression support
- drop image autodetection, the whole /initrd.image content is now
copied into /dev/ram0
- remove rd_load_disk() which doesn't seem to be used anywhere.
There is now no more limitation on the type of initrd filesystem that
can be loaded since the code trying to guess the initrd filesystem
size is gone (the whole /initrd.image file is used).
A few global variables in do_mounts_rd.c are now put as local
variables in rd_load_image() since they do not need to be visible
outside this function.
---
Hello,
Hopefully my email config is now better and reaches gmail users
correctly.
The patch below could probably split in a few patches, but I think
this simplify the code greatly without removing the functionality we
depend on (and this allows now to use EROFS initrd images).
Coupled with keeping the function populate_initrd_image() in
init/initramfs.c, this will keep what we need from the initrd code.
This removes support of loading bzip/gz/xz/... compressed images as
well, not sure if many user depend on this feature anymore.
No signoff because I'm only seeking comments about those changes right
now.
init/do_mounts.h | 2 -
init/do_mounts_rd.c | 243 +-------------------------------------------
2 files changed, 4 insertions(+), 241 deletions(-)
@@ -14,173 +14,9 @@#include<linux/decompress/generic.h>-staticstructfile*in_file,*out_file;-staticloff_tin_pos,out_pos;--staticint__initprompt_ramdisk(char*str)-{-pr_warn("ignoring the deprecated prompt_ramdisk= option\n");-return1;-}-__setup("prompt_ramdisk=",prompt_ramdisk);--int__initdatard_image_start;/* starting block # of image */--staticint__initramdisk_start_setup(char*str)-{-rd_image_start=simple_strtol(str,NULL,0);-return1;-}-__setup("ramdisk_start=",ramdisk_start_setup);--staticint__initcrd_load(decompress_fndeco);--/*-*ThisroutinetriestofindaRAMdiskimagetoload,andreturnsthe-*numberofblockstoreadforanon-compressedimage,0iftheimage-*isacompressedimage,and-1ifanimagewiththerightmagic-*numberscouldnotbefound.-*-*Wecurrentlycheckforthefollowingmagicnumbers:-*minix-*ext2-*romfs-*cramfs-*squashfs-*gzip-*bzip2-*lzma-*xz-*lzo-*lz4-*/-staticint__init-identify_ramdisk_image(structfile*file,loff_tpos,-decompress_fn*decompressor)-{-constintsize=512;-structminix_super_block*minixsb;-structromfs_super_block*romfsb;-structcramfs_super*cramfsb;-structsquashfs_super_block*squashfsb;-intnblocks=-1;-unsignedchar*buf;-constchar*compress_name;-unsignedlongn;-intstart_block=rd_image_start;--buf=kmalloc(size,GFP_KERNEL);-if(!buf)-return-ENOMEM;--minixsb=(structminix_super_block*)buf;-romfsb=(structromfs_super_block*)buf;-cramfsb=(structcramfs_super*)buf;-squashfsb=(structsquashfs_super_block*)buf;-memset(buf,0xe5,size);--/*-*Readblock0totestforcompressedkernel-*/-pos=start_block*BLOCK_SIZE;-kernel_read(file,buf,size,&pos);--*decompressor=decompress_method(buf,size,&compress_name);-if(compress_name){-printk(KERN_NOTICE"RAMDISK: %s image found at block %d\n",-compress_name,start_block);-if(!*decompressor)-printk(KERN_EMERG-"RAMDISK: %s decompressor not configured!\n",-compress_name);-nblocks=0;-gotodone;-}--/* romfs is at block zero too */-if(romfsb->word0==ROMSB_WORD0&&-romfsb->word1==ROMSB_WORD1){-printk(KERN_NOTICE-"RAMDISK: romfs filesystem found at block %d\n",-start_block);-nblocks=(ntohl(romfsb->size)+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS;-gotodone;-}--if(cramfsb->magic==CRAMFS_MAGIC){-printk(KERN_NOTICE-"RAMDISK: cramfs filesystem found at block %d\n",-start_block);-nblocks=(cramfsb->size+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS;-gotodone;-}--/* squashfs is at block zero too */-if(le32_to_cpu(squashfsb->s_magic)==SQUASHFS_MAGIC){-printk(KERN_NOTICE-"RAMDISK: squashfs filesystem found at block %d\n",-start_block);-nblocks=(le64_to_cpu(squashfsb->bytes_used)+BLOCK_SIZE-1)->>BLOCK_SIZE_BITS;-gotodone;-}--/*-*Read512bytesfurthertocheckifcramfsispadded-*/-pos=start_block*BLOCK_SIZE+0x200;-kernel_read(file,buf,size,&pos);--if(cramfsb->magic==CRAMFS_MAGIC){-printk(KERN_NOTICE-"RAMDISK: cramfs filesystem found at block %d\n",-start_block);-nblocks=(cramfsb->size+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS;-gotodone;-}--/*-*Readblock1totestforminixandext2superblock-*/-pos=(start_block+1)*BLOCK_SIZE;-kernel_read(file,buf,size,&pos);--/* Try minix */-if(minixsb->s_magic==MINIX_SUPER_MAGIC||-minixsb->s_magic==MINIX_SUPER_MAGIC2){-printk(KERN_NOTICE-"RAMDISK: Minix filesystem found at block %d\n",-start_block);-nblocks=minixsb->s_nzones<<minixsb->s_log_zone_size;-gotodone;-}--/* Try ext2 */-n=ext2_image_size(buf);-if(n){-printk(KERN_NOTICE-"RAMDISK: ext2 filesystem found at block %d\n",-start_block);-nblocks=n;-gotodone;-}--printk(KERN_NOTICE-"RAMDISK: Couldn't find valid RAM disk image starting at %d.\n",-start_block);--done:-kfree(buf);-returnnblocks;-}-staticunsignedlongnr_blocks(structfile*file){-structinode*inode=file->f_mapping->host;--if(!S_ISBLK(inode->i_mode))-return0;-returni_size_read(inode)>>10;+returni_size_read(file->f_mapping->host)>>10;}int__initrd_load_image(char*from)
@@ -190,10 +26,11 @@ int __init rd_load_image(char *from)intnblocks,i;char*buf=NULL;unsignedshortrotate=0;-decompress_fndecompressor=NULL;#if !defined(CONFIG_S390)charrotator[4]={'|','/','-','\\'};#endif+structfile*in_file,*out_file;+loff_tin_pos=0,out_pos=0;out_file=filp_open("/dev/ram",O_RDWR,0);if(IS_ERR(out_file))
@@ -203,17 +40,6 @@ int __init rd_load_image(char *from)if(IS_ERR(in_file))gotonoclose_input;-in_pos=rd_image_start*BLOCK_SIZE;-nblocks=identify_ramdisk_image(in_file,in_pos,&decompressor);-if(nblocks<0)-gotodone;--if(nblocks==0){-if(crd_load(decompressor)==0)-gotosuccessful_load;-gotodone;-}-/**NOTENOTE:nblocksisnotactuallyblocksbut*thenumberofkibibytesofdatatoloadintoaramdisk.
@@ -228,10 +54,7 @@ int __init rd_load_image(char *from)/**OK,timetocopyinthedata*/-if(strcmp(from,"/initrd.image")==0)-devblocks=nblocks;-else-devblocks=nr_blocks(in_file);+nblocks=devblocks=nr_blocks(in_file);if(devblocks==0){printk(KERN_ERR"RAMDISK: could not determine device size\n");
@@ -264,7 +87,6 @@ int __init rd_load_image(char *from)}pr_cont("done.\n");-successful_load:res=1;done:fput(in_file);
@@ -275,60 +97,3 @@ int __init rd_load_image(char *from)init_unlink("/dev/ram");returnres;}--int__initrd_load_disk(intn)-{-create_dev("/dev/root",ROOT_DEV);-create_dev("/dev/ram",MKDEV(RAMDISK_MAJOR,n));-returnrd_load_image("/dev/root");-}--staticintexit_code;-staticintdecompress_error;--staticlong__initcompr_fill(void*buf,unsignedlonglen)-{-longr=kernel_read(in_file,buf,len,&in_pos);-if(r<0)-printk(KERN_ERR"RAMDISK: error while reading compressed data");-elseif(r==0)-printk(KERN_ERR"RAMDISK: EOF while reading compressed data");-returnr;-}--staticlong__initcompr_flush(void*window,unsignedlongoutcnt)-{-longwritten=kernel_write(out_file,window,outcnt,&out_pos);-if(written!=outcnt){-if(decompress_error==0)-printk(KERN_ERR-"RAMDISK: incomplete write (%ld != %ld)\n",-written,outcnt);-decompress_error=1;-return-1;-}-returnoutcnt;-}--staticvoid__initerror(char*x)-{-printk(KERN_ERR"%s\n",x);-exit_code=1;-decompress_error=1;-}--staticint__initcrd_load(decompress_fndeco)-{-intresult;--if(!deco){-pr_emerg("Invalid ramdisk decompression routine. "-"Select appropriate config option.\n");-panic("Could not decompress initial ramdisk image.");-}--result=deco(NULL,0,compr_fill,compr_flush,NULL,NULL,error);-if(decompress_error)-result=1;-returnresult;-}
From: David Disseldorp <hidden> Date: 2025-09-29 09:13:42
Hi Nicolas,
On Thu, 25 Sep 2025 15:10:56 +0200, nschichan@freebox.fr wrote:
From: Nicolas Schichan <redacted>
- drop prompt_ramdisk and ramdisk_start kernel parameters
- drop compression support
- drop image autodetection, the whole /initrd.image content is now
copied into /dev/ram0
- remove rd_load_disk() which doesn't seem to be used anywhere.
There is now no more limitation on the type of initrd filesystem that
can be loaded since the code trying to guess the initrd filesystem
size is gone (the whole /initrd.image file is used).
A few global variables in do_mounts_rd.c are now put as local
variables in rd_load_image() since they do not need to be visible
outside this function.
---
Hello,
Hopefully my email config is now better and reaches gmail users
correctly.
The patch below could probably split in a few patches, but I think
this simplify the code greatly without removing the functionality we
depend on (and this allows now to use EROFS initrd images).
Coupled with keeping the function populate_initrd_image() in
init/initramfs.c, this will keep what we need from the initrd code.
This removes support of loading bzip/gz/xz/... compressed images as
well, not sure if many user depend on this feature anymore.
No signoff because I'm only seeking comments about those changes right
now.
init/do_mounts.h | 2 -
init/do_mounts_rd.c | 243 +-------------------------------------------
2 files changed, 4 insertions(+), 241 deletions(-)
On Mon, Sep 22, 2025 at 5:29 PM Nicolas Schichan [off-list ref] wrote:
quoted
Then in September 2026 I will fully remove initrd.
Is there a way to find some kind of middle ground here ?
I still plan to fully remove initrd in September 2026.
Maintainers will decide whether they will merge my patchset.
You may try to convince them.
I can send a patch for that but first I need to sort out my SMTP
issues from the other day.
If you still have mail issues, consider applying for @linux.dev email,
they are free for Linux devs ( https://linux.dev/ ).
Also, I just tried to test whether your use case is still supported in
mainline (i. e. uncompressed initrd with root=/dev/ram0).
It turned out that on modern kernels you need to enable
recently introduced CONFIG_BLK_DEV_WRITE_MOUNTED to
make this work.
So, make sure to enable this when upgrading kernel.
--
Askar Safin
On Sat, Sep 13, 2025 at 9:00 AM Borislav Petkov [off-list ref] wrote:
Ooh, now I see it - you have virtual and physical initramfs address things. We
usually call those "va" and "pa". So
initramfs_{va,pa}_{start,end}
Okay, I will call external_initramfs_{va,pa}_{start,end}
(after I will remove initrd, which will happen after a year)
"external" means "bootloader-supplied" as opposed to builtin initramfs.
--
Askar Safin
On Mon, Sep 15, 2025 at 2:16 PM Christophe Leroy
[off-list ref] wrote:
Squash patch 1 and patch 2 together and say this is cleanup of two
options deprecated by commit c8376994c86c ("initrd: remove support for
multiple floppies") with the documentation by commit 6b99e6e6aa62
("Documentation/admin-guide: blockdev/ramdisk: remove use of "rdev"")
On Tue, Sep 16, 2025 at 8:08 PM Jessica Clarke [off-list ref] wrote:
I strongly suggest picking different names given __builtin_foo is the
naming scheme used for GNU C builtins/intrinsics. I leave you and
others to bikeshed that one.
On Thu, Sep 25, 2025 at 4:12 PM [off-list ref] wrote:
quoted hunk
- drop prompt_ramdisk and ramdisk_start kernel parameters- drop compression support- drop image autodetection, the whole /initrd.image content is now copied into /dev/ram0- remove rd_load_disk() which doesn't seem to be used anywhere.
I welcome any initrd simplification!
Hopefully my email config is now better and reaches gmail users
correctly.