Virtualbox not working with EFI vdi

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
heemogoblin
Posts: 13
Joined: Sat Jun 27, 2020 8:00 am
Libera.chat IRC: heemogoblin

Virtualbox not working with EFI vdi

Post by heemogoblin »

Good day,

I am trying to start up my OS in virtualbox. In this step I just want to make sure that the EFI bootloader can start up. The code I use is from the UEFI bare bones tutorial, but is compiled under MSVC using this repo: https://github.com/pbatard/uefi-simple as a starting point. It gives me a normal boot.efi file. In order to get the vdi, I followed the instructions on the UEFI page using WSL, then converted the .img to a .vdi using VBoxManage. My .img and .vdi has one partition, the EFI System partition and then about 8.5 gb ntfs Microsoft basic data. In the EFI system partition I have the 64-bit bootloader in boot/bootx64.efi (renamed from boot.efi) and it also the same file renamed as main.efi in the root directory so that I could try starting it if the boot fails. However, whenever I start the VM, it goes to the virtualbox startup screen, then straight to the black screen and blinking cursor. I have tried going to the boot options(F12), but that still takes me to the black screen and flashing cursor. An image is attached, unfortunately the cursor has gone but it is in the top left corner.
Here is what I see:
The black screen
The black screen
vm.png (8.78 KiB) Viewed 1287 times
This is not the first problem I have encountered, previously I would be taken to the EFI shell and none of my filesystems recognised. I fixed this problem by adding my vdi to a SATA controller, and also using the Linux-based instructions for making a bootable disk (via WSL) instead of windows diskpart(side note - it appears that diskpart creates some wack GUIDs for me. It might be worth investigating into this).

In terms of what I have done for this, I have disabled the Windows Virtual machine feature and Hyper-V and remade the VM. VT-X is enabled on my system. In all fairness, I have found near-to-nothing in terms of what to do on this issue, and when it happens with a unknown OS there is simply nothing on the matter.

Here are the logs:
https://pastebin.com/awd8TwZv

I would please like to know what the problem here is, and what I could do to solve it and get my OS printing "Hello world". Apologies for the inconvenience, but thanks in advance.

Thank you for your time,

Heemogoblin
Octocontrabass
Member
Member
Posts: 5572
Joined: Mon Mar 25, 2013 7:01 pm

Re: Virtualbox not working with EFI vdi

Post by Octocontrabass »

That sounds an awful lot like VirtualBox isn't configured for UEFI.

Does it work if you use a different VM, such as QEMU or Bochs? Setting up QEMU for UEFI is pretty easy.
heemogoblin
Posts: 13
Joined: Sat Jun 27, 2020 8:00 am
Libera.chat IRC: heemogoblin

Re: Virtualbox not working with EFI vdi

Post by heemogoblin »

Thank you so much! Turns out I forgot to enable EFI, since I had to keep making and deleting my VM.
Post Reply