ubuntu9.10之grub.cfg详解


From  独自等待s blog

grub.cfg 默认为只读,要修改前先设为可写
sudo chmod +w /boot/grub/grub.cfg
set default=0
#默认为0
insmod jpeg
#添加jpg支持,如要使用png或tga文件做背景,加上 insmod png或insmod tga
insmod ext2
#除了用作启动的分区外,其他分区格式可在menu底下再添加
set root=(hd0,7)
#设定root分区
search –no-floppy –fs-uuid –set f255285a-5ad4-4eb8-93f5-4f767190d3b3
#设定uuid=****的分区为root,和上句重复,可删除
# 以下为终端配置
if loadfont /usr/share/grub/unicode.pf2 ; then
#设置终端字体,unicode.pf2支持中文显示
set gfxmode=640×480

#设置分辨率,默认为 640×480,可用800×600,1024×768,建议跟你想设定的图片大小一致
insmod gfxterm
#插入模块 gfxterm,支持中文显 示,它还支持 24 位图像
insmod vbe
#插入 vbe 模块,GRUB 2 引入很多模块的东西,要使用它,需要在这里加入
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don’t
# understand terminal_output
terminal gfxterm
#设置 GRUB 2 终端为 gfxterm
fi
fi
set timeout=10
background_image (hd0,7)/boot/images/1.jpg
#设置背景图片
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=cyan/black
#这两行为 Debian 下的菜单颜色设置,如果默认的话,你会发现背景完全被蓝色挡住了,你需要修改 blue 为 black,这样背景就会出现
### END /etc/grub.d/05_debian_theme ###
# 10_linux 为自动添加的当前root分区linux引导项
### BEGIN /etc/grub.d/10_linux ###
#菜单项,要包括 menuentry 双引号” ” 和大括号 { }才完整,否则不显示菜单
menuentry “Ubuntu, Linux 2.6.31-9-386″ {
insmod ext2
set root=(hd0,7)
search –no-floppy –fs-uuid –set f255285a-5ad4-4eb8-93f5-4f767190d3b3
#这句与set root=(hd0,7)重复,可删除
linux /boot/vmlinuz-2.6.31-9-386 root=UUID=f255285a-5ad4-4eb8-93f5-4f767190d3b3 ro quite splash
#不喜欢看到一长串的, roo=UUID=***可用root=/dev/sda7代替
initrd /boot/initrd.img-2.6.31-9-386
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry “Memory test (memtest86+)” {
linux16 /boot/memtest86+.bin
}
### END /etc/grub.d/20_memtest86+ ###
# 自动添加存在于其他分区的系统引导项
### BEGIN /etc/grub.d/30_os-prober ###
#windows 启动菜单
menuentry “Windows Vista (loader) (on /dev/sda1)” {
insmod ntfs
#windows格式为ntfs,或为fat32改为 insmod fat
set root=(hd0,1)
search –no-floppy –fs-uuid –set ece067d2e067a196
#可删除
#grub2比较先进的地方就是如果发现windows启动是通过 ntldr 引导的,定为2000/xp/2003,会在这加上 drivemap -s (hd0) ${root} ,作用相当于grub的map,可正常启动非第一硬盘的xp/2003系统。
chainloader +1
}
# 查找到其他分区上的linux系统并自动添加
menuentry “Ubuntu karmic (development branch) (9.10) (on /dev/sda3)” {
insmod ext2
set root=(hd0,3)
search –no-floppy –fs-uuid –set 4d893970-0685-44ed-86b3-1de45b2db84a
linux /boot/vmlinuz-2.6.31-9-generic root=/dev/sda3
initrd /boot/initrd.img-2.6.31-9-generic
}
#若存在macos会自动在这里添加。
### END /etc/grub.d/30_os-prober ###
# 以下为手动添加的菜单项
### BEGIN /etc/grub.d/40_custom ###
menuentry “CDLinux”{
set root=(hd0,8)
linux /CDlinux/bzImage root=/dev/ram0 vga=791 CDL_LANG=zh_CN.UTF-8
initrd /CDlinux/initrd
}
### END /etc/grub.d/40_custom ###
# 手动添加时,硬盘编号从0开始(hd0),主分区编号从1开始(hd0,1),逻辑分区从5开始(hd0,5)

 

 


 

相关内容

    暂无相关文章