Efibootmgr

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Efibootmgr and the translation is 13% complete.
Outdated translations are marked like this.
Resources

efibootmgr 프로그램은 시스템의 UEFI 펌웨어와 함께 동작합니다. 리눅스(또는 기타 EFI 운영체제)로 부팅할 수 있는 항목을 만들고 관리하는 목적으로 EFI 설정을 다루는 인기있는 도구입니다.

sys-boot/efibootmgr 프로그램은 부트로더가 아닙니다. 부트로더로 동작하는 시스템의 EFI 펌웨어와 함께 동작하는 도구입니다. efibootmgr 을 활용하면 부팅 항목을 만들고, 뒤섞고, 편집하고, 제거할 수 있습니다.

커널

CONFIG_EFIVAR_FS support needs to be enabled.

참고
It is not possible to use efivarfs without the EFI runtime services, which (in case they have been disabled by default, i.e. CONFIG_EFI_DISABLE_RUNTIME=y) can also be enabled by the kernel command-line option efi=runtime.

Emerge

sys-boot/efibootmgr 꾸러미는 어떤 USE 플래그도 필요 없습니다. 단지 설치하기만 하면 됩니다:

root #emerge --ask sys-boot/efibootmgr

설정

EFI 변수

efibootmgr을 제대로 활용하려면, EFI 변수 파일 시스템에 접근할 수 있어야합니다. EFI 모드로 시스템을 부팅하지(그리고 펌웨어 MBR 모드는 아님) 않으면 EFI 변수 자체에 접근할 수 없습니다. 시스템이 MBR 모드면, 다시 부팅하고 시스템 펌웨어에 EFI 모드로 부팅하는데 필요한 조치를 취하십시오. 보통 펌웨어 설정 옵션을 바꾸거나 시스템 부팅 메뉴의 EFI 부팅 항목을 선택하시면 됩니다.

EFI 모드로 시스템을 부팅하고 나면, 다음 명령으로 efivarfs 가 있는지 확인하십시오:

root #mount | grep efivars
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)

마운트하지 않았다면(sysfs 초기화 스크립트로 마운드해야함), 다음 명령으로 직접 마운트할 수 있습니다:

root #mount -t efivars efivars /sys/firmware/efi/efivars

Preconditions

If an EFI System Partition (ESP) does not exist, one needs to be created, see EFI System Partition.

EFI 부팅 항목 관리

부팅 항목 살펴보기

--verbose (-v) 옵션으로 현재 부팅 항목을 보려면:

root #efibootmgr -v
BootCurrent: 0002
Timeout: 3 seconds
BootOrder: 0003,0003,0002,0000,0004
Boot0000* CD/DVD Drive  BIOS(3,0,00)
Boot0001* Hard Drive    BIOS(2,0,00)
Boot0002* Gentoo        HD(1,800,61800,6d98f360-cb3e-4727-8fed-5ce0c040365d)File(\EFI\boot\bootx64.efi)
Boot0003* Hard Drive    BIOS(2,0,00)P0: ST1500DM003-9YN16G

부팅 항목 만들기

부팅 항목을 만들 때 efibootmgr에 전달할 몇가지 매개 변수가 있습니다:

  • --create (-c) 로 새 항목을 만듭니다.
  • --part (-p) 다음에 EFI 시스템 파티션을 제공할 파티션 번호를 붙입니다
  • --disk (-d) 다음에 EFI 시스템 파티션을 제공할 디스크 장치를 언급합니다
  • --label (-L) 다음에 부팅 항목에서 사용할 레이블을 붙입니다
  • --loader (-l) 다음에 부팅할 EFI 이미지 경로를 붙입니다
중요
부팅할 EFI 이미지 경로 구분시 /(슬래시)가 아닌 \(역슬래시) 를 사용해야합니다.
중요
Additionally, if the ESP was already created by another OS, it might be named differently than /efi/EFI. If an ESP was created by another OS, begin the EFI Boot entry using this directory name, which immediately follows /efi.

Below are some examples of how a UEFI entry can be created. If this is the folder structure:

root #tree /efi/ -L 3
/efi/
└── EFI
    ├── Grub
    │   └── grubx64.efi
    └── Gentoo
        └── bzImage.efi

then the loader paths will be:

root #efibootmgr -c -L "Grub" -l '\EFI\Grub\grubx64.efi'
root #efibootmgr -c -L "Gentoo" -l '\EFI\Gentoo\bzImage.efi'

예를 들자면:

root #efibootmgr -c -d /dev/sda -p 2 -L "Gentoo" -l "\efi\boot\bootx64.efi"

