I am not aware of any document, but here is how UEFI boot works:

Harddrive is GPT-labeled and it has a partition with a special EFI flag.
The partition is formatted as Fat32.

Firmware (people tend to call it BIOS) contains configuration in
non-volatile memory. This configuration consists of paths to .efi files,
something like
(harddisk_[disk_id[partition_id])/efi/debian/bootx64.efi

.efi is a special file that firmware can run. One file is for grub, another
is for windows loader.
So, you need to have two efi files on this partition (one file for each OS)
and add records about them in firmware configuration. Linux does it with
efibootmgr tool (grub2-install calls it under the hood)

If you have Windows installed, then you can simply install Debian, and I
believe the installation process will add Debian .efi file preserving
Windows file.
If not, then simply run `update-grub` after the installation.


I just played with uefi dualboot on hyper-v (second generation VM supports
EFI), so here is how I did it:
I installed windows, and got several partitions, one of them is called EFI
and contains "\EFI\Microsoft\Boot\boomgfw.efi". This partition doesn't have
letter associated, but you can use disk manager to assign letter and check
its contents.

My EFI configuration contains following record:
Firmware device path:
HD(1,GPT,47D66F17-77D9-4C7D-8993-733E9FDF5459,0x800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi

So far, so good. I then used disk manager to shrink disk "C" (to get some
free space for Debian) and installed Debian there.
I disabled Secure boot for now.

Debian's grub installed its own efi file there:
/boot/efi/EFI/debian/shimx64.efi
Here is my new firmware config record:
Firmware device path:
HD(1,GPT,47D66F17-77D9-4C7D-8993-733E9FDF5459,0x800,0x32000)/\EFI\debian\shimx64.efi

So I can now choose between Windows and Debian by choosing .efi file to
boot in firmware settings (aka boot menu)

But `update-grub` found Windows .efi file and added it to its configuration
to implement chain loading: PC boots grub efi file, and grub then loads
Windows efi file
https://www.gnu.org/software/grub/manual/grub/grub.html#chainloader

I suggest you to install hyper-v on Windows, create Gen2 VM, install
Windows there, disable secure boot, then do everything I wrote about, and
then do it on your real laptop



On Sat, Apr 30, 2022 at 5:54 PM Richard Owlett <rcowl...@cloud85.net> wrote:

> On 04/30/2022 09:01 AM, IL Ka wrote:
> > this is possible: you just need to have two .efi files for your OSes: one
> > for Windows and one for Linux.
> > Use ``efibootmgr`` to manage it.
> > If you have secure boot enabled, you need shim:
> > https://wiki.debian.org/SecureBoot
>
> Following links from there suggests I know even less than I thought I
> did. Confirms I need to read newbie oriented material about dual booting
> Debian on a UEFI equipped Windows machine (with or without Secure Boot).
>
> Suggestions?
>
> TIA
>
>

Reply via email to