Qemu/OVMF boots to black screen
Posted: Fri Jul 28, 2023 4:16 pm
After some time of not compiling my code, I came back to work on it and Qemu now displays a black screen.
The EFI bootloader worked both in Qemu and on real hardware when I last worked on it with the same source code. I unfortunately overwrote the working efi file when I was troubleshooting the issue with real hardware.
I do have a working efi file of an older version so I don't think It's Qemu or OVMF since it boots on real hardware too. (Included in the zip) I have also tested with an older gcc cross compiler (11.0.1) and older qemu (7.2.4) compiled from source and neither has fixed or has had any impact on the issue.
I have noticed that removing any reference to 'Print(...);' in my bootloader code does allow the bootloader to continue running until 'setCR3' where it presumably pages faults due to other code I had to remove to reach that point. Some other functions such as any file based UEFI function. Using the inline assembly helped me conclude where I was actually getting when removing UEFI functions and the code runs the same without them present.
Maybe this is related to how my bootloader is being linked against gnuefi? I have tried to use GDB but I cannot get to to display actual assembly instructions or C code for any of my efi code.
Changing the Qemu video outputs also causes seemingly unrelated faults to occur such as Undefined Opcode and Page Faults (UEFI prints them to the log file).
The display also seems to be printing out to the serial file since using 'cat ./Other/RoverOS.log' shows the GRUB boot menu screen and random characters (which I assume is actually the framebuffer being outputted).
The GRUB command line will also say there are 'no supported video modes' when using the 'videotest' command.
I followed the UEFI tutorial on the wiki and I get the same results as my code.
I am unsure of why the code is no longer working. Maybe I am overlooking something simple.
The current code is here: https://mega.nz/file/F2p2VIgZ#8yGb-I-hW ... sim6NV5ZSo
And the old code that used to work is here: https://github.com/Roverx64/RoverOS
The EFI bootloader worked both in Qemu and on real hardware when I last worked on it with the same source code. I unfortunately overwrote the working efi file when I was troubleshooting the issue with real hardware.
I do have a working efi file of an older version so I don't think It's Qemu or OVMF since it boots on real hardware too. (Included in the zip) I have also tested with an older gcc cross compiler (11.0.1) and older qemu (7.2.4) compiled from source and neither has fixed or has had any impact on the issue.
I have noticed that removing any reference to 'Print(...);' in my bootloader code does allow the bootloader to continue running until 'setCR3' where it presumably pages faults due to other code I had to remove to reach that point. Some other functions such as any file based UEFI function. Using the inline assembly helped me conclude where I was actually getting when removing UEFI functions and the code runs the same without them present.
Maybe this is related to how my bootloader is being linked against gnuefi? I have tried to use GDB but I cannot get to to display actual assembly instructions or C code for any of my efi code.
Changing the Qemu video outputs also causes seemingly unrelated faults to occur such as Undefined Opcode and Page Faults (UEFI prints them to the log file).
The display also seems to be printing out to the serial file since using 'cat ./Other/RoverOS.log' shows the GRUB boot menu screen and random characters (which I assume is actually the framebuffer being outputted).
The GRUB command line will also say there are 'no supported video modes' when using the 'videotest' command.
I followed the UEFI tutorial on the wiki and I get the same results as my code.
I am unsure of why the code is no longer working. Maybe I am overlooking something simple.
The current code is here: https://mega.nz/file/F2p2VIgZ#8yGb-I-hW ... sim6NV5ZSo
And the old code that used to work is here: https://github.com/Roverx64/RoverOS