Grub2 以及 Grub4dos引导多系统方案
看了标题先别喷,多系统有多系统的好处,虽然切换环境比较麻烦,但是能把硬件性能发挥到最大,这是我追求的。
==========================================
这几天捣鼓着给电脑装ARCHLINUX,机器上本来有XP,WIN7,UBUNTU三个系统。ubuntu之前是用wubi直接装在一个15G的NTFS分区里,用win7的启动器来启动各个系统。装ARCH的时候,我打算让ARCH和UBUNTU的能够互访FS,于是把UBUNTU卸载了。之前的ubuntu是在J盘安装的,分区是sda9,删除这个分区以后,又从G盘分出来十几G给ARCH。现在的分区是这样子的:sda1 --- C盘 --- XP
sda5 --- D盘 --- WIN7
sda6 --- E盘
sda7 --- F盘
sda8 --- G盘
sda9 --- ARCH的BOOT --- ext3
sda10 --- ARCH的swap
sda11 --- ARCH的根 --- ext3
sda12 --- UBT的swap
sda13 --- UBT的boot --- ext3
sda14 --- UBT的根 --- ext3
当时给UBT分区的时候忘了和ARCH共用swap了,惭愧。。。所有系统的安装顺序是XP--WIN7--ARCH--UBT (不一定最合理,但是都能启动)装UBT的时候悲剧了,安装引导,不小心安装到sda了,重启的时候直接进了UBT的grub2....焦虑了......不过这也没关系,间接的简化了所有任务。进入ubuntu,终端:sudoupdate-grub这两行命令一敲~~windows7找到了~~ARCH也能找到~~重启系统以后,进入WINDOWS7 LOADER,会发现G4D出来了,试了一下,所有的系统都能启动,但是这些任务完全可以在UBT的grub2里完成了。。。贴出两个GRUB的配置吧:GRUB4DOS安装在C盘,grldr替换成了G4D的我的menu.lst如下:#简单易懂,我就不注释了=====================================color light-blue/black light-cyan/blue
timeout 30
default /default
title Boot WindowsXP
fallback 1
find --set-root /ntldr
chainloader /ntldr
savedefault --wait=2
title Boot Windows 7
acpi
fallback 2
root (hd0,0)
chainloader /bootmgr
title Arch Linux
root=(hd0,8)
kernel /vmlinuz26 root=/dev/sda11 ro
initrd /kernel26.img
title Ubuntu 10.10
root (hd0,13)
kernel /vmlinuz-2.6.35-30-generic root=/dev/sda14 ro
initrd /initrd.img-2.6.35-30-generic
title find and boot Linux with menu.lst already installed
fallback 5
find --set-root /sbin/init
savedefault --wait=2
configfile /boot/grub/menu.lst
title commandline
savedefault --wait=2
commandline
title back to dos
savedefault --wait=2
quit
title reboot
savedefault --wait=2
reboot
=====================================
下面是UBT的grub2,启动机器进入系统的时候,这个是默认先显示的,是因为我之前的一个失误造成的,不过没有影响,一样能启动系统UBT的grub.cfg=====================================
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
insmod vbe
insmod vga
}
insmod part_msdos
insmod ext2
set root='(hd0,msdos14)'
search --no-floppy --fs-uuid --set 243b7d16-f62a-4ab5-bafb-06e4c9d31562
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos13)'
search --no-floppy --fs-uuid --set b368a193-754a-4e5b-8bcf-566425387e5c
set locale_dir=($root)/grub/locale
set lang=zh
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
fi
menuentry 'Ubuntu, with Linux 2.6.35-30-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos13)'
search --no-floppy --fs-uuid --set b368a193-754a-4e5b-8bcf-566425387e5c
linux/vmlinuz-2.6.35-30-generic root=UUID=243b7d16-f62a-4ab5-bafb-06e4c9d31562 ro quiet splash
initrd/initrd.img-2.6.35-30-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos13)'
search --no-floppy --fs-uuid --set b368a193-754a-4e5b-8bcf-566425387e5c
echo'Loading Linux 2.6.35-30-generic ...'
linux/vmlinuz-2.6.35-30-generic root=UUID=243b7d16-f62a-4ab5-bafb-06e4c9d31562 ro single
echo'Loading initial ramdisk ...'
initrd/initrd.img-2.6.35-30-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos13)'
search --no-floppy --fs-uuid --set b368a193-754a-4e5b-8bcf-566425387e5c
linux/vmlinuz-2.6.35-22-generic root=UUID=243b7d16-f62a-4ab5-bafb-06e4c9d31562 ro quiet splash
initrd/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos13)'
search --no-floppy --fs-uuid --set b368a193-754a-4e5b-8bcf-566425387e5c
echo'Loading Linux 2.6.35-22-generic ...'
linux/vmlinuz-2.6.35-22-generic root=UUID=243b7d16-f62a-4ab5-bafb-06e4c9d31562 ro single
echo'Loading initial ramdisk ...'
initrd/initrd.img-2.6.35-22-generic
}
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos13)'
search --no-floppy --fs-uuid --set b368a193-754a-4e5b-8bcf-566425387e5c
linux16/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos13)'
search --no-floppy --fs-uuid --set b368a193-754a-4e5b-8bcf-566425387e5c
linux16/memtest86+.bin console=ttyS0,115200n8
}
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set DE305BE6305BC3E5
chainloader +1
}
menuentry "Arch Linux (on /dev/sda11)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos9)'
search --no-floppy --fs-uuid --set 1d5fe5a7-2cf6-40b0-9e1d-aef61ed950d9
linux /vmlinuz26 root=/dev/sda11 ro
initrd /kernel26.img
}
menuentry "Arch Linux Fallback (on /dev/sda11)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos9)'
search --no-floppy --fs-uuid --set 1d5fe5a7-2cf6-40b0-9e1d-aef61ed950d9
linux /vmlinuz26 root=/dev/sda11 ro
initrd /kernel26-fallback.img
}
set color_normal=blue/black
set color_highlight=green/blue
exec tail -n +3 $0
if [ -f$prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
==================================差不多就是这样,多系统引导起来并不难。。。
怎么感觉下面的像是burg.cfg的
页:
[1]