Blame view
Documentation/efi-stub.txt
3.3 KB
ef16bcc7f efi-stub.txt: sta... |
1 2 3 |
================= The EFI Boot Stub ================= |
0c7596621 x86, efi: Add EFI... |
4 |
|
719e28436 doc: efi-stub.txt... |
5 6 7 8 9 |
On the x86 and ARM platforms, a kernel zImage/bzImage can masquerade as a PE/COFF image, thereby convincing EFI firmware loaders to load it as an EFI executable. The code that modifies the bzImage header, along with the EFI-specific entry point that the firmware loader jumps to are collectively known as the "EFI boot stub", and live in |
0c7596621 x86, efi: Add EFI... |
10 |
arch/x86/boot/header.S and arch/x86/boot/compressed/eboot.c, |
719e28436 doc: efi-stub.txt... |
11 12 13 |
respectively. For ARM the EFI stub is implemented in arch/arm/boot/compressed/efi-header.S and arch/arm/boot/compressed/efi-stub.c. EFI stub code that is shared |
3bb9eee61 doc: efi-stub.txt... |
14 |
between architectures is in drivers/firmware/efi/libstub. |
0c7596621 x86, efi: Add EFI... |
15 |
|
cdd785789 doc: arm64: add d... |
16 17 18 |
For arm64, there is no compressed kernel support, so the Image itself masquerades as a PE/COFF image and the EFI stub is linked into the kernel. The arm64 EFI stub lives in arch/arm64/kernel/efi-entry.S |
3bb9eee61 doc: efi-stub.txt... |
19 |
and drivers/firmware/efi/libstub/arm64-stub.c. |
cdd785789 doc: arm64: add d... |
20 |
|
0c7596621 x86, efi: Add EFI... |
21 22 23 24 25 26 |
By using the EFI boot stub it's possible to boot a Linux kernel without the use of a conventional EFI boot loader, such as grub or elilo. Since the EFI boot stub performs the jobs of a boot loader, in a certain sense it *IS* the boot loader. The EFI boot stub is enabled with the CONFIG_EFI_STUB kernel option. |
ef16bcc7f efi-stub.txt: sta... |
27 28 |
How to install bzImage.efi -------------------------- |
0c7596621 x86, efi: Add EFI... |
29 30 |
The bzImage located in arch/x86/boot/bzImage must be copied to the EFI |
bf6518835 doc: Fix trivial ... |
31 |
System Partition (ESP) and renamed with the extension ".efi". Without |
0c7596621 x86, efi: Add EFI... |
32 33 |
the extension the EFI firmware loader will refuse to execute it. It's not possible to execute bzImage.efi from the usual Linux file systems |
719e28436 doc: efi-stub.txt... |
34 35 |
because EFI firmware doesn't have support for them. For ARM the arch/arm/boot/zImage should be copied to the system partition, and it |
cdd785789 doc: arm64: add d... |
36 37 |
may not need to be renamed. Similarly for arm64, arch/arm64/boot/Image should be copied but not necessarily renamed. |
0c7596621 x86, efi: Add EFI... |
38 |
|
ef16bcc7f efi-stub.txt: sta... |
39 40 |
Passing kernel parameters from the EFI shell -------------------------------------------- |
0c7596621 x86, efi: Add EFI... |
41 |
|
ef16bcc7f efi-stub.txt: sta... |
42 |
Arguments to the kernel can be passed after bzImage.efi, e.g.:: |
0c7596621 x86, efi: Add EFI... |
43 44 |
fs0:> bzImage.efi console=ttyS0 root=/dev/sda4 |
ef16bcc7f efi-stub.txt: sta... |
45 46 |
The "initrd=" option -------------------- |
0c7596621 x86, efi: Add EFI... |
47 48 49 50 51 52 53 54 55 |
Like most boot loaders, the EFI stub allows the user to specify multiple initrd files using the "initrd=" option. This is the only EFI stub-specific command line parameter, everything else is passed to the kernel when it boots. The path to the initrd file must be an absolute path from the beginning of the ESP, relative path names do not work. Also, the path is an EFI-style path and directory elements must be separated with |
ef16bcc7f efi-stub.txt: sta... |
56 |
backslashes (\). For example, given the following directory layout:: |
0c7596621 x86, efi: Add EFI... |
57 |
|
ef16bcc7f efi-stub.txt: sta... |
58 |
fs0:> |
0c7596621 x86, efi: Add EFI... |
59 60 61 62 63 64 65 66 67 |
Kernels\ bzImage.efi initrd-large.img Ramdisks\ initrd-small.img initrd-medium.img to boot with the initrd-large.img file if the current working |
ef16bcc7f efi-stub.txt: sta... |
68 |
directory is fs0:\Kernels, the following command must be used:: |
0c7596621 x86, efi: Add EFI... |
69 70 71 72 73 74 75 |
fs0:\Kernels> bzImage.efi initrd=\Kernels\initrd-large.img Notice how bzImage.efi can be specified with a relative path. That's because the image we're executing is interpreted by the EFI shell, which understands relative paths, whereas the rest of the command line is passed to bzImage.efi. |
719e28436 doc: efi-stub.txt... |
76 |
|
ef16bcc7f efi-stub.txt: sta... |
77 78 |
The "dtb=" option ----------------- |
719e28436 doc: efi-stub.txt... |
79 |
|
cdd785789 doc: arm64: add d... |
80 81 |
For the ARM and arm64 architectures, we also need to be able to provide a device tree to the kernel. This is done with the "dtb=" command line option, |
719e28436 doc: efi-stub.txt... |
82 83 |
and is processed in the same manner as the "initrd=" option that is described above. |