|
作为取替Grub的下一代启动加载器GRUB2,正在开发中。
GRUB 2, which is a rewrite of GRUB, is alive and under development. GRUB 2 aims at merging sources from PUPA in order to create the next generation of GNU GRUB. A mailing list and a wiki have been setup for discussing the development of GRUB 2.
GRUB 2 has the following tasks:
* Create a compact core image. This will make Stage 1.5 unnecessary.
* Add support for dynamic loading to the core image, so that it can extend itself at the run time rather than at the build time.
* Add real memory management, to make GNU GRUB more extensible.
* Add a more object-oriented framework for file systems, files, devices, drives, terminals, commands, and OS loaders.
* Add support for internationalization. This includes support for non-ASCII character code, message catalogs like gettext, fonts, graphics console, and so on.
* Add an actual localization, based on the above internationalization support. We will target on Japanese as the first step.
* Segregate code specific to i386-pc from generic code, to make GNU GRUB portable.
* Add support for cross-platform installation.
* Develop additional software packages which will help our project and hopefully other projects.
从官方的说明可以看到,与Grub相比,最大的差异在于GRUB2将stage1.5以及stage2的功能归并为GRUB2的kernel(源码放在GRUB2源码目录下的kern),并提高了压缩性能;我测试过,使用CVS版本来编译生成的kernel──core.img只有24KB左右,即使对于最普遍的chs读写模式所支持的0面0道的64个扇区(折合32K左右)而言,空间是足够放置GRUB2的kernel的,要知道,Grub的每个stage1.5都至少在11K左右,而stage2则为110K左右,这种体积上的跃变,是很厉害的一件事!
而stage1则对应了GRUB2中的boot.S,start则对应了GRUB2中的startup.S,这两个扇区在GRUB2中发挥的作用差不多,都调用了BIOS的INT 13H扩展例程来加载后续扇区,唯一不同的是,startup.S加载的不是stage1.5或者stage2,而是GRUB2的kernel。
提到kernel,很自然想象到module,没错,GRUB的kernel也使用了模块机制。
- /* The main routine. */
- void
- grub_main (void)
- {
- /* First of all, initialize the machine. */
- grub_machine_init ();
- /* Hello. */
- grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
- grub_printf ("Welcome to GRUB!\n\n");
- grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
- /* It is better to set the root device as soon as possible,
- for convenience. */
- grub_set_root_dev ();
- /* Load pre-loaded modules and free the space. */
- grub_register_exported_symbols ();
- grub_load_modules ();
- /* Load the normal mode module. */
- grub_load_normal_mode ();
-
- /* Enter the rescue mode. */
- grub_enter_rescue_mode ();
- }
复制代码
从kernel的main函数可以看到,它调用grub_load_modules()来加载所有的模块,这就是GRUB2扩展性能的体现之一。
另外,GRUB2支持多国语言的显示,主要在configfile注释、命令输出、标题等处。目前的CVS版本仅支持日文。
一个优秀的Boot Loader──GRUB2,正如一个mini OS。它展现了内核之外的另一道风景线。
在RMS所提倡的freebios面世之前,GRUB2是自由之歌最好的前奏了。
我认为,"Freebios + GRUB2 + linux/Hurd"将会成为GNU最坚厚的基石,到了那时,除了硬件不开源以外,所有的软件甚至包括各种固件都会走向GNU自由开源的道路,呵呵。 |
|