How is the size of init ram disk determined when initramfs is used?

Richard richard_siegfried at systemli.org
Sun Jan 1 11:54:52 EST 2023


Hi,

I don't exactly how and where the size is determined, but

On 07/10/2022 04:32, Chan Kim wrote:
> Hello all,
> 
> I'm using initramfs.cpio.gz for initial file system image.
> I embed it in the kernel Image file.
> After linux boots, when I'm in the shell, I can create files.
> But I'm curious how much the file system can grow.
> I remember somewhere reading that the initramdisk is made and the initramfs
> archive is extracted in the ramdisk.
> Then how is the ramdisk size determined? During the build usig Kconfig

this is extremly unlikely. For example when you do "apt upgrade" on 
debian and there gets a new kernel installed (or I think even when it is 
only about specific new kernel modules), sometimes a new initramfs is 
built. This includes (as far as I know) also some modules and 
configuration specific to your computer. This way they can ship a 
generic kernel but it still works custom for you since the initramfs is 
custom.

This customization means the intitramfs' size will vary. But since the 
kernel is built independently and beforehand it can not know that size.

Also, why should the filesize be that important? Can't it just be stored 
in some file header when it's generated ? Maybe I'm missing something here

-- Richard



More information about the Kernelnewbies mailing list