Comments (10)
@IanSeyler It will help with UEFI, yes. I'm working on porting the library now to see if it will work. We might not need to use the code in the actual bootloader. Mainly we need it in the utility program to create the filesystem and put the files into it.
from pure64.
GPT is added, now. Memory map and system information will be passed to the kernel by either a register or the stack.
from pure64.
Booting from UEFI is an interesting task.
First off, an EFI application (e.g. bootloader) is stored in the PE format and uses Microsoft's C calling conventions.
An EFI application is called with two parameters, the "image handle" and the system table. The system table is where there are interesting things; the ConfigurationTable
variable is where the list of ACPI tables are stored following this format. Also of note in the configuration table are the Boot Services function table and the Runtime Services function table; these function tables are very useful for bootloaders. After the bootloader exits, only the Runtime Services functions are still safe to call, though. The function table is typically represented as a struct and the C headers required to do so are pretty common (e.g. a stripped-down version can be found here).
To get a memory map, call a function at an offset into the Boot Services function table. The returned memory map is not E820 and will need to be converted for use in Pure64 (if we want to keep backwards compatibility).
IIRC, in proper UEFI, MBR and GPT partition tables should both be supported. However, I'm not sure if this is the case in the wild.
There is text mode in UEFI! Actually, graphics mode can be a pain since we will need to embed our own font into the application if we want to print text during the bootup process. Not sure if we want to offload this to the OS, or keep it with Pure64.
Note that I have linked sources that are not the actual 2000+ page PDF put out by the UEFI Forum, since I doubt that many people have the time to read through all of the specification... The latest specification can be found on the UEFI Forum website.
from pure64.
@ohnx Supporting UEFI will likely require many changes in the BareMetal-kernel. That's okay. It should not be that hard to go from E820 to a different structure.
Currently, text is printed out through a serial port that we can view through QEMU.
I'm hesitant to make a solution for printing text to the screen. If anything, I would send it to a file, so that it has a tangible form on disk. But I'm open to suggestions.
from pure64.
I think my project could help you with this:
https://github.com/KNNSpeed/Simple-UEFI-Bootloader
Looks like you guys might be trying to do a similar thing.
Bear in mind UEFI compatibility can be pretty nasty when dealing with earlier (c. ~2011-2012) systems, as vendors didn't really like to follow spec back then. E.g. 0-byte reads fail on Intel boards, RAM "pollution" on startup, etc. Newer machines tend to be better about all this, except Macs whose wireless cards randomly DMA into your RAM (see https://mjg59.dreamwidth.org/11235.html).
from pure64.
@KNNSpeed I like the project you linked.
I was not aware how bad the adoption of UEFI was in that time period, that's pretty funny.
I'm not sure if we can use the GNU EFI implementation, it's incompatible with our BSD license the way I understand it.
The hurdle we're facing now is creating FAT file systems on the image. While there are tools that exist for this, they're mainly for Linux. We need to have a FAT library in house so that we can not only create the file system, but also read to and write from it in the file system loader. Once we get to that point, then we'll be able to reference bootloaders like yours to get an idea of what a working implementation looks like.
Thanks for the link!
from pure64.
No problem!
I guess libraries like FATFs (http://elm-chan.org/fsw/ff/00index_e.html) are out of the question, then?
Technically if you stayed in UEFI without calling ExitBootServices() you would have access to all the FAT functions already there, but I have a feeling you guys want to get out of boot land as fast as possible. A nice thing about UEFI is that it already does all of this for you, and you can actually use UEFI functions to set up a system how you like and then pass whatever you want to a kernel. ...Unless you're [eventually] trying to write your own UEFI firmware?
from pure64.
@knn I've thought about Pure64 as a UEFI firmware but for now that's more of an "eventually" kind of thing.
That file system library looks useful. Although I don't particularly like libraries that use global variables, it's small enough that it's easy to patch. The license looks like it's compatible.
@IanSeyler what do you think about importing FatFS source code into the Pure64 project?
from pure64.
@tay10r If it will help with UEFI then sure.
from pure64.
Just to update everyone, I've began refactoring the FAT library that @KNNSpeed mentioned and you can see the progress in the new libfat repository.
Once that's done, I would like to make a way for users to put their kernels onto the disk file without having to compile them with the monolithic bundle of software that is mingw
(since Microsoft's ABI is used in the UEFI standard.)
from pure64.
Related Issues (20)
- Update pxestart.asm
- Decreased binary size HOT 1
- will hang up when rebooting the 3rd time HOT 1
- ELF64 loading HOT 1
- Configure and activate the IO-APIC HOT 1
- Multiboot 2 HOT 2
- PXE booting is broken
- Graphics mode HOT 2
- Could Pure64 fit on a floppy disk? (maybe 2.88 MB if can't to 1.44 MB) HOT 3
- riscv64 Support
- Setting Up Partition Information
- Switching File System to FAT32
- Loading Position Independent Kernels
- Loading PE Files, Again
- Custom Bootsector
- aarch64 Support
- mips64 Support HOT 1
- Question about ROM area HOT 1
- Pure64 fails to compile HOT 2
- Missing mbr.sys HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pure64.