1

Is the initial ramdisk embedded into the bzImage?
How to load an rootfs.cpio as a ramdisk and switch the root?

2

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 switch_root (newer).

The 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.

0

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 init directive.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.