UEFI » История » Версия 1
Андрей Волков, 2012-10-12 12:21
| 1 | 1 | Андрей Волков | h1. UEFI загрузка |
|---|---|---|---|
| 2 | |||
| 3 | h2. Создаем новую таблицу разделов: |
||
| 4 | |||
| 5 | *gdisk /dev/sdb* |
||
| 6 | <pre> |
||
| 7 | |||
| 8 | GPT fdisk (gdisk) version 0.8.4 |
||
| 9 | |||
| 10 | Partition table scan: |
||
| 11 | MBR: not present |
||
| 12 | BSD: not present |
||
| 13 | APM: not present |
||
| 14 | GPT: not present |
||
| 15 | |||
| 16 | Creating new GPT entries. |
||
| 17 | |||
| 18 | </pre> |
||
| 19 | |||
| 20 | *Command (? for help): o* |
||
| 21 | |||
| 22 | <pre> |
||
| 23 | This option deletes all partitions and creates a new protective MBR. |
||
| 24 | </pre> |
||
| 25 | |||
| 26 | *Proceed? (Y/N): y* |
||
| 27 | |||
| 28 | *Command (? for help): n* |
||
| 29 | |||
| 30 | Partition number (1-128, default 1): |
||
| 31 | First sector (34-488395021, default = 2048) or {+-}size{KMGTP}: |
||
| 32 | Last sector (2048-488395021, default = 488395021) or {+-}size{KMGTP}: *+195M* |
||
| 33 | Current type is 'Linux filesystem' |
||
| 34 | Hex code or GUID (L to show codes, Enter = 8300): *EF00* |
||
| 35 | Changed type of partition to 'EFI System' |
||
| 36 | |||
| 37 | *Command (? for help): n* |
||
| 38 | |||
| 39 | Partition number (2-128, default 2): |
||
| 40 | First sector (34-488395021, default = 401408) or {+-}size{KMGTP}: |
||
| 41 | Last sector (401408-488395021, default = 488395021) or {+-}size{KMGTP}: |
||
| 42 | Current type is 'Linux filesystem' |
||
| 43 | Hex code or GUID (L to show codes, Enter = 8300): *FD00* |
||
| 44 | Changed type of partition to 'Linux RAID' |
||
| 45 | |||
| 46 | *Command (? for help): p* |
||
| 47 | |||
| 48 | <pre> |
||
| 49 | Disk /dev/sdb: 488395055 sectors, 232.9 GiB |
||
| 50 | Logical sector size: 512 bytes |
||
| 51 | Disk identifier (GUID): 47C154D0-7F67-4EDB-8871-9C80E6836A6F |
||
| 52 | Partition table holds up to 128 entries |
||
| 53 | First usable sector is 34, last usable sector is 488395021 |
||
| 54 | Partitions will be aligned on 2048-sector boundaries |
||
| 55 | Total free space is 2014 sectors (1007.0 KiB) |
||
| 56 | |||
| 57 | Number Start (sector) End (sector) Size Code Name |
||
| 58 | 1 2048 401407 195.0 MiB EF00 EFI System |
||
| 59 | 2 401408 488395021 232.7 GiB FD00 Linux RAID |
||
| 60 | </pre> |
||
| 61 | |||
| 62 | *Command (? for help): w* |
||
| 63 | |||
| 64 | <pre> |
||
| 65 | Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING |
||
| 66 | PARTITIONS!! |
||
| 67 | </pre> |
||
| 68 | |||
| 69 | *Do you want to proceed? (Y/N): y* |
||
| 70 | |||
| 71 | <pre> |
||
| 72 | OK; writing new GUID partition table (GPT) to /dev/sdb. |
||
| 73 | The operation has completed successfully. |
||
| 74 | </pre> |
||
| 75 | |||
| 76 | h2. Готовим ядро для загрузки через UEFI: |
||
| 77 | |||
| 78 | <pre> |
||
| 79 | CONFIG_EFI=y |
||
| 80 | CONFIG_EFI_STUB=y |
||
| 81 | CONFIG_RELOCATABLE=y |
||
| 82 | CONFIG_FB_EFI=y |
||
| 83 | CONFIG_FRAMEBUFFER_CONSOLE=y |
||
| 84 | CONFIG_EFI_PARTITION=y |
||
| 85 | CONFIG_VFAT_FS=y |
||
| 86 | CONFIG_EFI_VARS=m |
||
| 87 | </pre> |
||
| 88 | |||
| 89 | h2. Устанавливаем пакет для управления UEFI. |
||
| 90 | |||
| 91 | */etc/paludis/keywords.conf* |
||
| 92 | |||
| 93 | <pre> |
||
| 94 | =sys-boot/efibootmgr-0.5.4 ~amd64 |
||
| 95 | </pre> |
||
| 96 | |||
| 97 | *cave resolve -xz efibootmgr* |
||
| 98 | |||
| 99 | h3. Создаем нужные папки |
||
| 100 | |||
| 101 | *mkdir /boot/efi* |
||
| 102 | |||
| 103 | h3. Создаем ФС |
||
| 104 | |||
| 105 | *cave resolve -xz sys-fs/dosfstools* |
||
| 106 | |||
| 107 | *mkfs.vfat -F32 -n efi /dev/sdb1* |
||
| 108 | |||
| 109 | <pre> |
||
| 110 | mkfs.vfat 3.0.12 (29 Oct 2011) |
||
| 111 | </pre> |
||
| 112 | |||
| 113 | h3. Добавляем в fstab |
||
| 114 | |||
| 115 | */etc/fstab* |
||
| 116 | |||
| 117 | <pre> |
||
| 118 | LABEL=efi /boot/efi vfat noatime 0 2 |
||
| 119 | </pre> |
||
| 120 | |||
| 121 | h3. Пересобираем grub2 с поддержкой uefi-64 |
||
| 122 | |||
| 123 | */etc/paludis/use.conf* |
||
| 124 | |||
| 125 | <pre> |
||
| 126 | sys-boot/grub GRUB_PLATFORMS: efi-64 |
||
| 127 | </pre> |
||
| 128 | |||
| 129 | *cave resolve -1xz sys-boot/grub* |
||
| 130 | |||
| 131 | 2. Готовимся к первой загрузке через UEFI |
||
| 132 | |||
| 133 | Для работы с UEFI нужно чтобы ОС загружена через UEFI. |
||
| 134 | Это можно сделать через специальный UEFI shell. |
||
| 135 | |||
| 136 | h3. x86_64 UEFI Shell 1.0 (Old) |
||
| 137 | |||
| 138 | https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi |
||
| 139 | |||
| 140 | h3. x86_64 UEFI Shell 2.0 (Beta) |
||
| 141 | |||
| 142 | https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi |
||
| 143 | |||
| 144 | Выбираем *1.0 (Old)* |
||
| 145 | |||
| 146 | *wget -O /boot/efi/ShellX64.efi 'https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi'* |
||
| 147 | |||
| 148 | h3. Отключаем лишнее |
||
| 149 | |||
| 150 | *chmod -x /etc/grub.d/{20_linux_xen,30_os-prober,40_custom,41_custom}* |
||
| 151 | |||
| 152 | h3. Устанавливаем загрузчик по временной схеме (без прописки в UEFI) |
||
| 153 | |||
| 154 | *grub2-install --target=x86_64-efi --efi-directory=/boot/efi --removable --modules='part_gpt lvm'* |
||
| 155 | |||
| 156 | h3. Перезагружаемся через uefi shell (через BIOS) |
||
| 157 | |||
| 158 | Попадаем в UEFI консоль |
||
| 159 | |||
| 160 | <pre> |
||
| 161 | shell > fs0: |
||
| 162 | fs0> cd EFI |
||
| 163 | fs0> cd BOOT |
||
| 164 | fs0> BOOTX64.EFI |
||
| 165 | </pre> |
||
| 166 | |||
| 167 | h2. Устанавливаем по нормальной схеме: |
||
| 168 | |||
| 169 | *grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot* |
||
| 170 | |||
| 171 | <pre> |
||
| 172 | BootCurrent: 0003 |
||
| 173 | Timeout: 5 seconds |
||
| 174 | BootOrder: 0000,0003 |
||
| 175 | Boot0003* UEFI: Built-in EFI Shell |
||
| 176 | Boot0000* gentoo |
||
| 177 | Installation finished. No error reported. |
||
| 178 | </pre> |
||
| 179 | |||
| 180 | h3. Удаляем старые загрузчики: |
||
| 181 | |||
| 182 | *rm -rfv /boot/efi/EFI/BOOT* |
||
| 183 | *rm -rfv /boot/grub/i386-pc* |
||
| 184 | |||
| 185 | h3. Перегенерируем конфигурацию grub2 |
||
| 186 | |||
| 187 | *grub2-mkconfig -o /boot/grub2/grub.cfg* |
||
| 188 | |||
| 189 | <pre> |
||
| 190 | Generating grub.cfg ... |
||
| 191 | Found linux image: /boot/vmlinuz-3.4.9-gentoo-f-64 |
||
| 192 | Found initrd image: /boot/initrd-3.4.9-gentoo-f-64 |
||
| 193 | Found linux image: /boot/vmlinuz-3.4.9-gentoo-e-64 |
||
| 194 | Found initrd image: /boot/initrd-3.4.9-gentoo-e-64 |
||
| 195 | Found linux image: /boot/vmlinuz-3.3.8-gentoo-e-64 |
||
| 196 | Found initrd image: /boot/initrd-3.3.8-gentoo-e-64 |
||
| 197 | Found linux image: /boot/vmlinuz-3.2.12-gentoo-e-64 |
||
| 198 | Found initrd image: /boot/initrd-3.2.12-gentoo-e-64 |
||
| 199 | Found linux image: /boot/vmlinuz-3.2.12-gentoo-d-64 |
||
| 200 | Found initrd image: /boot/initrd-3.2.12-gentoo-d-64 |
||
| 201 | Found linux image: /boot/vmlinuz-3.2.1-gentoo-r2-d-64 |
||
| 202 | Found initrd image: /boot/initrd-3.2.1-gentoo-r2-d-64 |
||
| 203 | done |
||
| 204 | </pre> |