UEFI can open files at any given path inside FAT16/FAT32 partitions and you can choose which partition too, even if the interface for that is not so nice.bzt wrote:If UEFI itself can't access paths inside a partition, then POSIX-UEFI can't either.
Sorry, what is "GOP" ?bzt wrote:What do you mean "many cases"? So far GOP is the only one that I couldn't wrap up in POSIX calls.
Ehm, maybe. But I was thinking about the general case, not about a very basic bootloader. For example, I wrote a UEFI bootloader that take advantage of many UEFI features that are not covered.bzt wrote:Everything needed by a basic boot loader covered.
Relax, man. There's no need to "heat up". I'm not attacking you nor your project. Actually, the only reason I'm spending time on this discussion is because I kind of liked your overall idea and I was trying to discuss ways to improve it, through constructive criticism. If you're against that, I'd be happy to stop.bzt wrote:What is your problem? By default you have to use that messed up UEFI interface for EVERYTHING or use those braindead library functions from EDK2 (which do not cover every UEFI protocol either btw). When you use POSIX-UEFI, you can spare yourself and use a much simpler interface in 99% of the time. And even for those 1% native UEFI calls POSIX-UEFI provides a simple implementation, a simple and fast build system (compared to EDK2's bloat). What is that you can't understand about this? If you are your own enemy, then go ahead and use that horrible EDK2. I've done that, I know exactly what I'm talking about. No sane people would ever think EDK2 is good or at least a bit usable.
I've been using only GNU-EFI, all the time. The EDK2 bloat is not worth to me either. But, I have to point out that GNU-EFI does not need uefi_call_wrapper: newer versions of GCC support directly the special MS-ABI attribute, but it works with older versions of GCC as well by using -maccumulate-outgoing-args. I've personally done it. uefi_call_wrapper() is needed only if you don't want or cannot use the MS ABI.bzt wrote: GNU-EFI is much better, but it has its own pitfalls (the need of uefi_call_wrapper and doesn't compile with CLang).
I don't agree. The mapping is only partial. I've tried explaining this, no point in insisting further.bzt wrote:Think it again. Apart from the ABI their API is not so different. UEFI mimics Windoze calls, and you can convert those into libc (anybody who has written a multiplatform application knows that). The only real difference is, that UEFI needs a huge load of helper functions to hide the actual protocol interfaces, while a true POSIX kernel doesn't, just a single libc with well-defined interface to wrap up syscalls.vvaltchev wrote:At the moment, I believe that the POSIX model cannot map well UEFI, roughly because UEFI is not a UNIX-like kernel.
The problem is that, from MY point of view, those case are not so rare. The subset of UEFI you're wrapping is too small for me. Please, accept that.bzt wrote:For those rare cases you use the same interface that you'd have to use for EVERYTHING otherwise.vvaltchev wrote:While some POSIX functions might be perfect for UEFI, in other cases you will inevitably end up with limitations.
That's great, actually! Do you have also /dev/diskNp0, /dev/diskNp1 etc. ?bzt wrote: Yes, we can! Here are the list of pseudo device files under POSIX-UEFI:
/dev/stdin - returns EFI_SIMPLE_TEXT_INPUT_PROTOCOL instance (ST->ConIn)
/dev/stdout - returns EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance (ST->ConOut)
/dev/stderr - returns EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance (ST->StdErr)
/dev/serial - returns EFI_SERIAL_IO_PROTOCOL instance
/dev/diskN - returns EFI_BLOCK_IO_PROTOCOL instance
...anything else - returns EFI_SIMPLE_FILE_SYSTEM_PROTOCOL instance
No, I'm not mixing anything. In UNIX everything is a file because we have kernel. We have /proc, /sys, /dev etc. That's why "everything is a file". If you don't have those special file systems, not everything can be a file.bzt wrote:No, we don't. You're mixing up interface with implementation. Two totally different implementations might have the same interface. A good example fprintf. That's the best thing in UNIX and POSIX, everything is a file.vvaltchev wrote:We'd need maybe a different mechanism to enumerate all the disks and partitions. The same applies for video modes, network devices and other fancy UEFI features.
OK, that's good to hear.bzt wrote:Never intended to by strictly POSIX-compliant. That's not possible without a kernel.
That's exactly what I liked about your idea! The only thing that I've been trying to tell you all the time that you might need to add more functions, enumeration mechanisms etc. It still will be easier/more familiar than UEFI. I like the UNIX philosophy: simple problems have simple solutions; when you need something more advanced, you use a more advanced interface. That's why, your project is a good starting point, in my opinion.bzt wrote:The point is, use interfaces that look like POSIX so that people don't have to learn and s*ck with that horrible GUID interface and learn nearly a hundred of helper functions from the supporting library (which is constantly changing btw). Instead programmers can use a few functions that they are already familiar with, so there's no need to learn everything from the gourd up.
The newbie will choose option b), I totally agree. I believe that the whole discussion is about the fact that you're interested only in that case: the minimum set of functions for a trivial bootloader written (maybe) by a newbie. The case I believe instead is worth exploring as well is the general one: people with ANY degree of experience. Newbies will use the simple part of the interface and will do simple things. Experts will use everything and will be pleased to use a "uniform" interface instead of mixing UEFI and POSIX-like code.bzt wrote: One example, which is more obvious to you? Which one should an UEFI newbie choose?
a) find the system table, find boot services in it, and LocateProtocol method in it. Then use that method with some magic numbers to return a struct which in turn must be defined exactly the same way in your application as in the firmware, and which should contain a method called GetRNG() which has parameters that you have to learn
- or -
b) call the well-known rand() that you're already familiar with to do the same thing.
Still, being YOUR project, obviously you can drive it in any direction you prefer. Nobody can ultimately force you to change your mind. The only thing other people like me can do is to offer some perspective and ideas. Your project seemed to me that can be evolved beyond a nice "helper tool for newbies" and that's why I've spent already a lot of time discussing with you. But, I don't plan continuing any further, unless you really ask for that; I believe I've done my best to share good ideas.