Re: [PATCH] initramfs: Expose retained initrd as sysfs file

From: Alexander Graf
Date: Wed Dec 06 2023 - 16:29:42 EST



On 06.12.23 21:00, Andrew Morton wrote:
On Wed, 6 Dec 2023 14:16:27 +0000 Alexander Graf <graf@xxxxxxxxxx> wrote:

When the kernel command line option "retain_initrd" is set, we do not
free the initrd memory. However, we also don't expose it to anyone for
consumption. That leaves us in a weird situation where the only user of
this feature is ppc64 and arm64 specific kexec tooling.

To make it more generally useful, this patch adds a kobject to the
firmware object that contains the initrd context when "retain_initrd"
is set. That way, we can access the initrd any time after boot from
user space and for example hand it into kexec as --initrd parameter
if we want to reboot the same initrd. Or inspect it directly locally.
I think it would be helpful if the changelog were mention and describe
the new /sys/firmware/initrd. And I assume we should add a
Documentation/ABI/testing/sysfs-firmware-initrd.


Thanks a bunch for the suggestions - let me send v2 with both addressed :)

Alex




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879