异度部落格

学习是一种生活态度。

0%

grub2 配置

最近 Ubuntu 内核老是升级,搞得启动项茫茫多,现在修改下 grub2 的配置,顺便发个配置方法

#grub2默认的是只读的,要修改的话,执行这个命令sudo chmod +w /boot/grub/grub.cfg 加上写的权限
# Author@Killua

#下面这个grub.cfg是本人电脑上Ubuntu 9.10的配置文件
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0" #默认启动为0
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2 #除了用作启动的分区外,其他分区格式可在menu底下再添加
set root=(hd0,8) ##设定root分区
search --no-floppy --fs-uuid --set 867a6d05-7a0c-46ae-ae14-d4f72e06ae5d
#下面是终端配置
if loadfont /usr/share/grub/unicode.pf2 ; then #设置终端字体
set gfxmode=640x480 #设置终端分辨率
insmod gfxterm #插入模块 gfxterm,支持中文显示,支持24位图像
insmod vbe #插入vbe模块
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10 #设置时间
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black #这两行为 Debian 下的菜单颜色设置
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
#菜单项,要包括 menuentry 双引号" " 和大括号 { }才完整,你可以把不必要的删去
menuentry "Ubuntu, Linux 2.6.31-17-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set 867a6d05-7a0c-46ae-ae14-d4f72e06ae5d
linux /boot/vmlinuz-2.6.31-17-generic root=UUID=867a6d05-7a0c-46ae-ae14-d4f72e06ae5d ro quiet splash
initrd /boot/initrd.img-2.6.31-17-generic
}
menuentry "Ubuntu, Linux 2.6.31-17-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set 867a6d05-7a0c-46ae-ae14-d4f72e06ae5d
linux /boot/vmlinuz-2.6.31-17-generic root=UUID=867a6d05-7a0c-46ae-ae14-d4f72e06ae5d ro single
initrd /boot/initrd.img-2.6.31-17-generic
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober ###
#这里是windows 的引导
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
insmod fat
set root=(hd0,1)
search --no-floppy --fs-uuid --set 7854-efb8
drivemap -s (hd0) ${root}
chainloader +1
}
### END /etc/grub.d/30_os-prober ###
#Mac OS 启动配置在这里
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###