Some days ago, I decided to return to OS development. Until now, I experimented with booting from a HDD, booting from network (PXE) and booting from CD using El Torito, which I'm currently continuing. I'm planning to start from a monolithic kernel, which I'll turn into a microkernel later during development, after the interfaces between the kernel and the device drivers have been refined.
But now to the question. The bootloader can print warning/error messages using the firmware. Then, it loads the kernel and the firmware stops being functional. The kernel may not need to print anything, or it may print after the graphics driver has been started. But it may also need to warn that something failed before the graphics driver was started (in this case a log buffer would do the trick and it would be flushed after the graphics driver started, this is AFAIK something that Brendan suggests). But what if the graphics driver cannot be started for some reason? How should the kernel warn about it?
This is what I've thought about until now:
- Have a BAL that can be used from the kernel using callback functions. The BAL reverts to real/v86 mode and uses the BIOS to print. But this doesn't work for UEFI, which stops being functional after calling ExitBootServices().
- Use a "basic graphics driver" in the BAL that doesn't do any advanced things (like 3D acceleration, shaders and such) and only prints messages to the display in known video modes. But what if I decide that the kernel should be configurable to use other means (e.g. serial, USB drives, network, etc) to report messages? Would I turn the BAL into a monolithic kernel?
- Ignore the display and use the second most-preferred means of reporting messages (see previous point). But what if for some reason everything fails (e.g. no serial present, no USB drives attached, unknown network card present, etc)? Of course when everything fails, the system is unusable, but knowing why it's unusable is preferable to not knowing why it's unusable.
Thanks in advance!
Regards,
glauxosdever