GRUB2 for EFI in DragonFly?

Pierre-Alain TORET pierre-alain.toret+dragonflybsd at protonmail.com
Wed Nov 21 05:02:02 PST 2018


Hello Martin,

I'm using both DragonFlyBSD and Linux in a "pure" UEFI dual boot.

My disk as seen from a Linux perspective is like this (using gpt is a must) :
Disklabel type: gpt
Device         Start       End   Sectors   Size Type
/dev/sda1       2048    739327    737280   360M EFI System
/dev/sda2     739328 232022015 231282688 110.3G unknown
/dev/sda7  232022016 233046015   1024000   500M Linux filesystem
/dev/sda8  233046016 249300991  16254976   7.8G Linux filesystem
/dev/sda9  249300992 460738559 211437568 100.8G Linux filesystem

The /dev/sda2 partition is the one I used to install DragonFlyBSD.
Once booted on the live media this /dev/sda2 is seen as /dev/serno/162534803013.s1.

So I created a,b and d labels in order to have this layout :
sudo disklabel64 /dev/serno/162534803013.s1
16 partitions:
#          size     offset    fstype   fsuuid
  a:    1048576          0    4.2BSD    #    1024.000MB
  b:    8388608    1048576      swap    #    8192.000MB
  d:  106202112    9437184   HAMMER2    #  103713.000MB
  a-stor_uuid: 992e74da-d9e4-11e8-889a-ed8eb59a667e
  b-stor_uuid: 992e74ed-d9e4-11e8-889a-ed8eb59a667e
  d-stor_uuid: 992e74fa-d9e4-11e8-889a-ed8eb59a667e

Once done I used the online docs about manual installation.
After that I did mount the fat partition (/dev/sda1 or slice 0 from BSD side)
mount_msdos /dev/serno/162534803013.s0 /mnt/esp

I finally had to copy /boot/boot1.efi into /mnt/esp/EFI/dfly/boot1.efi and add an entry into my UEFI boot loader from the Linux side using efibootmgr because I don't know any tool doing the same thing on DragonFlyBSD (I guess you can just use a Linux live CD to achieve this, no need to have a distribution installed, just make sure it has access to the EFI variables).

sudo efibootmgr --disk /dev/sda --part 0 --create --gpt --label "DragonFlyBSD" --loader /EFI/dfly/boot1.efi

Telling the boot manager that this "DragonFlyBSD" entry should take the loader /EFI/dfly/boot1.efi on /dev/sda, on part0 (/dev/sda1)

Once this is done you can check which entry number it has with
sudo efibootmgr
In my case I get :
Boot0011* Arch Linux
Boot0013* DragonFlyBSD

I can use efibootmgr -n 0013 to make it the next target at next boot/reboot so I don't have to stay in front of the computer to press F9 to get the boot manager.

So I know this efibootmgr utility is available on FreeBSD but not on DragonFlyBSD, I don't know about OpenBSD.
Maybe you can be able to reach the same state by directly using the EFI variables because there seems to be this new variable corresponding to the entry I added.

sudo efivar -p --name 8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0013
GUID: 8be4df61-93ca-11d2-aa0d-00e098032b8c
Name: "Boot0013"
Attributes:
        Non-Volatile
        Boot Service Access
        Runtime Service Access
Value:
00000000  01 00 00 00 5a 00 44 00  72 00 61 00 67 00 6f 00  |....Z.D.r.a.g.o.|
00000010  6e 00 46 00 6c 00 79 00  42 00 53 00 44 00 00 00  |n.F.l.y.B.S.D...|
00000020  04 01 2a 00 01 00 00 00  00 08 00 00 00 00 00 00  |..*.............|
00000030  00 40 0b 00 00 00 00 00  5c cb 65 be ba c9 ae 4a  |. at ......\.e....J|
00000040  aa a6 ab 86 70 04 64 34  02 02 04 04 2c 00 5c 00  |....p.d4....,.\.|
00000050  45 00 46 00 49 00 5c 00  44 00 46 00 4c 00 59 00  |E.F.I.\.D.F.L.Y.|
00000060  5c 00 62 00 6f 00 6f 00  74 00 31 00 2e 00 65 00  |\.b.o.o.t.1...e.|
00000070  66 00 69 00 00 00 7f ff  04 00                    |f.i.......      |

I never tried to modify the variables directly though.

Hope this will help you.
Regards,




‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday 18 November 2018 19:30, Dr. Martin Ivanov <martin.ivanov at greenpocket.de> wrote:

> Hello,
>
> after successfully installing Dragonfly and OpenBSD in a multiboot setup on the same hard drive on an old BIOS machine, now I am planning to attempt to do the same on a new machine with UEFI Firmware. I googled a lot and it seems at some point I may be in need of the GRUB2 for EFI bootloader or elilo.  I simple
>
> pkg search grub2
>
> or 
>
> pkg search elilo
>
> provides no output . Is it possible to install any of these packages on DragonFly? 
>
> Thank you very much!
>
> Best regards,
>
> Martin




More information about the Users mailing list