在 grub 中增加一个显示举例的命令
最近用 grub 的时候比较多,感觉到命令行的帮助信息太少,使用的时候又不能像操作系统启动后可以打开详细的文档边看边操作,很不方便,于是就找来源代码,增加了一个命令“example [1|2|3]”,分别显示启动 linux、freebsd、windows 的命令行代码例子。 【相关文章:.NET客户端应用程序:.NET应用程序】
lu_yi_ming(at)sina.com 2004.5.30 【扩展阅读:30天改变你的人生】
步骤: 【扩展信息:【CSplitterWnd技巧三】能拖动】
我的操作环境:redhat linux 8.0,grub 0.92
1. 去 http://www.gnu.org/software/grub/grub.en.html 下载源代码。
2. 修改 stage2/builtins.c,在最后的
struct builtin *builtin_table[] = 之前增加以下代码:/* example */
static int example_func (char *arg, int flags) { char *example_info_1 = "" "boot linux\n" "--------------------------------------------------------------\n" " 1. set grub´s root device to the same drive as gnu/linux´s. probably\n" " the command `find /boot/vmlinuz´ , ´root (hd0,5) or similar can \n" " help you.\n" " 2. load the kernel:\n" " grub> kernel /vmlinuz root=/dev/hda1\n" " if you need to specify some kernel parameters, just append them to\n" " the command. for example, to set `vga´ to `ext´, do this:\n" " grub> kernel /vmlinuz root=/dev/hda1 vga=ext\n" " see the documentation in the linux source tree for complete\n" " information on the available options.\n" ... 下一页