EasyOS now using rEFInd boot manager
The Easy image file, that is written to a USB-stick, now uses rEFInd for booting on UEFI-firmware computers.
The boot-partition in the USB-stick now has /EFI/BOOT/BOOTX64.EFI and /EFI/BOOT/refind.conf. It is so simple.
Compiling
I compiled rEFInd from source, from here:
https://sourceforge.net/p/refind/code/ci/master/tree/
And applied a patch, to modify the boot menu a bit:
diff -Naur refind-code-20171008-ORIG/refind/config.c refind-code-20171008/refind/config.c
--- refind-code-20171008-ORIG/refind/config.c 2017-10-08 08:25:45.280015801 +0800
+++ refind-code-20171008/refind/config.c 2017-10-08 09:42:32.897125655 +0800
@@ -839,7 +839,7 @@
if ((Volume != NULL) && (Volume->IsReadable) && (Volume->RootDir)) {
MyFreePool(SubEntry->me.Title);
SubEntry->me.Title = AllocateZeroPool(256 * sizeof(CHAR16));
- SPrint(SubEntry->me.Title, 255, L"Boot %s from %s", (Title != NULL) ? Title : L"Unknown", Volume->VolName);
+ SPrint(SubEntry->me.Title, 255, L"Boot %s (partition label '%s')", (Title != NULL) ? Title : L"Unknown", Volume->VolName);
SubEntry->me.BadgeImage = Volume->VolBadgeImage;
SubEntry->VolName = Volume->VolName;
} // if volume is readable
@@ -901,7 +901,7 @@
Entry->Title = StrDuplicate(Title);
Entry->me.Title = AllocateZeroPool(256 * sizeof(CHAR16));
- SPrint(Entry->me.Title, 255, L"Boot %s from %s", (Title != NULL) ? Title : L"Unknown", CurrentVolume->VolName);
+ SPrint(Entry->me.Title, 255, L"Boot %s (partition label '%s')", (Title != NULL) ? Title : L"Unknown", CurrentVolume->VolName);
Entry->me.Row = 0;
Entry->me.BadgeImage = CurrentVolume->VolBadgeImage;
Entry->VolName = CurrentVolume->VolName;
@@ -923,7 +923,7 @@
if ((CurrentVolume != NULL) && (CurrentVolume->IsReadable) && (CurrentVolume->RootDir)) {
MyFreePool(Entry->me.Title);
Entry->me.Title = AllocateZeroPool(256 * sizeof(CHAR16));
- SPrint(Entry->me.Title, 255, L"Boot %s from %s", (Title != NULL) ? Title : L"Unknown", CurrentVolume->VolName);
+ SPrint(Entry->me.Title, 255, L"Boot %s (partition label '%s')", (Title != NULL) ? Title : L"Unknown", CurrentVolume->VolName);
Entry->me.BadgeImage = CurrentVolume->VolBadgeImage;
Entry->VolName = CurrentVolume->VolName;
} // if volume is readable
diff -Naur refind-code-20171008-ORIG/refind/main.c refind-code-20171008/refind/main.c
--- refind-code-20171008-ORIG/refind/main.c 2017-10-08 08:25:45.280015801 +0800
+++ refind-code-20171008/refind/main.c 2017-10-08 10:14:47.356718160 +0800
@@ -1169,7 +1169,7 @@
// name is identical except for something added to the end (e.g., VolB1 vs. VolB12).
// Note: Volume->VolName will be NULL for network boot programs.
if ((Volume->VolName) && (!MyStriCmp(Volume->VolName, L"Recovery HD")))
- SPrint(Entry->me.Title, 255, L"Boot %s from %s ", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath, Volume->VolName);
+ SPrint(Entry->me.Title, 255, L"Boot %s (partition label '%s') ", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath, Volume->VolName);
else
SPrint(Entry->me.Title, 255, L"Boot %s ", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath);
Entry->me.Row = 0;
diff -Naur refind-code-20171008-ORIG/refind/screen.c refind-code-20171008/refind/screen.c
--- refind-code-20171008-ORIG/refind/screen.c 2017-10-08 08:25:45.283349135 +0800
+++ refind-code-20171008/refind/screen.c 2017-10-08 09:01:00.253552568 +0800
@@ -303,7 +303,7 @@
// print header text
refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 3, 1);
- Print(L"rEFInd - %s", Title);
+ Print(L"EasyOS - %s", Title);
// reposition cursor
refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BASIC);
Easy needs the "devx" sfs loaded, nothing else needed, run this:
# make gnuefi
Rename refind/refind_x64.efi to BOOTX64.EFI and copy to boot partition.
Configuration
Here is refind.conf:
timeout 10
textonly on
textmode 0
showtools shutdown,reboot,firmware
#scan_all_linux_kernels off
#scanfor manual,internal
scanfor manual
menuentry "EasyOS" {
loader /vmlinuz
initrd /initrd.q
ostype linux
options rw
submenuentry "Filesystem check" {
add_options "qfix=fsck"
}
submenuentry "Commandline only, do not start X" {
add_options "qfix=nox"
}
submenuentry "Rollback to earlier session" {
add_options "qfix=bak"
}
}
menuentry "Windows 10" {
volume SYSTEM
loader \EFI\Microsoft\Boot\bootmgfw.efi
disabled
}
This simple config file gives a text-mode display, with automatic scanning disabled. It will only offer to boot EasyOS.
It is very simple to add entries manually. The config file has an example for "Windows 10". It is disabled. To activate it, remove the "disabled" line, and replace "volume SYSTEM" with the label of the Windows ESP (boot) partition -- just run blkid to determine the label. Note, "SYSTEM" is the label of partition mmcblk0p1 in my Mele PCG35 mini-PC.
Or, automatic scanning can be turned on. Change the "scanfor manual" line to "scanfor manual,internal", and uncomment "scan_all_linux_kernels off" . Hey presto, the boot menu will show all Windows and Linux OSs installed in the PC.
Tags: easy