UEFI Haiku boot loader for x86 (32-bit)

That should also be possible, in that case we need to switch from long mode to 32-bit protected mode in the bootloader. AFAIK this is feasible.

1 Like

yep it’s definitely possible also the other way around: boot 32-bit Haiku from 64-bit EFI loader

the screenshot below shows qemu-system-x86_64 with 2 vCPUs, TianoCore 64-bit, Haiku 32-bit.

now i got problem with code cleanup and refactor :rofl: :upside_down_face:

17 Likes

David, this is awesome! In theory, do we need 4 different loaders? I’m wondering if we have one partition with Haiku 64bit and one with 32bit, then rEFInd chain-loading two different loaders that in turn boot to 64 and 32 bit installations respectively?
This also should apply to 32bit loader, of course.

Ten years in the making :slight_smile: Update README.md · tqh/efi-example@e25c237 · GitHub

7 Likes

Hi everyone! I’m new here so sorry if this is not the right place.
I’ve been wanting to dual boot Haiku from a Windows 10 system. I tried rEFInd a while back and apparently didn’t get the manual steps right because I couldn’t boot anything. Is there a time estimate on automating dual boot Win10/Haiku when Haiku is installed? I’ve also tried EasyBCD and it disables options because my system is EFI, not BIOS.

It is already manually doable, but it is a hassle. You would need to on your EFI partition create a EFI/Haiku dir, rename boot_x64.efi to haiku.efi and put it there (boot_xxx names are reserved for first boot that should override other boot options) and add a boot item in your firmware.
Adding a boot item is however very user unfriendly, and Haiku doesn’t support it at the moment. Here is an older doc on how to do it from Linux: GitHub - tqh/efi-example: Self-contained minimal example of building an EFI app (under 64 bit Linux atm) without external build dependencies.

Remember that for multiboot cases, most (all?) computers have a built-in legacy/EFI boot selection menu included in BIOS.

I have a Dell Latitude laptop with Linux / Haiku (and at some point had Windows so triple boot), all installed in EFI mode, and I can choose what to boot by simply pressing F12 at boot. Saves me configuration headaches with rEFInd/Grub/EasyBCD/whatever.

Personally I just installed rEFInd, which autodetected the other bootloaders available on my EFI partition, so I can use it to dual boot Haiku and other things (in my case I have a netboot.xyz EFI image that allows me to boot any live linux system over the network if I need to do some Linux thing).

3 Likes

Thanks for the replies everyone.
I should have mentioned that I don’t have linux or any variety of unix on any machine.
My F12 menu always detects the Windows and USB iso boot options, so if I can get the SSD installed Haiku to show up I should be set. (Thanks tqh for clarifying the names and locations of the efi files; the guide I looked at for dual boot may need some cleanup).
In the screenshot for F12 menu, the 2nd option currently tries to boot from USB, so I may have just copied the wrong file. Right now my roadblock is formatting the partition for the install (see second screenshot). I may have had to use a command-line tool to set that up originally because I successfully installed once before…and then trying to reformat the partition during troubleshooting wiped it then gave the error. If anyone can help with formatting the partition I would be glad to post complete steps for what works for my case.
By the way, it is a 64-bit system…does that also mean UEFI will always be 64-bit? Thanks!


(2nd image in a new reply…)

Formatting error message

That partition seems to have some left-overs of what ever was there before, try deleting it and then create a new bfs partition instead of a non-formatted one, you may have to try a couple times before it succeeds, because of a bug in DriveSetup that comes back every now and then which creates smaller partitions than the actual size you request.

I have Haiku hrev56475 64-bit up and running on my SSD now (running in VESA mode).
Here are the steps I had to take:

  1. Boot from USB using the Beta3 64-bit iso. (press spacebar before loading icons appear and choose option to use VESA mode)
  2. Use DriveSetup to format a BeFS volume named “HAIKU” – this failed every time with hrev56475 64 bit but worked with Beta3
  3. Boot (spacebar) from USB using hrev56475 x64 iso, with the “UEFI: …FD PMAP” loader. (VESA mode)
  4. Install Haiku onto the BeFS (“HAIKU”) volume.
  5. Boot (spacebar) from USB using hrev56475 x64 iso, with the “UEFI: … FD PMAP” (VESA mode). Choose the “HAIKU” volume, which is the SSD installation. (would be nice to have “/dev/disk/nvme/0/4” next to the volume name for clarity).
    I don’t have any haiku efi files in the EFI partition on the SSD – my F12 menu never saw them.
    BTW, the installation of Haiku does not have any efi files to copy to the EFI partition – only the USB iso; not sure if that’s important.
    Looking forward to Beta4!

This nice topic is about Haiku 64-bit, so please move it to it’s own thread.
Anyway, this topic is very helpful for making a Haiku install better and more over easier!

Nice report thanks jgrindle

Will do (and sorry for taking it off-topic). I hope to contribute soon through dev, test, and documentation if I get everything running smoothly.

1 Like

No problem, the admin will move the thread for you!

1 Like

Silly question, did you mount the EFI partition of your usb stick? unless something went wrong with the recent nightlies you should get a separate haiku partition and an EFI one when you dd’ed the iso to the usb stick.

Maybe it would be helpful to have the efi files duplicated in another folder of the bootable image, so to make easier for people to find the necessary files when configuring efi boot by hand.

There weren’t any issues on the usb stick (I don’t have *nix and only know some basic commands and can use grep and vi, though it’s been years; I used balenaEtcher on a Windows 7 PC to put the iso on the usb drive).
I did some experimenting and found something that might be scripting-related (see image). The system folder shows different contents depending on whether or not you’re looking at the Haiku volume you are running the OS from.
Left: booted from SSD HAIKU volume, shows lots of extra folders and I can now find the efi file.
Right: mounted USB Haiku volume (not running from there), system/data and others not present.
That’s why I couldn’t find the efi file on the SSD HAIKU volume when I was running Haiku from the USB.

Sorry for continuing off-topic…newbie question: do I need to create the new topic (under Help, perhaps) before the admin moves these comments, or does the admin create the new topic?

You can use diskimage register to habe it available to mounted directly.

It would be quite wastefull to make everyone downlod the efi loader twice.

Yes, intentionally so.

Most of /system is synthetic, that is read only content that got mounted from /whereyoubootedfrom/packages