grub2 配置

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#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 ###
坚持原创技术分享,您的支持将鼓励我继续创作!