Plan 9: Quick Boot with UEFI
UEFI (Unified Extensible Firmware Interface) provides a quick way to set up a Plan 9 terminal on modern hardware. EFI System Partition (ESP) is a FAT32 partition. You should be able to modify it in most of the operating systems.
Run mk in /sys/src/boot/efi. aux/aout2efi converts an a.out file to an EFI executable. For x86_64 hardware, copy over the files bootx64.efi (EFI application), 9pc64 (kernel), plan9.ini (configuration file) to \EFI\plan9\ directory in the ESP. If you want it be the default OS, you can create a symlink \EFI\boot to \EFI\plan9. Remember to include the full path to the kernel in plan9.ini. (Note: ESP is a FAT32 partition. Hence you must use backward slashes.)
When bootx64.efi fails to find the bootfile (e.g. kernel is missing, plan9.ini is missing or path is incorrect), you can provide the arguments at > prompt followed by a boot command.
You can use EFI shell or efibootmgr on Linux to modify the EFI entries that are displayed during boot.
Test in QEMU
Manage boot configuration with efibootmgr
Use efibootmgr to manage the EFI boot configuration. Linux mounts the ESP at /boot/efi.
EFI Shell
Programming
Image file path:
void *ConvertDeviceNodeToText;
void *ConvertDevicePathToText;
} EFI_DEVICE_PATH_TO_TEXT_PROTOCOL;
static EFI_GUID EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID = {
0x8b843e20,0x8132,0x4852,
{0x90,0xcc,0x55,0x1a,0x4e,0x4a,0x7f,0x1c}
};
eficall(ST->BootServices->LocateProtocol, &EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID, nil, &dpt);
txt = (CHAR16*) eficall(dpt->ConvertDevicePathToText, image->FilePath, 1, 1);
Lessons Learnt
- Always backup ESP especially if you need Windows. It's almost impossible to get bootmgr.efi for Windows from external sources. (Boot manager: \EFI\Microsoft\Boot\bootmgfw.efi , OS loader: \windows\system32\windload.efi)
- Depending on your configuration in Linux, you might have a copy of the ESP at /boot/efi.
- EFI provides hotkey access to boot manager menu - in addition to the BIOS menu. e.g. in Ideapad 310, you can use F12 to access the menu while booting.
- Windows activation key can be found in the BIOS settings if it's a factory installed version.
Comments
Post a Comment