Chinaunix首页 | 论坛 | 博客
  • 博客访问: 305522
  • 博文数量: 54
  • 博客积分: 3050
  • 博客等级: 中校
  • 技术积分: 601
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-25 16:53
文章分类
文章存档

2012年(1)

2011年(7)

2010年(46)

我的朋友

分类: LINUX

2010-01-29 11:58:31

网上的说法主要有两种,分别是修改两个文件:

/boot/grub/grub.conf   or  /boot/grub/menu.lst

也有说是 /etc 目录下的相应文件的,但是在 Ubuntu-9.10 下面,具体文件是这样地:

/boot/grub/grub.cfg

至于更改的那个 set default=”x“, 那个x的意思,就拿我机器作为例子来说:

[eg].
> ls -l grub.cfg
-r--r--r--    grub.cfg

> sudo chmod 244 grub.cfg
> ls -l grub.cfg
--w-r--r--    grub.cfg

> sudo vim grub.cfg

修改之后,最后别忘了:
> sudo chmod 444 grub.cfg    // 一定记得要改回来.

我晕,用过一段时间后竟然有这么多东西,那么就用彩色来突出一下重点吧,其他内容请自动跳过。
如蓝色部分所示,grub里面一共分为这么几个部分,一般三个。
再如红色部分所示,也就是 menuentry 项,所以 menuentry 项按顺序从 0 开始排列,如果想让哪个被默认启动,就将 set default=“x” 中的 x 改为那个 entry 的编号。eg,如果我的电脑想默认进 windows (虽然这是没门的事),就另 x 为 8. 体现为启动时到选择启动系统时光标默认定位在 windows 系统入口上。

至于将 windows 系统不仅设置为默认启动, 而且要放在所有系统入口最顶端,还没试过。
只是根据这个文件猜测:是不是将这个文件的 windows 的那个 menuentry 剪切到最前面就行? 使其 entry 编号为 0... 这个猜测暂不确定。

-------------------------------------- grub.cfg, start ---------------------------------
#
# 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"
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
set root=(hd0,8)
search --no-floppy --fs-uuid --set ab1eac76-a5d7-4656-8918-ffb406010912
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod 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
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-18-generic" {  // 0
        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 ab1eac76-a5d7-4656-8918-ffb406010912
    linux   /boot/vmlinuz-2.6.31-18-generic root=UUID=ab1eac76-a5d7-4656-8918-ffb406010912 ro   quiet splash
    initrd  /boot/initrd.img-2.6.31-18-generic
}
menuentry "Ubuntu, Linux 2.6.31-18-generic (recovery mode)" { // 1
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    insmod ext2
    set root=(hd0,8)
    search --no-floppy --fs-uuid --set ab1eac76-a5d7-4656-8918-ffb406010912
    linux   /boot/vmlinuz-2.6.31-18-generic root=UUID=ab1eac76-a5d7-4656-8918-ffb406010912 ro single 
    initrd  /boot/initrd.img-2.6.31-18-generic
}
menuentry "Ubuntu, Linux 2.6.31-17-generic" {  // 2
        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 ab1eac76-a5d7-4656-8918-ffb406010912
    linux   /boot/vmlinuz-2.6.31-17-generic root=UUID=ab1eac76-a5d7-4656-8918-ffb406010912 ro   quiet splash
    initrd  /boot/initrd.img-2.6.31-17-generic
}
menuentry "Ubuntu, Linux 2.6.31-17-generic (recovery mode)" {  // 3
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    insmod ext2
    set root=(hd0,8)
    search --no-floppy --fs-uuid --set ab1eac76-a5d7-4656-8918-ffb406010912
    linux   /boot/vmlinuz-2.6.31-17-generic root=UUID=ab1eac76-a5d7-4656-8918-ffb406010912 ro single 
    initrd  /boot/initrd.img-2.6.31-17-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic" {  // 4
        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 ab1eac76-a5d7-4656-8918-ffb406010912
    linux   /boot/vmlinuz-2.6.31-14-generic root=UUID=ab1eac76-a5d7-4656-8918-ffb406010912 ro   quiet splash
 splash
    initrd  /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {  // 5
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    insmod ext2
    set root=(hd0,8)
    search --no-floppy --fs-uuid --set ab1eac76-a5d7-4656-8918-ffb406010912
    linux   /boot/vmlinuz-2.6.31-14-generic root=UUID=ab1eac76-a5d7-4656-8918-ffb406010912 ro single 
    initrd  /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {  // 6
    linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {  // 7
    linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {  // 8
    insmod ntfs
    set root=(hd0,1)
    search --no-floppy --fs-uuid --set 6044685444682f4a
    drivemap -s (hd0) ${root}
    chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### 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 ###

--------------------------------- grub.cfg, end ---------------------------------------------


    shepherd
Fri,Jan/29/2010.

阅读(1643) | 评论(0) | 转发(0) |
0

上一篇:[看小说]之武侠

下一篇:滚滚红尘--三毛

给主人留下些什么吧!~~