xref: /linux/Documentation/arch/x86/x86_64/uefi.rst (revision e814f3fd16acfb7f9966773953de8f740a1e3202)
1.. SPDX-License-Identifier: GPL-2.0
2
3=====================================
4General note on [U]EFI x86_64 support
5=====================================
6
7The nomenclature EFI and UEFI are used interchangeably in this document.
8
9Although the tools below are _not_ needed for building the kernel,
10the needed bootloader support and associated tools for x86_64 platforms
11with EFI firmware and specifications are listed below.
12
131. UEFI specification:  http://www.uefi.org
14
152. Booting Linux kernel on UEFI x86_64 platform can either be
16   done using the <Documentation/admin-guide/efi-stub.rst> or using a
17   separate bootloader.
18
193. x86_64 platform with EFI/UEFI firmware.
20
21Mechanics
22---------
23
24Refer to <Documentation/admin-guide/efi-stub.rst> to learn how to use the EFI stub.
25
26Below are general EFI setup guidelines on the x86_64 platform,
27regardless of whether you use the EFI stub or a separate bootloader.
28
29- Build the kernel with the following configuration::
30
31	CONFIG_FB_EFI=y
32	CONFIG_FRAMEBUFFER_CONSOLE=y
33
34  If EFI runtime services are expected, the following configuration should
35  be selected::
36
37	CONFIG_EFI=y
38	CONFIG_EFIVAR_FS=y or m		# optional
39
40- Create a VFAT partition on the disk with the EFI System flag
41    You can do this with fdisk with the following commands:
42
43        1. g - initialize a GPT partition table
44        2. n - create a new partition
45        3. t - change the partition type to "EFI System" (number 1)
46        4. w - write and save the changes
47
48    Afterwards, initialize the VFAT filesystem by running mkfs::
49
50        mkfs.fat /dev/<your-partition>
51
52- Copy the boot files to the VFAT partition:
53    If you use the EFI stub method, the kernel acts also as an EFI executable.
54
55    You can just copy the bzImage to the EFI/boot/bootx64.efi path on the partition
56    so that it will automatically get booted, see the <Documentation/admin-guide/efi-stub.rst> page
57    for additional instructions regarding passage of kernel parameters and initramfs.
58
59    If you use a custom bootloader, refer to the relevant documentation for help on this part.
60
61- If some or all EFI runtime services don't work, you can try following
62  kernel command line parameters to turn off some or all EFI runtime
63  services.
64
65	noefi
66		turn off all EFI runtime services
67	reboot_type=k
68		turn off EFI reboot runtime service
69
70- If the EFI memory map has additional entries not in the E820 map,
71  you can include those entries in the kernels memory map of available
72  physical RAM by using the following kernel command line parameter.
73
74	add_efi_memmap
75		include EFI memory map of available physical RAM
76