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