User:Pietinger/temp/delete me

@vaukai: please delete this post after use

Some informations about stub kernel, initramfs and kernel command line paramter root=

1. You can have a "normal" kernel wihtout an initramfs. For this you must configure the kernel manually and configure all what kernel needs to find its root partition into kernel. This is the default when working with our AMD64 handbook: Handbook:AMD64/Installation/Kernel

This kernel needs a bootloader / bootmanager (grub is both).

1.a You can use grub (or others)

OR

1.b You have an UEFI system and want that UEFI boots direct kernel without using any bootloader. Then you must configure this kernel as a STUB kernel

(dont forget: grub CAN start a stub kernel ALSO; but this is solution 1a and NOT 1b; because grub is involved)

In both sitations kernel needs information WHERE to find its root partition. You have two choices for both situation:

1.a.1: grub gives this information to kernel

1.a.2: You do "hardcode" this INTO the kernel in "BUILT-KERNEL Command Line" WITH: root=/dev/sdXY OR root=PARTUUID=...

1.b.1: You do "hardcode" this INTO the kernel in "BUILT-KERNEL Command Line" WITH: root=/dev/sdXY OR root=PARTUUID=...

1.b.2: You configure UEFI to give this information to kernel (seldom; because some UEFI are not capable for this) But if used we need also: root=/dev/sdXY OR root=PARTUUID=...

2. You can use an initramfs doing some stuff.

Here we have two choices:

B.1. It is embedded INTO the kernel

This is easier, because the Kernel needs only information about root partition (same as always).

B.2. It is an external CPIO archiv

Here Kernel needs information about root partition AND where to find this external CPIO archiv !!!

What an initramfs ALWAYS MUST do is: Mounting the root partition ! Because: As soon as kernel knows we have an initramfs THEN kernel will NOT mount the root partition; it is the job of initramfs now.

So, now, it depends HOW intitramfs is programmed to find kernel root partition. Most scripts will search with findfs for root=LABEL=... OR root=UUID=... In every case they can use also root=/dev/sdXY ... maybe ... (I am not sure here) ... they can also use root=PARTUUID=... So, working with root=/dev/sdXY will work ALWAYS ... but it is not recommended (because you can have troubles when you have accicently an USB stick in your computer) Working with root=UUID=... will surely work.

Now lets combine 1 and 2:

B.1.a.1: Grub gives kernel command line to initramfs (via kernel; kernel gives information to initramfs)

B.1.a.2: You do "hardcode" this INTO the kernel in "BUILT-KERNEL Command Line" WITH: root=/dev/sdXY OR root=LABEL=... OR root=UUID=..

B.1.b.1: You do "hardcode" this INTO the kernel in "BUILT-KERNEL Command Line" WITH: root=/dev/sdXY OR root=LABEL=... OR root=UUID=..

B.1.b.2: You configure UEFI to give this information to kernel (seldom; because some UEFI are not capable for this) also root=/dev/sdXY OR root=LABEL=... OR root=UUID=...

Now it goes crazy, because we have two informations for kernel: Where is root partition ? And: Where is external CPIO archiv ? Why it is crazy ? Because you can "put" one information in grub / UEFI and the other information in BUILT-IN kernel command line .... hahaha ....

B.2.a.1: grub gives both informations to kernel (root= initrd=)

B.2.a.2: grub gives only where to find root; initrd= is in builtin kernel command line

B.2.a.3: grub gives info about external CPIO; root= is in builtin kernel command line

B.2.a.4: Both informations are in builtin kernel command line (root= initrd=)

For B.2.b.1 until B.2.b.4 it is the same; just replace grub with UEFI

Now what is described in EFI_stub

This line:

efibootmgr --create --part 1 --disk /dev/sda --label "Gentoo" --loader '\efi\gentoo\bzImage-4.9.76-r1.efi' -u 'initrd=\efi\gentoo\initramfs.img'

tell us there is an external CPIO (so its clearly B.2) but there is no "root=", so it is B.2.b.3:

- external CPIO

- Stub kernel

- UEFI gives info about external CPIO

- root= is in builtin kernel command lin

If we now would do an embedded initramfs (instead an external CPIO), then we would not need the initrd= parameter and then we would have only B.1.b.1 or B.1.b.2 as choice.