It is also possible to add parameters – maybe not supported by all UEFI implementations[1] - to the kernel's command line:

root #efibootmgr -c -d /dev/sda -p 2 -L "Gentoo" -l '\efi\boot\bootx64.efi' -u 'root=/dev/sda3 initrd=\efi\boot\initramfs.img quiet'

Optionally, additional kernels can be installed and made known to the UEFI firmware. This is especially useful when wanting to test more kernels or to dual-boot with another operating system. These will be shown in the boot selection prompt, normally after a keyboard hotkey is pressed at the right time during system initialization. The latest added entry always gets highest boot priority, so it will be default. If the hotkey combination is unknown, search for official documentation from the computer manufacturer. This information is usually not difficult to find.

부팅 항목 삭제

항목을 삭제하기 전에 항목의 ID를 우선 확인하십시오.

아래에서 나타난 바와 같이 젠투 항목을 삭제(Boot0002가 식별자였음), efibootmgr에게 --bootnum (-b) 매개변수와 식별 번호를, 항목을 삭제하는 --delete-bootnum (-B) 매개 변수로, 2번 ID를 지닌 항목을 삭제하라고 요청하십시오.

root #efibootmgr -b 2 -B

Removable media

EFI bootloaders on removable media are not configured as boot entries, so tools like efibootmgr are not required. Instead the computer firmware identifies removable boot options by looking for a predefined file name unique to the system architecture in use, in a predefined path.[2]

Some (U)EFI implementations support the use of the removable media boot path as a fallback on internal drives.[3] This is against specification and should be avoided, but may help on a system with a buggy (U)EFI. Only one such fallback bootloader is possible on a specific system (i.e. architecture), due to the standardized boot path and file names.

Architecture Abbreviation File name PE executable machine type
x86 32-bit IA-32 \efi\boot\bootia32.efi 0x14c
x86-64 x64 \efi\boot\bootx64.efi 0x8664
Itanium IA-64 \efi\boot\bootia64.efi 0x200
ARM 32-bit AArch32 \efi\boot\bootarm.efi 0x01c2
ARM 64-bit AArch64 \efi\boot\bootaa64.efi 0xAA64
RISC-V 32-bit \efi\boot\bootriscv32.efi 0x5032
RISC-V 64-bit \efi\boot\bootriscv64.efi 0x5064
RISC-V 128-bit \efi\boot\bootriscv128.efi 0x5128
Loongson 32-bit LoongArch32 \efi\boot\bootloongarch32.efi 0x6232
Loongson 64-bit LoongArch64 \efi\boot\bootloongarch64.efi 0x6264
참고
To boot from removable media, the firmware has to look for compatible bootloaders on supported devices, which can be configured in the firmware setup. Like most firmwares, (U)EFI provides a hotkey to show a boot selection (formally known as "BIOS Boot Selection" or BBS), otherwise (U)EFI will use the configured default boot entry. However, a buggy (U)EFI may default to the removable media boot path even on internal drives.

To use the removable media boot path it is sufficient to copy the EFI bootloader to the required path and file name. Should the firmware make use of this fallback, this may also remove the ability to select between configured boot entries, meaning that boot options (as listed with efibootmgr) through (U)EFI will not work. Even though every EFI bootloader can be used as fallback, it may be advisable to use a boot manager that itself has the ability to select between boot options, such as GRUB. From the above example for x64 (amd64):

root #cp /efi/EFI/Grub/grubx64.efi /efi/EFI/boot/bootx64.efi
참고
The FAT file system of the EFI System Partition is not case-sensitive, but case-preserving (VFAT), while Unix and Linux is strictly case-sensitive at all times. Because of this, the path /efi/EFI/boot/bootx64.efi may not work on all systems, as it could be using capital letters, e.g. /efi/EFI/BOOT or /efi/EFI/Boot; the same goes for bootx64.efi. Running tree -L 3 /efi, when the ESP is mounted under /efi, will show the names in use on the individual system, to which the above command has to be changed accordingly.
중요
The fallback bootloader is not automatically updated! Every time e.g. GRUB is re-installed (like after a version update, which may contain security fixes), it has to be copied to the fallback boot path again, overwriting (updating) the previous version!

The boot manager included in systemd, systemd-boot (formally Gummiboot), will automatically install to the removable media boot path. When sys-apps/systemd with the boot USE flag is updated, it is necessary to run bootctl again in order to update both bootloader files.

root #bootctl update

제거

Unmerge

root #emerge --ask --depclean --verbose sys-boot/efibootmgr

추가 참조

References