Changeset 31ef72a9 for postlfs/filesystems/uefi-bootloaders/grub-setup.xml
- Timestamp:
- 08/17/2023 02:36:02 AM (14 months ago)
- Branches:
- 12.0, 12.1, 12.2, gimp3, ken/TL2024, ken/tuningfonts, lazarus, plabs/newcss, python3.11, rahul/power-profiles-daemon, renodr/vulkan-addition, trunk, xry111/for-12.3, xry111/llvm18, xry111/spidermonkey128
- Children:
- 0f33c8c
- Parents:
- e282f70
- git-author:
- Xi Ruoyao <xry111@…> (08/17/2023 02:26:51 AM)
- git-committer:
- Xi Ruoyao <xry111@…> (08/17/2023 02:36:02 AM)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
postlfs/filesystems/uefi-bootloaders/grub-setup.xml
re282f70 r31ef72a9 22 22 system to find out how. 23 23 </para> 24 </sect2>25 26 <sect2>27 <title>Create an Emergency Boot Disk</title>28 29 <para>30 Ensure that an emergency boot disk is ready to <quote>rescue</quote>31 the system in case the system becomes un-bootable. To make an32 emergency boot disk with GRUB for an EFI based system, find a spare33 USB flash drive and create a34 <systemitem class="filesystem">vfat</systemitem> file system on it.35 Install <xref linkend="dosfstools"/> first, then36 as the <systemitem class="username">root</systemitem> user:37 </para>38 39 <warning>40 <para>41 The following command will erase all directories and files in the42 partition. Make sure your USB flash drive contains no data which43 will be needed, and change <userinput>sdx1</userinput> to the44 device node corresponding to the first partition of the USB flash45 drive. Be careful not to overwrite your hard drive with a typo!46 </para>47 </warning>48 49 <screen role="nodump"><userinput>mkfs.vfat /dev/sdx1</userinput></screen>50 51 <para>52 Still as the <systemitem class="username">root</systemitem> user, use53 the <command>fdisk</command> utility to set the first partition54 of the USB flash drive to be an <quote>EFI system</quote> partition55 (change <userinput>sdx</userinput> to the device node corresponding56 to your USB flash drive):57 </para>58 59 <screen role="nodump"><userinput>fdisk /dev/sdx</userinput>60 <literal>61 Welcome to fdisk (util-linux 2.38.1).62 Changes will remain in memory only, until you decide to write them.63 Be careful before using the write command.64 65 66 Command (m for help): </literal><userinput>t</userinput>67 <literal>Partition number (1-9, default 9): </literal><userinput>1</userinput>68 <literal>Partition type or alias (type L to list all): </literal><userinput>uefi</userinput>69 <literal>Changed type of partition 'Linux filesystem' to 'EFI System'.70 71 Command (m for help): </literal><userinput>w</userinput>72 <literal>The partition table has been altered.73 Calling ioctl() to re-read partition table.74 Syncing disks.</literal></screen>75 76 <para>77 Still as the <systemitem class="username">root</systemitem> user,78 create a mount point for the EFI partition on the USB flash drive79 and mount it:80 </para>81 82 <screen role="nodump"><userinput>mkdir -pv /mnt/rescue &&83 mount -v -t vfat /dev/sdx1 /mnt/rescue</userinput></screen>84 85 <para>86 Install GRUB for EFI on the partition:87 </para>88 89 <screen role="nodump"><userinput>grub-install --target=x86_64-efi --removable --efi-directory=/mnt/rescue --boot-directory=/mnt/rescue</userinput></screen>90 91 <para>92 Unmount the partition:93 </para>94 95 <screen role="nodump"><userinput>umount /mnt/rescue</userinput></screen>96 97 <para>98 Now the USB flash drive can be used as an emergency boot disk on any x86-6499 UEFI platform. It will boot the system and show the GRUB shell. Then you100 can type commands to boot your operating system from the hard drive.101 To learn how to select the boot device, read the manual of your102 motherboard or laptop.103 </para>104 105 24 </sect2> 106 25 … … 154 73 155 74 <sect2> 75 <title>Create an Emergency Boot Disk</title> 76 77 <para> 78 Ensure that an emergency boot disk is ready to <quote>rescue</quote> 79 the system in case the system becomes un-bootable. To make an 80 emergency boot disk with GRUB for an EFI based system, find a spare 81 USB flash drive and create a 82 <systemitem class="filesystem">vfat</systemitem> file system on it. 83 Install <xref linkend="dosfstools"/> first, then 84 as the <systemitem class="username">root</systemitem> user: 85 </para> 86 87 <warning> 88 <para> 89 The following command will erase all directories and files in the 90 partition. Make sure your USB flash drive contains no data which 91 will be needed, and change <userinput>sdx1</userinput> to the 92 device node corresponding to the first partition of the USB flash 93 drive. Be careful not to overwrite your hard drive with a typo! 94 </para> 95 </warning> 96 97 <screen role="nodump"><userinput>mkfs.vfat /dev/sdx1</userinput></screen> 98 99 <para> 100 Still as the <systemitem class="username">root</systemitem> user, use 101 the <command>fdisk</command> utility to set the first partition 102 of the USB flash drive to be an <quote>EFI system</quote> partition 103 (change <userinput>sdx</userinput> to the device node corresponding 104 to your USB flash drive): 105 </para> 106 107 <screen role="nodump"><userinput>fdisk /dev/sdx</userinput> 108 <literal> 109 Welcome to fdisk (util-linux 2.38.1). 110 Changes will remain in memory only, until you decide to write them. 111 Be careful before using the write command. 112 113 114 Command (m for help): </literal><userinput>t</userinput> 115 <literal>Partition number (1-9, default 9): </literal><userinput>1</userinput> 116 <literal>Partition type or alias (type L to list all): </literal><userinput>uefi</userinput> 117 <literal>Changed type of partition 'Linux filesystem' to 'EFI System'. 118 119 Command (m for help): </literal><userinput>w</userinput> 120 <literal>The partition table has been altered. 121 Calling ioctl() to re-read partition table. 122 Syncing disks.</literal></screen> 123 124 <para> 125 Still as the <systemitem class="username">root</systemitem> user, 126 create a mount point for the EFI partition on the USB flash drive 127 and mount it: 128 </para> 129 130 <screen role="nodump"><userinput>mount --mkdir -v -t vfat /dev/sdx1 -o codepage=437,iocharset=iso8859-1 \ 131 /mnt/rescue</userinput></screen> 132 133 <para> 134 Install GRUB for EFI on the partition: 135 </para> 136 137 <screen role="nodump"><userinput>grub-install --target=x86_64-efi --removable \ 138 --efi-directory=/mnt/rescue --boot-directory=/mnt/rescue</userinput></screen> 139 140 <para> 141 Unmount the partition: 142 </para> 143 144 <screen role="nodump"><userinput>umount /mnt/rescue</userinput></screen> 145 146 <para> 147 Now the USB flash drive can be used as an emergency boot disk on any x86-64 148 UEFI platform. It will boot the system and show the GRUB shell. Then you 149 can type commands to boot your operating system from the hard drive. 150 To learn how to select the boot device, read the manual of your 151 motherboard or laptop. 152 </para> 153 154 </sect2> 155 156 <sect2> 156 157 <title>Find or Create the EFI System Partition</title> 157 158 … … 198 199 </para> 199 200 200 <screen role="nodump"><userinput>m kdir -pv /boot/efi &&201 mount -v -t vfat /dev/sda1/boot/efi</userinput></screen>202 203 <para> 204 Add an entry for the ESP in205 <filename>/etc/fstab</filename>, so it will be mounted automatically206 during system boot:201 <screen role="nodump"><userinput>mount --mkdir -v -t vfat /dev/sda1 -o codepage=437,iocharset=iso8859-1 \ 202 /boot/efi</userinput></screen> 203 204 <para> 205 If you want to mount the ESP automatically during system boot, 206 as the &root; user, add an entry for the ESP into 207 <filename>/etc/fstab</filename>: 207 208 </para> 208 209 … … 444 445 fi 445 446 446 menuentry "GNU/Linux, Linux 6. 1.11-lfs-11.3" {447 linux /boot/vmlinuz-6. 1.11-lfs-11.3root=/dev/sda2 ro447 menuentry "GNU/Linux, Linux 6.4.10-lfs-12.0" { 448 linux /boot/vmlinuz-6.4.10-lfs-12.0 root=/dev/sda2 ro 448 449 } 449 450
Note:
See TracChangeset
for help on using the changeset viewer.