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-IN Kernel Command Line" WITH: root=/dev/sdXY OR root=PARTUUID=...

1.b.1: You do "hardcode" this INTO the kernel in "BUILT-IN 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 !!!

In every case you can use root=/dev/sdXY ... This will ALWAYS work ... but it is not recommended (because you can have troubles when you have accicently an USB stick in your computer).

a) If this script uses external mount command, then it is able to use also root=PARTUUID=... (because "normal" mount command understand this).

b) If this script uses internal mount command from busybox, then you can use only additionally root=LABEL=... OR root=UUID=... (Tested with busybox version 1.34.1)

In this script Early_Userspace_Mounting internal mount command from busybox is used, and it would fail if you use root=PARTUUID=...

(Maybe our gen-kernel uses normal mount command is therefore able to use root=PARTUUID=...; this I dont know)

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-IN 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-IN 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 you dont like so a "mixed" solution, you can also use a B.2.b.1 solution (UEFI gives both to kernel):

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

OR

a B.2.b.4 solution (both is in builtin kernel command line):

[*] Built-in kernel command line (root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx initrd=\efi\gentoo\initramfs.img) Built-in kernel command string

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.

Late edit: Another example is our bin-kernel ...

In EFI_stub it is said to use this (because user can not edit kernel config = builtin kernel command line):

efibootmgr -c -L "Gentoo Linux" -l '\EFI\Gentoo\bootx64.efi' -u 'root=PARTUUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'

This means it is either a B.1.b.2 solution OR a B.2.b.2 solution (I really dont know if bin-kernel uses an external initramfs or a builtin)