Проект

Общее

Профиль

UEFI » История » Версия 3

Андрей Волков, 2012-10-15 18:17

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 3 Андрей Волков
CONFIG_FAT_DEFAULT_CODEPAGE=866
87
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
88
CONFIG_NLS_CODEPAGE_866=y
89
CONFIG_NLS_ISO8859_1=y
90 1 Андрей Волков
CONFIG_EFI_VARS=m
91
</pre>
92
93
h2. Устанавливаем пакет для управления UEFI.
94
95
*/etc/paludis/keywords.conf*
96
97
<pre>
98
=sys-boot/efibootmgr-0.5.4 ~amd64
99
</pre>
100
101
*cave resolve -xz efibootmgr*
102
103
h3. Создаем нужные папки
104
105
*mkdir /boot/efi*
106
107
h3. Создаем ФС
108
109
*cave resolve -xz sys-fs/dosfstools*
110
111
*mkfs.vfat -F32 -n efi /dev/sdb1*
112
113
<pre>
114
mkfs.vfat 3.0.12 (29 Oct 2011)
115
</pre>
116
117
h3. Добавляем в fstab
118
119
*/etc/fstab*
120
121
<pre>
122
LABEL=efi   /boot/efi  vfat    noatime   0 2
123
</pre>
124
125
h3. Пересобираем grub2 с поддержкой uefi-64
126
127
*/etc/paludis/use.conf*
128
129
<pre>
130
sys-boot/grub GRUB_PLATFORMS: efi-64
131
</pre>
132
133
*cave resolve -1xz sys-boot/grub*
134
135 2 Андрей Волков
h2. Готовимся к первой загрузке через UEFI
136 1 Андрей Волков
137
Для работы с UEFI нужно чтобы ОС загружена через UEFI.
138
Это можно сделать через специальный UEFI shell.
139
140
h3. x86_64 UEFI Shell 1.0 (Old)
141
142
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
143
144
h3. x86_64 UEFI Shell 2.0 (Beta)
145
146
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi
147
148
Выбираем *1.0 (Old)*
149
150
*wget -O /boot/efi/ShellX64.efi 'https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi'*
151
152
h3. Отключаем лишнее
153
154
*chmod -x /etc/grub.d/{20_linux_xen,30_os-prober,40_custom,41_custom}*
155
156
h3. Устанавливаем загрузчик по временной схеме (без прописки в UEFI)
157
158
*grub2-install --target=x86_64-efi --efi-directory=/boot/efi --removable --modules='part_gpt lvm'*
159
160
h3. Перезагружаемся через uefi shell (через BIOS)
161
162
Попадаем в UEFI консоль
163
164
<pre>
165
shell > fs0:
166
fs0> cd EFI
167
fs0> cd BOOT
168
fs0> BOOTX64.EFI
169
</pre>
170
171
h2. Устанавливаем по нормальной схеме:
172
173
*grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot*
174
175
<pre>
176
BootCurrent: 0003
177
Timeout: 5 seconds
178
BootOrder: 0000,0003
179
Boot0003* UEFI: Built-in EFI Shell 
180
Boot0000* gentoo
181
Installation finished. No error reported.
182
</pre>
183
184
h3. Удаляем старые загрузчики:
185
186
*rm -rfv /boot/efi/EFI/BOOT*
187
*rm -rfv /boot/grub/i386-pc*
188
189
h3. Перегенерируем конфигурацию grub2
190
191
*grub2-mkconfig -o /boot/grub2/grub.cfg*
192
193
<pre>
194
Generating grub.cfg ...
195
Found linux image: /boot/vmlinuz-3.4.9-gentoo-f-64
196
Found initrd image: /boot/initrd-3.4.9-gentoo-f-64
197
Found linux image: /boot/vmlinuz-3.4.9-gentoo-e-64
198
Found initrd image: /boot/initrd-3.4.9-gentoo-e-64
199
Found linux image: /boot/vmlinuz-3.3.8-gentoo-e-64
200
Found initrd image: /boot/initrd-3.3.8-gentoo-e-64
201
Found linux image: /boot/vmlinuz-3.2.12-gentoo-e-64
202
Found initrd image: /boot/initrd-3.2.12-gentoo-e-64
203
Found linux image: /boot/vmlinuz-3.2.12-gentoo-d-64
204
Found initrd image: /boot/initrd-3.2.12-gentoo-d-64
205
Found linux image: /boot/vmlinuz-3.2.1-gentoo-r2-d-64
206
Found initrd image: /boot/initrd-3.2.1-gentoo-r2-d-64
207
done
208
</pre>