OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 10:11 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Opinion: Does UEFI make OS development easier?
PostPosted: Mon Sep 18, 2017 7:45 am 
Offline

Joined: Thu Sep 07, 2017 1:29 pm
Posts: 7
I'm trying to decide whether to write my OS using the multiboot spec or using UEFI, and I'm wondering for those of you who have used both, does using UEFI make things easier or more difficult?


Top
 Profile  
 
 Post subject: Re: Opinion: Does UEFI make OS development easier?
PostPosted: Mon Sep 18, 2017 9:32 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
This is less about the OS proper and more about a specific installed configuration - the question isn't "should I use one or the other?" but "should I support both, or is UEFI sufficiently widely used that I don't need to support motherboards that don't have it?" If you decide to support both Legacy BIOS using MultiBoot, and UEFI without MB, then it is up to the OS installer and configuration tools to choose which to use.

The biggest issue here, I think, is not in how the OS boots, but in how it gets the information about the hardware that it needs in order to configure itself at startup - especially the memory map. The difference here is that in MultiBoot, the boot loader is only in memory and runnable up to the point of the hand-off, so anything it needs to give to the OS, it has to do then - the purpose of the Boot Information Table (part of the MultiBoot Header) is to give it somewhere to put that information where the OS can find it.

UEFI, on the other hand, is still resident while the system runs, so - as I understand it - if the OS has support for accessing the UEFI information, then it can get it whenever it chooses. This obviates the need for a header at hand-off, but means the OS needs to know that it is running on a UEFI mobo and have operations for querying it.

You will note that this is primarily an issue in x86 systems with only Legacy BIOS, one due primarily to the lack of a 32-bit version of the BIOS routines - exactly what UEFI is meant to fix for x86. In systems using UEFI, or ones using other processors (ARM, MIPS, etc.), the BIT is mainly a matter of convenience, though some configurations may still have information that is only accessible at boot-up.

This is also why, when MB-compliant boot loader loads a system that doesn't support a MBH (and hence won't use a Boot Information Table), it has to chain boot, and why chain booting on x86 doesn't switch to p-mode - the OS has to be able to get that information from the BIOS on its own, which means the OS has to be able to access the 16-bit BIOS. Presumably, such systems (e.g., Windows) anticipate booting into real mode anyway, so switching first would actually cause the start-up to fail.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Opinion: Does UEFI make OS development easier?
PostPosted: Tue Sep 19, 2017 4:15 am 
Offline
Member
Member

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 306
Location: Germany
This depends on what you are trying to do with it. UEFI offers you some nice services to get up and running pretty quick, but all usable (i.e. production-grade-ish) UEFI implementations (gnu-efi and TianoCore) are horrible.

Multiboot is a lot simpler, but doesn't give you as many options; the data you get is what you requested. Now that is fine, but this doesn't allow you to e.g. select the optimal resolution for modesetting by yourself, but involves either guessing a lowest common resoltion or having the user decide in the bootloader. On top of that, if you are dealing with Multiboot2, you can expect it to be broken at times.

Personally, I have decided to keep Multiboot2 for x86. I may consider adding Multiboot if I run into issues with GRUB2, but for now I'm fine. Running both multiboot standards is of limited use, though. UEFI looks like the way to go for x86_64, simply because getting the information that GRUB2 is giving you via Multiboot is so easy that it's not worth bothering with it in the first place. Did I mention that pretty much any PC sold in the past 5 years is x86_64 UEFI?

To really answer your questions, UEFI might have made OS development easier - but IMHO it just shifted the pain and burden of old problems to new ones. That said, it's the future-proof way to go.

_________________
managarm


Top
 Profile  
 
 Post subject: Re: Opinion: Does UEFI make OS development easier?
PostPosted: Mon Oct 02, 2017 8:42 am 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 3191
As already explained, the primary issue is what different target systems support, and what they will support in the future. It appears that at the moment, many x86 systems still support both legacy and UEFI.

I think legacy is a lot better. First, several UEFI implementations are incredibly buggy when not booting Windows or Linux. Second, you have to decide on a video-mode when booting with UEFI, and the VBE interface part of BIOS is not available. But since neither Windows nor Linux uses the legacy BIOS anymore, and have native video drivers, the VBE interface is getting increasingly more buggy (and lacking in video resolutions). On some systems, the UEFI BIOS cannot set or detect real resolutions either, so you are out of luck regardless.

The worst problem today is that OS developers once more need to write graphics drivers for a set of different chips, some that completely lack official documentation. When VBE still worked, you could use the BIOS for mode-switching, and then the linear frame buffer for output, but this is deteriorating as VBE lacks important resolutions, and UEFI sometimes is no longer being able to set them either.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot], Sa41848 and 77 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group