Проект

Общее

Профиль

UEFI » История » Редакция 2

Редакция 1 (Андрей Волков, 2012-10-12 12:21) → Редакция 2/3 (Андрей Волков, 2012-10-12 12:41)

h1. UEFI загрузка 

 h2. Создаем новую таблицу разделов: 

 *gdisk /dev/sdb* 
 <pre> 

 GPT fdisk (gdisk) version 0.8.4 

 Partition table scan: 
   MBR: not present 
   BSD: not present 
   APM: not present 
   GPT: not present 

 Creating new GPT entries. 

 </pre> 

 *Command (? for help): o* 

 <pre> 
 This option deletes all partitions and creates a new protective MBR. 
 </pre> 

 *Proceed? (Y/N): y* 

 *Command (? for help): n* 

 Partition number (1-128, default 1):  
 First sector (34-488395021, default = 2048) or {+-}size{KMGTP}: 
 Last sector (2048-488395021, default = 488395021) or {+-}size{KMGTP}: *+195M* 
 Current type is 'Linux filesystem' 
 Hex code or GUID (L to show codes, Enter = 8300): *EF00* 
 Changed type of partition to 'EFI System' 

 *Command (? for help): n* 

 Partition number (2-128, default 2):  
 First sector (34-488395021, default = 401408) or {+-}size{KMGTP}:  
 Last sector (401408-488395021, default = 488395021) or {+-}size{KMGTP}:  
 Current type is 'Linux filesystem' 
 Hex code or GUID (L to show codes, Enter = 8300): *FD00* 
 Changed type of partition to 'Linux RAID' 

 *Command (? for help): p* 

 <pre> 
 Disk /dev/sdb: 488395055 sectors, 232.9 GiB 
 Logical sector size: 512 bytes 
 Disk identifier (GUID): 47C154D0-7F67-4EDB-8871-9C80E6836A6F 
 Partition table holds up to 128 entries 
 First usable sector is 34, last usable sector is 488395021 
 Partitions will be aligned on 2048-sector boundaries 
 Total free space is 2014 sectors (1007.0 KiB) 

 Number    Start (sector)      End (sector)    Size         Code    Name 
    1              2048            401407     195.0 MiB     EF00    EFI System 
    2            401408         488395021     232.7 GiB     FD00    Linux RAID 
 </pre> 

 *Command (? for help): w* 

 <pre> 
 Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING 
 PARTITIONS!! 
 </pre> 

 *Do you want to proceed? (Y/N): y* 

 <pre> 
 OK; writing new GUID partition table (GPT) to /dev/sdb. 
 The operation has completed successfully. 
 </pre> 

 h2. Готовим ядро для загрузки через UEFI: 

 <pre> 
 CONFIG_EFI=y 
 CONFIG_EFI_STUB=y 
 CONFIG_RELOCATABLE=y 
 CONFIG_FB_EFI=y 
 CONFIG_FRAMEBUFFER_CONSOLE=y 
 CONFIG_EFI_PARTITION=y 
 CONFIG_VFAT_FS=y 
 CONFIG_EFI_VARS=m 
 </pre> 

 h2. Устанавливаем пакет для управления UEFI. 

 */etc/paludis/keywords.conf* 

 <pre> 
 =sys-boot/efibootmgr-0.5.4 ~amd64 
 </pre> 

 *cave resolve -xz efibootmgr* 

 h3. Создаем нужные папки 

 *mkdir /boot/efi* 

 h3. Создаем ФС 

 *cave resolve -xz sys-fs/dosfstools* 

 *mkfs.vfat -F32 -n efi /dev/sdb1* 

 <pre> 
 mkfs.vfat 3.0.12 (29 Oct 2011) 
 </pre> 

 h3. Добавляем в fstab 

 */etc/fstab* 

 <pre> 
 LABEL=efi     /boot/efi    vfat      noatime     0 2 
 </pre> 

 h3. Пересобираем grub2 с поддержкой uefi-64 

 */etc/paludis/use.conf* 

 <pre> 
 sys-boot/grub GRUB_PLATFORMS: efi-64 
 </pre> 

 *cave resolve -1xz sys-boot/grub* 

 h2. 2. Готовимся к первой загрузке через UEFI 

 Для работы с UEFI нужно чтобы ОС загружена через UEFI. 
 Это можно сделать через специальный UEFI shell. 

 h3. x86_64 UEFI Shell 1.0 (Old) 

 https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi 

 h3. x86_64 UEFI Shell 2.0 (Beta) 

 https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi 

 Выбираем *1.0 (Old)* 

 *wget -O /boot/efi/ShellX64.efi 'https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi'* 

 h3. Отключаем лишнее 

 *chmod -x /etc/grub.d/{20_linux_xen,30_os-prober,40_custom,41_custom}* 

 h3. Устанавливаем загрузчик по временной схеме (без прописки в UEFI) 

 *grub2-install --target=x86_64-efi --efi-directory=/boot/efi --removable --modules='part_gpt lvm'* 

 h3. Перезагружаемся через uefi shell (через BIOS) 

 Попадаем в UEFI консоль 

 <pre> 
 shell > fs0: 
 fs0> cd EFI 
 fs0> cd BOOT 
 fs0> BOOTX64.EFI 
 </pre> 

 h2. Устанавливаем по нормальной схеме: 

 *grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot* 

 <pre> 
 BootCurrent: 0003 
 Timeout: 5 seconds 
 BootOrder: 0000,0003 
 Boot0003* UEFI: Built-in EFI Shell  
 Boot0000* gentoo 
 Installation finished. No error reported. 
 </pre> 

 h3. Удаляем старые загрузчики: 

 *rm -rfv /boot/efi/EFI/BOOT* 
 *rm -rfv /boot/grub/i386-pc* 

 h3. Перегенерируем конфигурацию grub2 

 *grub2-mkconfig -o /boot/grub2/grub.cfg* 

 <pre> 
 Generating grub.cfg ... 
 Found linux image: /boot/vmlinuz-3.4.9-gentoo-f-64 
 Found initrd image: /boot/initrd-3.4.9-gentoo-f-64 
 Found linux image: /boot/vmlinuz-3.4.9-gentoo-e-64 
 Found initrd image: /boot/initrd-3.4.9-gentoo-e-64 
 Found linux image: /boot/vmlinuz-3.3.8-gentoo-e-64 
 Found initrd image: /boot/initrd-3.3.8-gentoo-e-64 
 Found linux image: /boot/vmlinuz-3.2.12-gentoo-e-64 
 Found initrd image: /boot/initrd-3.2.12-gentoo-e-64 
 Found linux image: /boot/vmlinuz-3.2.12-gentoo-d-64 
 Found initrd image: /boot/initrd-3.2.12-gentoo-d-64 
 Found linux image: /boot/vmlinuz-3.2.1-gentoo-r2-d-64 
 Found initrd image: /boot/initrd-3.2.1-gentoo-r2-d-64 
 done 
 </pre>