[756a787] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="grub-setup" xreflabel="Using GRUB to Set Up the Boot Process with UEFI">
|
---|
| 9 | <?dbhtml filename="grub-setup.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info>
|
---|
[fda29e4] | 12 | <date>$Date$</date>
|
---|
[756a787] | 13 | </sect1info>
|
---|
| 14 |
|
---|
| 15 | <title>Using GRUB to Set Up the Boot Process with UEFI</title>
|
---|
| 16 |
|
---|
| 17 | <sect2>
|
---|
| 18 | <title>Turn Off Secure Boot</title>
|
---|
| 19 |
|
---|
| 20 | <para>
|
---|
[d5cc78a] | 21 | BLFS does not have the essential packages to support Secure Boot. To
|
---|
[756a787] | 22 | set up the boot process with GRUB for UEFI installed in BLFS, Secure
|
---|
| 23 | Boot must be turned off from the configuration interface of the
|
---|
| 24 | firmware. Read the documentation provided by the manufacturer of your
|
---|
| 25 | system to find out how.
|
---|
| 26 | </para>
|
---|
| 27 | </sect2>
|
---|
| 28 |
|
---|
| 29 | <sect2>
|
---|
| 30 | <title>Create an Emergency Boot Disk</title>
|
---|
| 31 |
|
---|
| 32 | <para>
|
---|
| 33 | Ensure that an emergency boot disk is ready to <quote>rescue</quote>
|
---|
[d5cc78a] | 34 | the system in case the system becomes un-bootable. To make an
|
---|
| 35 | emergency boot disk with GRUB for an EFI based system, find a spare
|
---|
[756a787] | 36 | USB flash drive and create a
|
---|
| 37 | <systemitem class="filesystem">vfat</systemitem> file system on it.
|
---|
| 38 | Install <xref linkend="dosfstools"/> first, then
|
---|
| 39 | as the <systemitem class="username">root</systemitem> user:
|
---|
| 40 | </para>
|
---|
| 41 |
|
---|
| 42 | <warning>
|
---|
| 43 | <para>
|
---|
| 44 | The following command will erase all directories and files in the
|
---|
| 45 | partition. Make sure your USB flash drive contains no data which
|
---|
| 46 | will be needed, and change <userinput>sdx1</userinput> to the
|
---|
| 47 | device node corresponding to the first partition of the USB flash
|
---|
| 48 | drive. Be careful not to overwrite your hard drive with a typo!
|
---|
| 49 | </para>
|
---|
| 50 | </warning>
|
---|
| 51 |
|
---|
| 52 | <screen role="nodump"><userinput>mkfs.vfat /dev/sdx1</userinput></screen>
|
---|
| 53 |
|
---|
| 54 | <para>
|
---|
| 55 | Still as the <systemitem class="username">root</systemitem> user, use
|
---|
[b9c353b] | 56 | the <command>fdisk</command> utility to set the first partition
|
---|
[756a787] | 57 | of the USB flash drive to be an <quote>EFI system</quote> partition
|
---|
| 58 | (change <userinput>sdx</userinput> to the device node corresponding
|
---|
| 59 | to your USB flash drive):
|
---|
| 60 | </para>
|
---|
| 61 |
|
---|
| 62 | <screen role="nodump"><userinput>fdisk /dev/sdx</userinput>
|
---|
| 63 | <literal>
|
---|
[16f7f0e] | 64 | Welcome to fdisk (util-linux 2.38.1).
|
---|
[756a787] | 65 | Changes will remain in memory only, until you decide to write them.
|
---|
| 66 | Be careful before using the write command.
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | Command (m for help): </literal><userinput>t</userinput>
|
---|
[43397b0e] | 70 | <literal>Partition number (1-9, default 9): </literal><userinput>1</userinput>
|
---|
| 71 | <literal>Partition type or alias (type L to list all): </literal><userinput>uefi</userinput>
|
---|
| 72 | <literal>Changed type of partition 'Linux filesystem' to 'EFI System'.
|
---|
[756a787] | 73 |
|
---|
| 74 | Command (m for help): </literal><userinput>w</userinput>
|
---|
| 75 | <literal>The partition table has been altered.
|
---|
| 76 | Calling ioctl() to re-read partition table.
|
---|
| 77 | Syncing disks.</literal></screen>
|
---|
| 78 |
|
---|
| 79 | <para>
|
---|
| 80 | Still as the <systemitem class="username">root</systemitem> user,
|
---|
| 81 | create a mount point for the EFI partition on the USB flash drive
|
---|
| 82 | and mount it:
|
---|
| 83 | </para>
|
---|
| 84 |
|
---|
| 85 | <screen role="nodump"><userinput>mkdir -pv /mnt/rescue &&
|
---|
| 86 | mount -v -t vfat /dev/sdx1 /mnt/rescue</userinput></screen>
|
---|
| 87 |
|
---|
| 88 | <para>
|
---|
| 89 | Install GRUB for EFI on the partition:
|
---|
| 90 | </para>
|
---|
| 91 |
|
---|
| 92 | <screen role="nodump"><userinput>grub-install --removable --efi-directory=/mnt/rescue --boot-directory=/mnt/rescue/grub</userinput></screen>
|
---|
| 93 |
|
---|
| 94 | <para>
|
---|
| 95 | Unmount the partition:
|
---|
| 96 | </para>
|
---|
| 97 |
|
---|
| 98 | <screen role="nodump"><userinput>umount /mnt/rescue</userinput></screen>
|
---|
| 99 |
|
---|
| 100 | <para>
|
---|
| 101 | Now the USB flash drive can be used as a emergency boot disk on x86-64
|
---|
[d5cc78a] | 102 | UEFI platform. It will boot the system and show the GRUB shell. Then you
|
---|
| 103 | can type commands to boot your operating systems on the hard drive.
|
---|
| 104 | To learn how to select the boot device, read the manual of your
|
---|
[756a787] | 105 | motherboard or laptop.
|
---|
| 106 | </para>
|
---|
| 107 |
|
---|
| 108 | </sect2>
|
---|
| 109 |
|
---|
| 110 | <sect2 role="kernel" id="uefi-kernel">
|
---|
| 111 | <title>Kernel Configuration for UEFI support</title>
|
---|
| 112 |
|
---|
| 113 | <para>
|
---|
| 114 | Enable the following options in the kernel configuration and recompile
|
---|
| 115 | the kernel if necessary:
|
---|
| 116 | </para>
|
---|
| 117 |
|
---|
| 118 | <screen><literal>Processor type and features --->
|
---|
| 119 | [*] EFI runtime service support [CONFIG_EFI]
|
---|
| 120 | [*] EFI stub support [CONFIG_EFI_STUB]
|
---|
| 121 | Enable the block layer --->
|
---|
| 122 | Partition Types --->
|
---|
| 123 | [*] Advanced partition selection [CONFIG_PARTITION_ADVANCED]
|
---|
| 124 | [*] EFI GUID Partition support [CONFIG_EFI_PARTITION]
|
---|
| 125 | Device Drivers --->
|
---|
[62d4a239] | 126 | Firmware Drivers --->
|
---|
[217e54c9] | 127 | [*] Mark VGA/VBE/EFI FB as generic system framebuffer [CONFIG_SYSFB_SIMPLEFB]
|
---|
[62d4a239] | 128 | EFI (Extensible Firmware Interface) Support --->
|
---|
| 129 | < > EFI Variable Support via sysfs [CONFIG_EFI_VARS]
|
---|
| 130 | [*] Export efi runtime maps to sysfs [CONFIG_EFI_RUNTIME_MAP]
|
---|
[756a787] | 131 | Graphics support --->
|
---|
[217e54c9] | 132 | <*> Direct Rendering Manager [CONFIG_DRM]
|
---|
| 133 | <*> Simple framebuffer driver [CONFIG_SIMPLEDRM]
|
---|
[756a787] | 134 | Frame buffer Devices --->
|
---|
[217e54c9] | 135 | <*> Support for frame buffer devices ---> [CONFIG_FB]
|
---|
[756a787] | 136 | Console display driver support --->
|
---|
| 137 | [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE]
|
---|
| 138 | File systems --->
|
---|
| 139 | Pseudo filesystems --->
|
---|
| 140 | <*/M> EFI Variable filesystem [CONFIG_EFIVAR_FS]</literal></screen>
|
---|
| 141 |
|
---|
| 142 | <variablelist>
|
---|
| 143 | <title>The meaning of the configure options:</title>
|
---|
| 144 |
|
---|
| 145 | <varlistentry>
|
---|
| 146 | <term><parameter>CONFIG_EFI_STUB</parameter></term>
|
---|
| 147 | <listitem>
|
---|
[d5cc78a] | 148 | <para>Although the EFI stub is designed to boot a kernel directly from
|
---|
| 149 | the UEFI firmware (without a bootloader like GRUB), GRUB needs the
|
---|
| 150 | kernel to be loaded to support the EFI handover protocol enabled by
|
---|
[756a787] | 151 | this option.</para>
|
---|
| 152 | </listitem>
|
---|
| 153 | </varlistentry>
|
---|
| 154 |
|
---|
| 155 | <varlistentry>
|
---|
| 156 | <term><parameter>CONFIG_EFI_VARS</parameter></term>
|
---|
| 157 | <listitem>
|
---|
[d5cc78a] | 158 | <para>Don't use this deprecated option because of a 1024-byte
|
---|
[756a787] | 159 | variable size limit. Its function is replaced by
|
---|
| 160 | <parameter>CONFIG_EFIVAR_FS</parameter>.</para>
|
---|
| 161 | </listitem>
|
---|
| 162 | </varlistentry>
|
---|
| 163 |
|
---|
| 164 | <varlistentry>
|
---|
[217e54c9] | 165 | <term>
|
---|
| 166 | <parameter>CONFIG_SYSFB_SIMPLEFB</parameter>,
|
---|
| 167 | <parameter>CONFIG_DRM</parameter>,
|
---|
| 168 | <parameter>CONFIG_SIMPLEDRM</parameter>,
|
---|
| 169 | <parameter>CONFIG_FB</parameter>, and
|
---|
| 170 | <parameter>CONFIG_FRAMEBUFFER_CONSOLE</parameter></term>
|
---|
[756a787] | 171 | <listitem>
|
---|
[217e54c9] | 172 | <para>The combination of these options allows the kernel to
|
---|
[356e8b5f] | 173 | print debug messages (along with Tux logos) at the early stage of
|
---|
[217e54c9] | 174 | the boot process with UEFI. To ensure them functional at the early
|
---|
| 175 | stage, they shouldn't be built as a kernel module unless an
|
---|
| 176 | initramfs will be used.</para>
|
---|
[756a787] | 177 | </listitem>
|
---|
| 178 | </varlistentry>
|
---|
| 179 |
|
---|
| 180 | </variablelist>
|
---|
| 181 |
|
---|
| 182 | </sect2>
|
---|
| 183 |
|
---|
| 184 | <sect2>
|
---|
| 185 | <title>Find or Create the EFI System Partition</title>
|
---|
| 186 |
|
---|
| 187 | <para>
|
---|
| 188 | On EFI based system, the bootloaders are installed in a special FAT32
|
---|
[d5cc78a] | 189 | partition called an <emphasis>EFI System Partition</emphasis> (ESP).
|
---|
[756a787] | 190 | If your system supports EFI, and a recent version of Linux
|
---|
| 191 | distribution or Windows is pre-installed, it's likely that the ESP
|
---|
| 192 | is already created. As the
|
---|
| 193 | <systemitem class="username">root</systemitem> user, list all the
|
---|
| 194 | partitions on your hard drive (replace <userinput>sda</userinput>
|
---|
[d5cc78a] | 195 | with the device corresponding to the appropriate hard drive):
|
---|
[756a787] | 196 | </para>
|
---|
| 197 |
|
---|
| 198 | <screen role="nodump"><userinput>fdisk -l /dev/sda</userinput></screen>
|
---|
| 199 |
|
---|
| 200 | <para>
|
---|
| 201 | The <quote>Type</quote> column of the ESP should be
|
---|
| 202 | <literal>EFI System</literal>.
|
---|
| 203 | </para>
|
---|
| 204 |
|
---|
| 205 | <para>
|
---|
[8558044] | 206 | If the system or the hard drive is new, or it's a first time
|
---|
[d5cc78a] | 207 | install an UEFI booted OS on the system, the ESP may not exist.
|
---|
| 208 | In that case, create a new partition, make a
|
---|
[756a787] | 209 | <systemitem class="filesystem">vfat</systemitem> file system on it,
|
---|
[d5cc78a] | 210 | and set the partition type to <quote>EFI system</quote>. See the
|
---|
[756a787] | 211 | instructions for the emergency boot device above as a reference.
|
---|
| 212 | </para>
|
---|
| 213 |
|
---|
| 214 | <warning>
|
---|
| 215 | <para>
|
---|
| 216 | Some (old) UEFI implementations may demand the ESP to be the first
|
---|
| 217 | partition on the disk.
|
---|
| 218 | </para>
|
---|
| 219 | </warning>
|
---|
| 220 |
|
---|
| 221 | <para>
|
---|
| 222 | Now, as the <systemitem class="username">root</systemitem> user,
|
---|
| 223 | create the mount point for the ESP, and mount it (replace
|
---|
| 224 | <userinput>sda1</userinput> with the device node corresponding to
|
---|
| 225 | the ESP):
|
---|
| 226 | </para>
|
---|
| 227 |
|
---|
| 228 | <screen role="nodump"><userinput>mkdir -pv /boot/efi &&
|
---|
| 229 | mount -v -t vfat /dev/sda1 /boot/efi</userinput></screen>
|
---|
| 230 |
|
---|
| 231 | <para>
|
---|
[d5cc78a] | 232 | Add an entry for the ESP in
|
---|
[756a787] | 233 | <filename>/etc/fstab</filename>, so it will be mounted automatically
|
---|
| 234 | during system boot:
|
---|
| 235 | </para>
|
---|
| 236 |
|
---|
| 237 | <screen role="nodump"><userinput>cat >> /etc/fstab << EOF</userinput>
|
---|
| 238 | <literal>/dev/sda1 /boot/efi vfat defaults 0 1</literal>
|
---|
| 239 | <userinput>EOF</userinput></screen>
|
---|
| 240 |
|
---|
| 241 | </sect2>
|
---|
| 242 |
|
---|
| 243 | <sect2>
|
---|
| 244 | <title>Mount the EFI Variable File System</title>
|
---|
| 245 |
|
---|
| 246 | <para>
|
---|
[d5cc78a] | 247 | The installation of GRUB on a UEFI platform requires that the EFI Variable
|
---|
| 248 | file system, <systemitem class="filesystem">efivarfs</systemitem>, to be
|
---|
[564a569] | 249 | mounted. As the <systemitem class="username">root</systemitem> user,
|
---|
| 250 | mount it if it's not already mounted:
|
---|
[756a787] | 251 | </para>
|
---|
| 252 |
|
---|
[564a569] | 253 | <screen role="nodump"><userinput>mountpoint /sys/firmware/efi/efivars || mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars</userinput></screen>
|
---|
[756a787] | 254 |
|
---|
| 255 | <note revision="systemd">
|
---|
| 256 | <para>
|
---|
| 257 | If the system is booted with UEFI and systemd,
|
---|
| 258 | <systemitem class="filesystem">efivarfs</systemitem> will be mounted
|
---|
[d5cc78a] | 259 | automatically. However in the LFS chroot environment it still needs to
|
---|
[756a787] | 260 | be mounted manually.
|
---|
| 261 | </para>
|
---|
| 262 | </note>
|
---|
| 263 |
|
---|
| 264 | <para revision="sysv">
|
---|
[d5cc78a] | 265 | Now add an entry for the
|
---|
[756a787] | 266 | <systemitem class="filesystem">efivarfs</systemitem> in
|
---|
[d5cc78a] | 267 | <filename>/etc/fstab</filename> so it will be mounted automatically
|
---|
[756a787] | 268 | during system boot:
|
---|
| 269 | </para>
|
---|
| 270 |
|
---|
| 271 | <screen revision="sysv" role="nodump"><userinput>cat >> /etc/fstab << EOF</userinput>
|
---|
[6ca17c82] | 272 | <literal>efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0</literal>
|
---|
[756a787] | 273 | <userinput>EOF</userinput></screen>
|
---|
| 274 |
|
---|
| 275 | <warning>
|
---|
| 276 | <para>
|
---|
| 277 | If the system is not booted with UEFI, the directory
|
---|
| 278 | <filename class="directory">/sys/firmware/efi</filename> will be
|
---|
| 279 | missing. In this case you should boot the system in UEFI mode with
|
---|
| 280 | the emergency boot disk created as above.
|
---|
| 281 | </para>
|
---|
| 282 | </warning>
|
---|
| 283 | </sect2>
|
---|
| 284 |
|
---|
| 285 | <sect2>
|
---|
| 286 | <title>Setting Up the Configuration</title>
|
---|
| 287 |
|
---|
| 288 | <para>
|
---|
| 289 | On UEFI based systems, GRUB works by installing an EFI application
|
---|
[d5cc78a] | 290 | (a special kind of executable) into
|
---|
[756a787] | 291 | <filename class="directory">/boot/efi/EFI/[id]/grubx64.efi</filename>,
|
---|
| 292 | where <filename class="directory">/boot/efi</filename> is the mount
|
---|
| 293 | point of the ESP, and <literal>[id]</literal> is replaced with an
|
---|
| 294 | identifier specified in the <command>grub-install</command> command
|
---|
[d5cc78a] | 295 | line. GRUB will create an entry in the EFI variables containing
|
---|
| 296 | the path <literal>EFI/[id]/grubx64.efi</literal> so the EFI firmware
|
---|
[756a787] | 297 | can find <filename>grubx64.efi</filename> and load it.
|
---|
| 298 | </para>
|
---|
| 299 |
|
---|
| 300 | <para>
|
---|
| 301 | <filename>grubx64.efi</filename> is very lightweight (136 KB with
|
---|
[16f7f0e] | 302 | GRUB-2.06) so it will not use much space in the ESP. A typical ESP
|
---|
[d5cc78a] | 303 | size is 100 MB (for Windows boot manager, which uses about 50 MB in
|
---|
[756a787] | 304 | the ESP). Once <filename>grubx64.efi</filename> loaded by the
|
---|
| 305 | firmware, it will load GRUB modules in the boot partition.
|
---|
| 306 | The default location is
|
---|
| 307 | <filename class="directory">/boot/grub</filename>.
|
---|
| 308 | </para>
|
---|
| 309 |
|
---|
| 310 | <para>
|
---|
| 311 | As the <systemitem class="username">root</systemitem> user, install
|
---|
| 312 | the GRUB files into <filename>/boot/efi/EFI/LFS/grubx64.efi</filename>
|
---|
[d5cc78a] | 313 | and <filename class="directory">/boot/grub</filename>. Then set up the
|
---|
[756a787] | 314 | boot entry in the EFI variables:
|
---|
| 315 | </para>
|
---|
| 316 |
|
---|
| 317 | <screen role="nodump"><userinput>grub-install --bootloader-id=LFS --recheck</userinput></screen>
|
---|
| 318 |
|
---|
| 319 | <para>
|
---|
| 320 | If the installation is successful, the output should be:
|
---|
| 321 | </para>
|
---|
| 322 |
|
---|
| 323 | <screen role="nodump"><literal>Installing for x86_64-efi platform.
|
---|
| 324 | Installation finished. No error reported.</literal></screen>
|
---|
| 325 |
|
---|
| 326 | <para>
|
---|
[aebcd92c] | 327 | Issue <command>efibootmgr | cut -f 1</command> to recheck the EFI boot
|
---|
[756a787] | 328 | configuration. An example of the output is:
|
---|
| 329 | </para>
|
---|
| 330 |
|
---|
| 331 | <screen role="nodump"><literal>BootCurrent: 0000
|
---|
| 332 | Timeout: 1 seconds
|
---|
| 333 | BootOrder: 0005,0000,0002,0001,0003,0004
|
---|
| 334 | Boot0000* ARCH
|
---|
| 335 | Boot0001* UEFI:CD/DVD Drive
|
---|
| 336 | Boot0002* Windows Boot Manager
|
---|
| 337 | Boot0003* UEFI:Removable Device
|
---|
| 338 | Boot0004* UEFI:Network Device
|
---|
| 339 | Boot0005* LFS</literal></screen>
|
---|
| 340 |
|
---|
| 341 | <para>
|
---|
[d5cc78a] | 342 | Note that <literal>0005</literal> is the first in the
|
---|
[756a787] | 343 | <literal>BootOrder</literal>, and <literal>Boot0005</literal>
|
---|
[8558044] | 344 | is <literal>LFS</literal>. This means that on the next boot, the
|
---|
[d5cc78a] | 345 | version of GRUB installed by LFS will be used to boot the system.
|
---|
[756a787] | 346 | </para>
|
---|
| 347 |
|
---|
| 348 | </sect2>
|
---|
| 349 |
|
---|
| 350 | <sect2>
|
---|
| 351 | <title>Creating the GRUB Configuration File</title>
|
---|
| 352 |
|
---|
| 353 | <indexterm zone="grub-setup grub-video">
|
---|
| 354 | <primary sortas="e-boot-grub-grub-cfg">/boot/grub/grub.cfg</primary>
|
---|
| 355 | </indexterm>
|
---|
| 356 |
|
---|
| 357 | <para>
|
---|
| 358 | Generate <filename>/boot/grub/grub.cfg</filename> to configure the
|
---|
| 359 | boot menu of GRUB:
|
---|
| 360 | </para>
|
---|
| 361 |
|
---|
| 362 | <screen role="nodump"><userinput>cat > /boot/grub/grub.cfg << EOF</userinput>
|
---|
| 363 | <literal># Begin /boot/grub/grub.cfg
|
---|
| 364 | set default=0
|
---|
| 365 | set timeout=5
|
---|
| 366 |
|
---|
| 367 | insmod part_gpt
|
---|
| 368 | insmod ext2
|
---|
| 369 | set root=(hd0,2)
|
---|
| 370 |
|
---|
| 371 | if loadfont /boot/grub/fonts/unicode.pf2; then
|
---|
| 372 | set gfxmode=auto
|
---|
| 373 | insmod all_video
|
---|
| 374 | terminal_output gfxterm
|
---|
| 375 | fi
|
---|
| 376 |
|
---|
[16f7f0e] | 377 | menuentry "GNU/Linux, Linux 5.19.2-lfs-11.2" {
|
---|
| 378 | linux /boot/vmlinuz-5.19.2-lfs-11.2 root=/dev/sda2 ro
|
---|
[756a787] | 379 | }
|
---|
| 380 |
|
---|
| 381 | menuentry "Firmware Setup" {
|
---|
| 382 | fwsetup
|
---|
| 383 | }</literal>
|
---|
| 384 | <userinput>EOF</userinput></screen>
|
---|
| 385 |
|
---|
| 386 | <para>
|
---|
| 387 | <literal>(hd0,2)</literal>, <literal>sda2</literal>, and
|
---|
[16f7f0e] | 388 | <literal>5.19.2-lfs-11.2</literal> should be replaced to match your
|
---|
[756a787] | 389 | configuration.
|
---|
| 390 | </para>
|
---|
| 391 |
|
---|
| 392 | <note>
|
---|
| 393 | <para>
|
---|
| 394 | From GRUB's perspective, the files are relative to the partition
|
---|
[d5cc78a] | 395 | are used. If you used a separate /boot partition, remove /boot from the
|
---|
[756a787] | 396 | above paths (to kernel and to <filename>unicode.pf2</filename>). You
|
---|
| 397 | will also need to change the set root line to point to the boot
|
---|
| 398 | partition.
|
---|
| 399 | </para>
|
---|
| 400 | </note>
|
---|
| 401 |
|
---|
| 402 | <para>
|
---|
| 403 | The <literal>Firmware Setup</literal> entry can be used to enter the
|
---|
| 404 | configuration interface provided by the firmware (sometimes called
|
---|
[9039d65] | 405 | <quote>BIOS configuration</quote>).
|
---|
[756a787] | 406 | </para>
|
---|
| 407 | </sect2>
|
---|
| 408 |
|
---|
| 409 | <sect2>
|
---|
| 410 | <title>Dual-booting with Windows</title>
|
---|
| 411 |
|
---|
| 412 | <para>
|
---|
| 413 | Add a menu entry for Windows into <filename>grub.cfg</filename>:
|
---|
| 414 | </para>
|
---|
| 415 |
|
---|
| 416 | <screen role="nodump"><userinput>cat >> /boot/grub/grub.cfg << EOF</userinput>
|
---|
| 417 | <literal># Begin Windows addition
|
---|
| 418 |
|
---|
[16f7f0e] | 419 | menuentry "Windows 11" {
|
---|
[756a787] | 420 | insmod fat
|
---|
| 421 | insmod chain
|
---|
| 422 | set root=(hd0,1)
|
---|
| 423 | chainloader /EFI/Microsoft/Boot/bootmgfw.efi
|
---|
| 424 | }</literal>
|
---|
| 425 | <userinput>EOF</userinput></screen>
|
---|
| 426 |
|
---|
| 427 | <para>
|
---|
| 428 | <literal>(hd0,1)</literal> should be replaced with the GRUB
|
---|
[d5cc78a] | 429 | designated name for the ESP. The <literal>chainloader</literal>
|
---|
[756a787] | 430 | directive can be used to tell GRUB to run another EFI executable,
|
---|
| 431 | in this case the Windows Boot Manager. You may put more usable tools
|
---|
[8558044] | 432 | in EFI executable format (for example, an EFI shell) into the ESP and
|
---|
[756a787] | 433 | create GRUB entries for them.
|
---|
| 434 | </para>
|
---|
| 435 |
|
---|
| 436 | </sect2>
|
---|
| 437 |
|
---|
| 438 | </sect1>
|
---|