Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Currently I am in need of a hard disk driver, but I am not really sure how I should deal with it. I'm writing a bootloader and the driver should be small. I want to hit as many drive types at once with the least bytes of code (which is probably causing poor performance, but I don't care for that yet) because I have a current max executable size of 127 sectors (due to 1 MiB limit, loading from 0x7e00:0x200). I want to use this driver to load the core image of my bootloader.
Would it be wise to use
* ATA PIO
* DMA access
* AHCI driver
* Something else I didn't mention yet
* ATA PIO
* DMA access
* AHCI driver
* Something else I didn't mention yet
The functions or services that the firmware provides specifically so that boot loaders don't need to include a large number of different drivers (PATA, ATAPI, AHCI, USB & USB storage devices, lost of different SCSI, etc) that will become useless as soon as the kernel is running.
I vote for the option you forgot.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
I agree. The bootloader is just meant to be enough to load the Kernel, or whatever may come next.
In my bootloader, I just use interrupt 13 to load sectors from disk. This loads the Kernel.
Of course this has to be done before entering protected mode.
Note that Brendan said "firmware" instead of "BIOS" for a reason. Even x86 boxes can have other types of firmware, the most popular of which are: OFW, EFI, and UEFI---they all have different APIs. Drivers are usually provided by the firmware vendor, but sometimes they can be supplemented by systems programmers.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
Love4Boobies wrote:Note that Brendan said "firmware" instead of "BIOS" for a reason. Even x86 boxes can have other types of firmware, the most popular of which are: OFW, EFI, and UEFI---they all have different APIs. Drivers are usually provided by the firmware vendor, but sometimes they can be supplemented by systems programmers.
True, true. Are there some existing bootloaders/operating systems which use one of these? So I can look at something more then specifications and documentation..
Yes, OS X and Windows both support EFI. I don't know about Windows x86/x64 (the answer is probably yes, though) but Windows IA-64 certainly does. I suspect other major OSes have added support for it as well (e.g., Linux, FreeBSD, etc.) but I haven't checked.
According to some quick googling, OS X also supports OFW, which is kind of surprising---will have to look into that. You should probably look into Solaris and z/OS as well.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
Love4Boobies wrote:I'm obviously not an Apple fanboy I was under the impression that OS X was x86(-64)-only and OS 9 was PPC-only; that's why I found it surprising.
OS X was shipped on PowerPC Macs for many years, it was announced everywhere when they switched to x86, "Intel Macs".
I have never looked at EFI before.. So, I'm not completely familiar with it. Does it replace the BIOS completely and do I boot with a special image written to boot with EFI? Or can I boot normally with the BIOS, do stuff and when I need the hard disk, I jump to a special image which can use EFI? That last sounds to nice to be true, actually..
Bietje wrote:Does it replace the BIOS completely and do I boot with a special image written to boot with EFI? Or can I boot normally with the BIOS, do stuff and when I need the hard disk, I jump to a special image which can use EFI? That last sounds to nice to be true, actually..
It should eventually replace the BIOS, yes. However, most of today's EFI and UEFI systems are actually hybrids. They are either built on top of the PC BIOS or the other way around. The second part of the first question is ambiguous (because you don't specify what you mean by "image"---could be either the firmware or the OS); if you're asking whether your boot loader needs to support (U)EFI, the answer is yes.
As for the second question... I really don't know what you are asking. Whatever it is, it's obviously misguided. Why would you want to use the BIOS and then (U)EFI? Do you eat half of your meal, put the remaining half in a different plate and then eat that?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]