OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 2:24 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: GRUB - UEFI emulation?
PostPosted: Sun Aug 20, 2017 11:24 am 
Offline
Member
Member
User avatar

Joined: Sun Feb 20, 2011 2:01 pm
Posts: 110
So, I've been writing a UEFI OS. Of course, we all want our OSes to run on all systems, not just UEFI.
However, I've been thinking. GRUB2 has a nice set of drivers and module support. It even provides the same flat memory model as UEFI.
So, what's to prevent GRUB2 emulating UEFI firmware? OK, not the full runtime service thing, but I don't see a significant subset being too difficult.
Thoughts?

_________________
Whoever said you can't do OS development on Windows?
https://github.com/ChaiSoft/ChaiOS


Top
 Profile  
 
 Post subject: Re: GRUB - UEFI emulation?
PostPosted: Sun Aug 20, 2017 12:54 pm 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
bellezzasolo wrote:
So, I've been writing a UEFI OS. Of course, we all want our OSes to run on all systems, not just UEFI.
However, I've been thinking. GRUB2 has a nice set of drivers and module support. It even provides the same flat memory model as UEFI.
So, what's to prevent GRUB2 emulating UEFI firmware? OK, not the full runtime service thing, but I don't see a significant subset being too difficult.
Thoughts?

Not sure what your after..

Is your idea that your OS would only support UEFI boot and it would work directly with UEFI machines and on BIOS machines you would use GRUB2 and it should provide UEFI environment so your bootstrap still works?

Wouldn't it be better and simpler to separate the two distinct concerns:
- OS/kernel doesn't care how it gets instantiated, it just wants to be a good OS/kernel
- Bootstrap is firmware specific (BIOS or UEFI, or something else for other than PC platforms) and it's job is to instantiate your OS

So write your UEFI bootstrap in such a manner that it "instantiates" your OS and then you can write another one for BIOS, and the latter stages of both can and likely would be nearly identical.

I don't really see much benefit in trying to make BIOS look like UEFI, given that the other solution is more reliable since trying to "translate" all UEFI stuff into BIOS stuff in such a manner that it always works is pretty much impossible, unless GRUB2 becomes even more of an OS in and of itself.


Top
 Profile  
 
 Post subject: Re: GRUB - UEFI emulation?
PostPosted: Sun Aug 20, 2017 4:17 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 642
Location: Ukraine, Bachmut
bellezzasolo wrote:
So, I've been writing a UEFI OS. Of course, we all want our OSes to run on all systems, not just UEFI.
However, I've been thinking. GRUB2 has a nice set of drivers and module support. It even provides the same flat memory model as UEFI.
So, what's to prevent GRUB2 emulating UEFI firmware? OK, not the full runtime service thing, but I don't see a significant subset being too difficult.
Thoughts?

Runtime services are a tiny portion of UEFI, probably you meant Boot Services (and bunch of protocols for doing things like various I/O for storage and overall peripheralls (SATA, USB and PCIe are alone a monstrous thing each, but there are a lot yet - SD/MMC, NAND for example), graphics, consoles, driver binding, device paths, various networking things like TCP/IP, TFTP, iSCSI, PXE, etc etc)?

And why "emulating"? Is it religiously forbidden for it to even think it could "implement" it? :D Who knows better than the GRUB developers? I think they know better. Since I am working with mips and arm SBCs I have no idea about GRUB, but I heard it is able to play role a UEFI OsLoader, so maybe this is their way - they don't think it's needed for them to compete with Tianocore, which already supplies a base ground, massive framework, in fact, for traditional BIOS makers, now making UEFI? They just don't want. How does that idea look to you?

Personally, I don't see any reason for hobby OSes aiming at x86 to support legacy protocols like BIOS. It's just work for the past, not future. UEFI is getting widespread, so if you ever will have users for your OS, they most probably will be more comfortable with UEFI than BIOS. :) It's like learning assembly by books talking about 16-bit real mode and DOS. Somehow it's often seen even now.

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


