سؤال

I've recently begun a vast project... making my own homemade OS. It's turned out to be a lot harder than I thought, but I'm determined to stick with it until I get something usable. I've managed to get boot loader working on a VirtualBox Machine, but I'm stuck on the next step. I'm trying to load a second stage to the boot-loader, but have no clue on how to load it into memory and run it. I've considered using the GRUB boot loader, already so please don't suggest it. If it's possible a code example would really be helpful. If it matters, I'm using NASM on Ubuntu. Any help is greatly appreciated.

هل كانت مفيدة؟

المحلول

At first, you need to have at least simple file system support in your bootloader. As long as in the bootloader is hard to support full featured file system, several tricks are possible:

  1. Make very-simple-file system support. For example, search for a file with a given name from the root directory of the boot device.

  2. Or simply reserve some physical sectors for your second stage binary and read it directly from there.

The second service you need is a executable file loading and executing. The most simple solution is to use plain binary image of the memory, like in DOS .com files.

So, then the bootloader will be able to load one bigger program from the disk, to place it in the memory and to run it. This bigger program now have enough space to provide file system support and complex executable files loading/running. In more simple cases, this executable may contain your whole kernel and to start it directly without loading additional modules.

نصائح أخرى

If you really want to use GRUB then you'll have to create a Multiboot compliant kernel file. The specification is found here: http://www.gnu.org/software/grub/manual/multiboot/multiboot.html

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top