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. Copy over the files bootx64.efi, 9pc64, plan9.ini (for x86_64 hardware) 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.
When bootx64.efi fails to find the bootfile, 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
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.
Comments
Post a Comment