Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) The EFI Boot Stub
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) On the x86 and ARM platforms, a kernel zImage/bzImage can masquerade
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) as a PE/COFF image, thereby convincing EFI firmware loaders to load
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) it as an EFI executable. The code that modifies the bzImage header,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) along with the EFI-specific entry point that the firmware loader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) jumps to are collectively known as the "EFI boot stub", and live in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) arch/x86/boot/header.S and arch/x86/boot/compressed/eboot.c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) respectively. For ARM the EFI stub is implemented in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) arch/arm/boot/compressed/efi-header.S and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) arch/arm/boot/compressed/efi-stub.c. EFI stub code that is shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) between architectures is in drivers/firmware/efi/libstub.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) For arm64, there is no compressed kernel support, so the Image itself
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) masquerades as a PE/COFF image and the EFI stub is linked into the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) kernel. The arm64 EFI stub lives in arch/arm64/kernel/efi-entry.S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) and drivers/firmware/efi/libstub/arm64-stub.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) By using the EFI boot stub it's possible to boot a Linux kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) without the use of a conventional EFI boot loader, such as grub or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) elilo. Since the EFI boot stub performs the jobs of a boot loader, in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) a certain sense it *IS* the boot loader.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) The EFI boot stub is enabled with the CONFIG_EFI_STUB kernel option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) How to install bzImage.efi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) --------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) The bzImage located in arch/x86/boot/bzImage must be copied to the EFI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) System Partition (ESP) and renamed with the extension ".efi". Without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) the extension the EFI firmware loader will refuse to execute it. It's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) not possible to execute bzImage.efi from the usual Linux file systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) because EFI firmware doesn't have support for them. For ARM the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) arch/arm/boot/zImage should be copied to the system partition, and it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) may not need to be renamed. Similarly for arm64, arch/arm64/boot/Image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) should be copied but not necessarily renamed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) Passing kernel parameters from the EFI shell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) --------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) Arguments to the kernel can be passed after bzImage.efi, e.g.::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	fs0:> bzImage.efi console=ttyS0 root=/dev/sda4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) The "initrd=" option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) --------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) Like most boot loaders, the EFI stub allows the user to specify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) multiple initrd files using the "initrd=" option. This is the only EFI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) stub-specific command line parameter, everything else is passed to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) kernel when it boots.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) The path to the initrd file must be an absolute path from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) beginning of the ESP, relative path names do not work. Also, the path
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) is an EFI-style path and directory elements must be separated with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) backslashes (\). For example, given the following directory layout::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)   fs0:>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	Kernels\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 			bzImage.efi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 			initrd-large.img
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	Ramdisks\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 			initrd-small.img
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 			initrd-medium.img
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) to boot with the initrd-large.img file if the current working
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) directory is fs0:\Kernels, the following command must be used::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	fs0:\Kernels> bzImage.efi initrd=\Kernels\initrd-large.img
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) Notice how bzImage.efi can be specified with a relative path. That's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) because the image we're executing is interpreted by the EFI shell,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) which understands relative paths, whereas the rest of the command line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) is passed to bzImage.efi.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) The "dtb=" option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) For the ARM and arm64 architectures, a device tree must be provided to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) the kernel. Normally firmware shall supply the device tree via the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) EFI CONFIGURATION TABLE. However, the "dtb=" command line option can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) be used to override the firmware supplied device tree, or to supply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) one when firmware is unable to.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) Please note: Firmware adds runtime configuration information to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) device tree before booting the kernel. If dtb= is used to override
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) the device tree, then any runtime data provided by firmware will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) lost. The dtb= option should only be used either as a debug tool, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) as a last resort when a device tree is not provided in the EFI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) CONFIGURATION TABLE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) "dtb=" is processed in the same manner as the "initrd=" option that is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) described above.