Some advice on writing your own bootloader
Don't do it. At least, don't make the bootloader the first thing you work on. Reasons:
l A bootloader is not an OS.
l A bootloader is a VERY SMALL part of an OS.
l Writing a GOOD bootloader is as much work as writing a small OS (e.g. GRUB).
l Writing a robust and flexible bootloader is difficult. (Writing a crappy and inflexible bootloader is distressingly easy.)
l Writing a bootloader requires a lot of arcane knowledge (e.g. unreal mode, A20 gate, BIOS bugs and subtleties) that is otherwise useless.
l Bootloaders are very difficult to test and debug.
l Because of the hybrid 16- and 32-bit nature of x86 CPUs, x86 boot code is ugly.
l If booting your kernel fails, you won't know if the error is in your kernel or in your bootloader.
l If you are developing under DOS or Windows 9x, you can use DOS (or FreeDOS) as your bootloader. Otherwise, use GRUB. It's not perfect, but it's still better than writing your own, and it's the closest thing to a 'standard' bootloader there is.
不这样做。至少,不要使BootLoader是你你要做的第一件事。原因: lBootLoader不是操作系统。 lBootLoader是一个操作系统的一非常小部分 l写一个良好的BootLoader如同写一个小操作系统(如GRUB的大量工作)。 l编写一个强大和灵活的BootLoader是困难的。 (编写蹩脚和僵硬BootLoader简单得出奇。) l写一个BootLoader需要一大推神秘的知识(如unreal mode, A20 gate, BIOS bugs and subtleties),否则这是无用的。 lBootLoader的测试和调试是非常困难。 l由于混合16 - 和32位的x86 CPU ,x86的启动代码是丑恶。 l如果你的内核启动失败升,你不知道错误是在你的内核,或者在你的引导。 l如果你是在DOS或Windows 9x开发,您可以使用DOS(或的FreeDOS)作为你的BootLoader。否则,使用GRUB。它并不完美,但它仍比编写自己的更好,它是最接近“标准”BootLoader。 这是翻译的一小段文章