8

I'm looking for a way to boot an existing linux kernel without an initramfs. According to this link it should be possible simply by editing /boot/grub2/grub.cfg. But if I try this config

menuentry 'Fedora Linux, no initramfs' {
   set root='hd0,msdos1'
   linux    /vmlinuz-3.3.4-5.fc17.i686.PAE rootfstype=ext4 root=/dev/sda2 rd.md=0 rd.lvm=0 rd.dm=0 SYSFONT=True  KEYTABLE=us rd.luks=0 LANG=en_US.UTF-8
}

the boot process stops with a kernel panic at the point where the kernel tries to mount the initramfs. Do I have to tell during compile process that I don't want an initramfs? The only config option I found is CONFIG_INITRAMFS_SOURCE which is already set to CONFIG_INITRAMFS_SOURCE="".

I know there is a similar question but it lacks an explanation how to do it in practice.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
JohnnyFromBF
  • 3,496
  • Ok seems there is another option CONFIG_BLK_DEV_INITRD. – JohnnyFromBF Sep 22 '15 at 13:56
  • 2
    Most distribution kernels (the kernel that comes with the distro, Fedora in your case) do not have all the necessary drivers required to boot (hard drive driver, filesystems, etc.) compiled in, rather keeping them in an initramfs. (Those are what you need to add to your .config to make your kernel work.) This is so that at boot, the system can detect what drivers it needs (SATA instead of IDE, for example), and remove all the unnecessary drivers, whereas, if they were compiled in, they could not be removed. If you're still interested, leave a comment and I'll write-up a full-fledged answer. – Billy Jul 31 '18 at 20:00
  • @Billy I'd love a fully-fledged answer, I'm struggling to get a no initramfs version of fedora running – ericcurtin Jun 27 '22 at 20:11

1 Answers1

1

Initramfs has all the needed information which OS needs to boot the system up.. It has all the file system information (like which devices to from and which devices has root fs which needs to be mounted for system to boot up.) and the contents are generated specific to the kernel. You can boot from another image which should have all needed info.

Vmlinux which you are trying use is a statically linked image.. It's not usable for the system to boot. Best of my knowledge it's used for symbols generation and debugging mainly.

It's not like it cannot be used to boot up, but it needs to be made Bootable before using it.. Since it doesn't have bootsector information.

amitam
  • 213
  • 1
    You are correct about vmlinux; you cannot (directly) boot a system off it. There is a difference, however, between vmlinux and vmlinuz (the latter being what the OP is trying to boot). 'vmlinuz' is simply what a kernel (bz)Image (which is bootable) gets named when it gets installed and copied to /boot. – Billy Jul 31 '18 at 19:54