[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: And yet another UEFI/BIOS question: Work on both.



Le 23/09/2018 à 18:18, Patrick Bartek a écrit :
On Sun, 23 Sep 2018 10:58:54 -0400
Wayne Sallee <Wayne@WayneSallee.com> wrote:

What do you recommend for setting up a system that will boot in
either UEFI or BIOS mode, so if it is moved back and forth between
UEFI and BIOS, it will boot every time?

I recommend you learn how to use Google or DuckDuckGo, etc. searches for
such basic queries.

This is not a basic query. I have spend quite some time doing experiments and have not come up with a perfect universal solution yet.

If you want your system to work with old 32-bit CPUs, you must install the i386 architecture. After the installation you can add the amd64 architecture with dpkg and install a 64-bit kernel. Note that a 32-bit kernel can work with a 64-bit UEFI firmware but EFI variables will be available only with a 64-bit kernel. A 64-bit kernel can work with a 32-bit UEFI firmware (if the CPU is 64-bit of course) and EFI variables will be available.

You must choose the partition table format between GPT and DOS/MBR.
I read that some broken BIOS may not boot a disk with a GPT partition table, although I haven't seen any yet. I also read that some broken UEFI implementations may force boot in native EFI mode when a GPT partition table is present, and in BIOS/legacy mode when a DOS/MBR partition table is present, although I haven't see any either yet.

However I have observed that quite many BIOS or UEFI implementations operating in legacy mode won't boot a disk (either GPT or DOS/MBR) if no partition in the DOS partition table/protective MBR has the boot flag set. But setting the boot flag on the protective GPT partition is against the GPT specification, and I have one example of a UEFI implementation which will not boot such a disk in native EFI mode.

So I guess you get a better chance with a DOS/MBR partition table. Note that this is what the Debian installer/live ISO-hybrid images use.

If you choose GPT anyway, it is recommended to create a 1 MiB unformatted "BIOS boot" partition for GRUB BIOS.

Create a 10 to 100 MB EFI system partition formatted as FAT and mount it on /boot/efi.

In order to boot either in BIOS or EFI mode, you have to install both BIOS and EFI boot loaders. If you choose GRUB for both, the packages are
- grub-pc to install GRUB for PC with BIOS
- grub-efi-amd64 to install GRUB for PC with 64-bit UEFI firmware
- grub-efi-ia32 to install GRUB for PC with 32-bit UEFI firmware

But these packages conflict with one another so are mutually exclusive. You could install one and run grub-install, then uninstall it, install the next one and run grub-install again and so on. But I suggest to install one, say grub-pc, and install grub-efi-{amd64,ia32}-bin instead, which do not conflict with each other.

Now you can install the different GRUB boot loaders for each platform :
# BIOS
grub-install --target=i386-pc /dev/sda
# EFI 32 bit
grub-install --target=i386-efi --removable
# EFI 64 bit
grub-install --target=x86_64-efi --removable

These commands work regardless of whether the system was booted in EFI or BIOS mode or EFI variables are available. The --removable option will install the boot loader in the "removable device" path /boot/efi/EFI/BOOT/boot{arch}.efi.

The following was the first result in the list of my
search. Total time spent: about 15 seconds.

https://truthseekers.io/everything-you-need-to-know-to-dual-boot-uefi-gpt-bios-mbr-partitions-swap-space-and-more/

Also, read up on "chainloading."

Dual boot and chainloading have nothing to do with Wayne's query.


Reply to: