装了xp和linux双系统后,开机时默认的是启动linux系统,但是当想让XP作为默认启动的系统时怎么办呢?
要修改开机默认启动的系统的,只要修改grub文件。这里拿CentOS说明:修改 /boot/grub/下的grub.conf就行了。
grub由三部分组成:/etc/default/grub文件 、 /etc/grub.d文件夹 和 /boot/grub/grub.conf文件, 电脑开机时的启动菜单界面用的是grub.cfg文件。怎么理解这三部分之间的关系呢?我觉得可以这样认为,在我们执行update-grub(更新启动菜单)命令后系统就会根据 /etc/default/grub文件 和 /etc/grub.d文件夹 的内容生成/boot/grub/目录下的 grub.conf 文件,所以当 /etc/default/grub文件 和 /etc/grub.d文件夹 被修改后,再执行update-grub, grub.conf文件内容被更改,或者说是被更新吧。
以下是CentOS下的修改方式:
1、找到 /boot/grub/grub.conf 文件,编辑内容
sudo -i
gedit /boot/grub/grub.conf
下面是grub.conf未修改的内容,CentOS 2.6.32-279这个是默认的启动项,然后下面还有个other(就是XP的启动项)。
- # grub.conf generated by anaconda
- #
- # Note that you do not have to rerun grub after making changes to this file
- # NOTICE: You have a /boot partition. This means that
- # all kernel and initrd paths are relative to /boot/, eg.
- # root (hd0,2)
- # kernel /vmlinuz-version ro root=/dev/sda6
- # initrd /initrd-[generic-]version.img
- #boot=/dev/sda
- default=0
- timeout=5
- splashimage=(hd0,2)/grub/splash.xpm.gz
- hiddenmenu
- title CentOS (2.6.32–279.el6.i686)
- root (hd0,2)
- kernel /vmlinuz-2.6.32–279.el6.i686 ro root=UUID=db89d14d-6140–4901-b784-4ca77339d28b rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=128M LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
- initrd /initramfs-2.6.32–279.el6.i686.img
- title Other
- rootnoverify (hd0,0)
- chainloader +1
2、将 title Other 内容移到hiddenmenu后面就变成默认启动Other(即XP系统),如下。
- # grub.conf generated by anaconda
- #
- # Note that you do not have to rerun grub after making changes to this file
- # NOTICE: You have a /boot partition. This means that
- # all kernel and initrd paths are relative to /boot/, eg.
- # root (hd0,2)
- # kernel /vmlinuz-version ro root=/dev/sda6
- # initrd /initrd-[generic-]version.img
- #boot=/dev/sda
- default=0
- timeout=5
- splashimage=(hd0,2)/grub/splash.xpm.gz
- hiddenmenu
- title Other
- rootnoverify (hd0,0)
- chainloader +1
- title CentOS (2.6.32–279.el6.i686)
- root (hd0,2)
- kernel /vmlinuz-2.6.32–279.el6.i686 ro root=UUID=db89d14d-6140–4901-b784-4ca77339d28b rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=128M LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
- initrd /initramfs-2.6.32–279.el6.i686.img
原创文章,作者:wwh,如若转载,请注明出处:https://www.wuwenhui.cn/2902.html