如果你要自己写个bootloader,那么请先看这些

本文建议不要将BootLoader作为首个开发项目,并列举了多个理由,包括BootLoader并非完整的操作系统、编写高质量BootLoader的难度等。同时推荐在特定环境下使用DOS、FreeDOS或GRUB作为BootLoader。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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如果你是在DOSWindows 9x开发,您可以使用DOS(或的FreeDOS)作为你的BootLoader否则,使用GRUB它并不完美,但它仍比编写自己的更好,它是最接近“标准”BootLoader

 

这是翻译的一小段文章

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值