LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 11425|回复: 18

GRUB2的新特性

[复制链接]
发表于 2005-3-17 13:36:44 | 显示全部楼层 |阅读模式
作为取替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也使用了模块机制。

  1. /* The main routine.  */
  2. void
  3. grub_main (void)
  4. {
  5.   /* First of all, initialize the machine.  */
  6.   grub_machine_init ();

  7.   /* Hello.  */
  8.   grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
  9.   grub_printf ("Welcome to GRUB!\n\n");
  10.   grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);

  11.   /* It is better to set the root device as soon as possible,
  12.      for convenience.  */
  13.   grub_set_root_dev ();

  14.   /* Load pre-loaded modules and free the space.  */
  15.   grub_register_exported_symbols ();
  16.   grub_load_modules ();

  17.   /* Load the normal mode module.  */
  18.   grub_load_normal_mode ();
  19.   
  20.   /* Enter the rescue mode.  */
  21.   grub_enter_rescue_mode ();
  22. }
复制代码

从kernel的main函数可以看到,它调用grub_load_modules()来加载所有的模块,这就是GRUB2扩展性能的体现之一。

另外,GRUB2支持多国语言的显示,主要在configfile注释、命令输出、标题等处。目前的CVS版本仅支持日文。

一个优秀的Boot Loader──GRUB2,正如一个mini OS。它展现了内核之外的另一道风景线。

在RMS所提倡的freebios面世之前,GRUB2是自由之歌最好的前奏了。
我认为,"Freebios + GRUB2 + linux/Hurd"将会成为GNU最坚厚的基石,到了那时,除了硬件不开源以外,所有的软件甚至包括各种固件都会走向GNU自由开源的道路,呵呵。
发表于 2005-3-17 14:47:16 | 显示全部楼层
最后一句话说得很有气势啊
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-17 22:29:02 | 显示全部楼层
还需要补充一点,那就是FreeBIOS目前还只应用于集群服务器或者嵌入式板。
回复 支持 反对

使用道具 举报

发表于 2005-3-18 03:22:32 | 显示全部楼层
好,希望早日看到中文的启动菜单。

p.s.很多硬件已经开源了,比如风扇,散热片,机箱等
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-18 11:03:54 | 显示全部楼层
Post by lexrus
好,希望早日看到中文的启动菜单。

p.s.很多硬件已经开源了,比如风扇,散热片,机箱等

呵呵,那些是水货或者盗版,不能算是开源。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-23 12:12:54 | 显示全部楼层
给出GRUB2的截图,编译了CVS版本中所有的模块。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2005-3-25 21:48:10 | 显示全部楼层
apt-get install grub2后怎么/boot/grub下面没什么变化?
回复 支持 反对

使用道具 举报

发表于 2005-3-28 15:16:36 | 显示全部楼层
很感兴趣。如果能和isolinux结合起来,可以在启动光盘上使用,那就好了。再如果能允许附加插件实现一些功能,例如编辑文件(大家知道,Grub是需要编辑配置文件的,实际上任何Boot loader都需要),那就Perfect了!!!
回复 支持 反对

使用道具 举报

发表于 2006-3-24 11:00:59 | 显示全部楼层

GRUB2以支持中文

我机器里面装的就是中文的,不过我改了一些东西。
回复 支持 反对

使用道具 举报

发表于 2006-3-24 19:45:28 | 显示全部楼层
现在才是1.92版本,出2.0不知道要什么时候。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表