Is the initial ramdisk embedded into the
How to load an
rootfs.cpio as a ramdisk and switch the
The bootloader (lilo or GRUB for example) loads the cpio initramfs (unless embedded as a blob in the kernel) or initramd and passes that to the kernel when booting it.
It is normally specified with the
initrd directive in the bootloader configuration file.
If you use initrd you will typically specify the root filesystem device as
root=/dev/ram0 on the kernel command line (specified with the
append directive to lilo, for example).
After unpacking/mounting the initramfs/initrd, the kernel will execute
/linuxrc if it exists, which will typically be a script that mounts the real root filesystem and switches to it with
pivot_root (older) or
init command line parameter can be set to another executable/script to execute instead of
linuxrc. Try passing
init=/bin/sh to the kernel on your next boot.
The initial ramdisk is not traditionally embedded in
bzImage, though it can be. Instead it is stored in a second file and specified using the
The method your
rootfs.cpio file uses to switch the root is up to whatever generated that file, but traditionally,
pivot_root /new_root or
switch_root /new_root is used to switch to the new root.