I read through this popular IBM doc (I see it referred quite often on the web) explaining the function of the initial RAM disk.I hit a wall in conceptualizing how this works though.In the doc it says The boot loader, such as GRUB, identifies the kernel that is to be  loaded and copies this kernel image and any associated initrd into  memoryI'm already confused: Does it copy the entire kernel into memory or just part of it? If the entire kernel is in memory then why do we even need the initial RAM disk? I thought the purpose of initrd was to be able to have a small generalized kernel image and initrd will install the correct modules in it before the kernel image is loaded. But if the entire kernel is already in memory why do we need initrd?That also brings up another thing that confuses me - where are the modules that get loaded into the kernel located? Are all the kernel modules stored inside initrd?
Is the entire kernel loaded into memory on boot?
linux;kernel;grub;initramfs;initrd
The entire kernel is loaded into memory at boot, typically along with an initramfs nowadays. (It is still possible to set up a system to boot without an initramfs but that's unusual on desktops and servers.)The initramfs's role is to provide the functionality needed to mount the real filesystems and continue booting the system. That involves kernel modules, and also various binaries: you need at least udev, perhaps some networking, and kmod which loads modules.Modules can be loaded into the kernel later than just boot, so there's no special preparation of the kernel by the initramfs. They can be stored anywhere: the initramfs, /lib/modules on the real filesystem, in a development tree if you're developing a module... The initramfs only needs to contain the modules which are necessary to mount the root filesystem (which contains the rest).