Top
 Profile  
 
 Post subject: Re: GRUB - UEFI emulation?
PostPosted: Sun Aug 20, 2017 6:14 pm 
Offline

Joined: Tue Jul 25, 2017 11:25 am
Posts: 6
zaval wrote:
Personally, I don't see any reason for hobby OSes aiming at x86 to support legacy protocols like BIOS. It's just work for the past, not future. UEFI is getting widespread, so if you ever will have users for your OS, they most probably will be more comfortable with UEFI than BIOS.


I disagree. While most modern PCs support both UEFI and BIOS not all emulators support UEFI. Most users will probably run a hobby OS on an emulator and they might use an emulator which does not support UEFI like Bochs.


Top
 Profile  
 
 Post subject: Re: GRUB - UEFI emulation?
PostPosted: Tue Aug 22, 2017 5:57 am 
Offline
Member
Member

Joined: Tue May 13, 2014 3:02 am
Posts: 280
Location: Private, UK
Notturno wrote:
I disagree. While most modern PCs support both UEFI and BIOS not all emulators support UEFI. Most users will probably run a hobby OS on an emulator and they might use an emulator which does not support UEFI like Bochs.


Not only that, but few people are willing to "hand over" expensive, up-to-date hardware for testing a hobby OS on (whether it's their own or someone elses). Much more likely that they'll have a few-generations-old PC sitting in a cupboard somewhere with nothing on it that they don't mind losing...

_________________
Image


Top
 Profile  
 
 Post subject: Re: GRUB - UEFI emulation?
PostPosted: Tue Aug 22, 2017 8:10 am 
Offline

Joined: Sun Apr 16, 2017 4:45 pm
Posts: 6
For what it's worth I think there are a few legacy BIOS boot loaders like Chameleon that emulate (U)EFI for the purpose of booting macOS on non-EFI systems.


Top
 Profile  
 
 Post subject: Re: GRUB - UEFI emulation?
PostPosted: Tue Aug 22, 2017 2:58 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
This is somewhat off-topic but you might find this interesting: https://www.cnx-software.com/2016/08/11 ... platforms/

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: GRUB - UEFI emulation?
PostPosted: Tue Aug 22, 2017 3:33 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 642
Location: Ukraine, Bachmut
mallard wrote:
Not only that, but few people are willing to "hand over" expensive, up-to-date hardware for testing a hobby OS on (whether it's their own or someone elses). Much more likely that they'll have a few-generations-old PC sitting in a cupboard somewhere with nothing on it that they don't mind losing...

that is what I called "working for the past".

you won't test your own creature on the "up-to-date" hardware even having it? you hate your OS! :lol:

well, it's a little stereotyped. like "new hardware" necessarily means a several times overpriced new iSomething(R) device from you know. :D Nowadays one could buy a little and cute and inexpensive x86 SBC with all the new features, still quite affordable by price. Exactly for testing his/her own OS. Or have something not bloody new, but still quite modern. different flea markets suggest all the spectrum for all prices. shortly speaking it's a very bad excuse to still mess around BIOS/DOS/16 bits in 2017. And finally, "testing the OS" is not going to burn out your shiny rig. :) The biggest damage would either nihilizing data on the storage - easily overcome, just use an empty drive, or bricking the board. only if you play with the FW, which is improbable, but that still is kind of revertible.

Roman wrote:
This is somewhat off-topic but you might find this interesting: https://www.cnx-software.com/2016/08/11 ... platforms/

uboot...
Image

last time I checked their "support", most Services were just stubs. It's not implementing UEFI, it's mimicking and pretending you do so. they just managed to run some primitive UEFI applications. Noone with a sane psychic would use uboot for UEFI on arm. There is Tianocore which is a true UEFI implementation. uboot is a messy linux only kind of loader.

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], deblokc and 110 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