- 论坛徽章:
- 0
|
一、首先使用ubuntu 9.10系统的grub2,安装到mbr,它可以引导所有操作系统。
二、在xp中安装grub4dos,grub4dosb也可以启动freebsd。
关键的关键是引导slackware的命令中,root=/dev/hda5,类似地,引导Debian的命令中,root=/dev/hda6。此两处是hda5,hda6,而不是sda5,sda6。
在使用ubuntu 9.10中使用update-grub命令得到的grub.cfg中,引导slackware的命令中,root=/dev/sda5,这个得手动修改。
终端下:
sudo chmod +w /boot/grub/grub.cfg
sudo gedit /boot/grub/grub.cfg
1,ubuntu 9.10中的grub.cfg:
#
# 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 reiserfs
set root=(hd0,4)
search --no-floppy --fs-uuid --set 3b6e5d47-3f13-4a87-9c66-538f07209ece
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-14-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod reiserfs
set root=(hd0,4)
search --no-floppy --fs-uuid --set 3b6e5d47-3f13-4a87-9c66-538f07209ece
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=3b6e5d47-3f13-4a87-9c66-538f07209ece ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod reiserfs
set root=(hd0,4)
search --no-floppy --fs-uuid --set 3b6e5d47-3f13-4a87-9c66-538f07209ece
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=3b6e5d47-3f13-4a87-9c66-538f07209ece 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+)" {
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 ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
insmod ntfs
set root=(hd0,1)
search --no-floppy --fs-uuid --set 260cf91f0cf8eb27
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry "FreeBSD 7.2 (on /dev/sda3)"{
insmod ufs2
set root=(hd0,3,a)
freebsd /boot/kernel/kernel
freebsd_loadenv /boot/device.hints
set FreeBSD.vfs.root.mountfrom=ufs:/dev/ad0s3a
set FreeBSD.vfs.root.mountfrom.options=rw
}
menuentry "Slackware Linux (Slackware 13.0.0.0.0) (on /dev/sda5)" {
insmod reiserfs
set root=(hd0,5)
search --no-floppy --fs-uuid --set cc55db6e-02f2-417d-8c62-97a6e08dda05
linux /boot/vmlinuz-huge-2.6.29.6 root=/dev/hda5
}
menuentry "Slackware Linux (Slackware 13.0.0.0.0) (on /dev/sda5)" {
insmod reiserfs
set root=(hd0,5)
search --no-floppy --fs-uuid --set cc55db6e-02f2-417d-8c62-97a6e08dda05
linux /boot/vmlinuz-generic-2.6.29.6 root=/dev/hda5
}
menuentry "Debian GNU/Linux, kernel 2.6.26-2-686 (on /dev/sda6)" {
insmod reiserfs
set root=(hd0,6)
search --no-floppy --fs-uuid --set 204dd440-4170-4c0e-98c4-a106c53b4794
linux /boot/vmlinuz-2.6.26-2-686 root=/dev/hda6 ro
initrd /boot/initrd.img-2.6.26-2-686
}
menuentry "Debian GNU/Linux, kernel 2.6.26-2-686 (single-user mode) (on /dev/sda6)" {
insmod reiserfs
set root=(hd0,6)
search --no-floppy --fs-uuid --set 204dd440-4170-4c0e-98c4-a106c53b4794
linux /boot/vmlinuz-2.6.26-2-686 root=/dev/hda6 ro single
initrd /boot/initrd.img-2.6.26-2-686
}
menuentry "openSUSE 11.2 - 2.6.31.5-0.1 (on /dev/sda7)" {
insmod reiserfs
set root=(hd0,7)
search --no-floppy --fs-uuid --set 8289178b-cd60-7c41-c61c-4eb575350797
linux /boot/vmlinuz-2.6.31.5-0.1-default root=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJD0SC38495-part7 resume=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJD0SC38495-part9 splash=silent quiet showopts vga=0x314
initrd /boot/initrd-2.6.31.5-0.1-default
}
menuentry "Failsafe -- openSUSE 11.2 - 2.6.31.5-0.1 (on /dev/sda7)" {
insmod reiserfs
set root=(hd0,7)
search --no-floppy --fs-uuid --set 8289178b-cd60-7c41-c61c-4eb575350797
linux /boot/vmlinuz-2.6.31.5-0.1-default root=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJD0SC38495-part7 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 x11failsafe vga=0x314
initrd /boot/initrd-2.6.31.5-0.1-default
}
menuentry "Mandriva 2010 (on /dev/sda8)" {
insmod reiserfs
set root=(hd0,8)
search --no-floppy --fs-uuid --set 3a941ae2-e194-5104-6ee9-c8b7f44c4853
linux /boot/vmlinuz BOOT_IMAGE=linux root=UUID=3a941ae2-e194-5104-6ee9-c8b7f44c4853 resume=UUID=1365f49a-b699-4502-8f86-1bf05dfb3a30 splash=silent vga=791
initrd (hd0,8)/boot/initrd.img
}
menuentry "nonfb -- Mandriva 2010 (on /dev/sda8)" {
insmod reiserfs
set root=(hd0,8)
search --no-floppy --fs-uuid --set 3a941ae2-e194-5104-6ee9-c8b7f44c4853
linux /boot/vmlinuz BOOT_IMAGE=linux-nonfb root=UUID=3a941ae2-e194-5104-6ee9-c8b7f44c4853 resume=UUID=1365f49a-b699-4502-8f86-1bf05dfb3a30
initrd (hd0,8)/boot/initrd.img
}
menuentry "failsafe -- Mandriva 2010 (on /dev/sda8)" {
insmod reiserfs
set root=(hd0,8)
search --no-floppy --fs-uuid --set 3a941ae2-e194-5104-6ee9-c8b7f44c4853
linux /boot/vmlinuz BOOT_IMAGE=failsafe root=UUID=3a941ae2-e194-5104-6ee9-c8b7f44c4853 failsafe
initrd (hd0,8)/boot/initrd.img
}
### 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 ###
2,grub中的 menu.lst:
# This is a sample menu.lst file. You should make some changes to it.
# The old install method of booting via the stage-files has been removed.
# Please install GRLDR boot strap code to MBR with the bootlace.com
# utility under DOS/Win9x or Linux.
color blue/green yellow/red white/magenta white/magenta
timeout 5
default 0
title FreeBSD 7.2 (hd0,2)
rootnoverify (hd0,2)
makeactive
chainloader +1
title find and load NTLDR of Windows NT/2K/XP
fallback 1
find --set-root --ignore-floppies --ignore-cd /ntldr
map () (hd0)
map (hd0) ()
map --rehook
find --set-root --ignore-floppies --ignore-cd /ntldr
chainloader /ntldr
savedefault --wait=2
#title find and load BOOTMGR of Windows VISTA
#fallback 2
#find --set-root --ignore-floppies --ignore-cd /bootmgr
#map () (hd0)
#map (hd0) ()
#map --rehook
#find --set-root --ignore-floppies --ignore-cd /bootmgr
#chainloader /bootmgr
#savedefault --wait=2
title find and load CMLDR, the Recovery Console of Windows NT/2K/XP
fallback 3
find --set-root --ignore-floppies --ignore-cd /cmldr
map () (hd0)
map (hd0) ()
map --rehook
find --set-root --ignore-floppies --ignore-cd /cmldr
chainloader /cmldr
#####################################################################
# write string "cmdcons" to memory 0000:7C03 in 2 steps:
#####################################################################
# step 1. Write 4 chars "cmdc" at 0000:7C03
write 0x7C03 0x63646D63
# step 2. Write 3 chars "ons" and an ending null at 0000:7C07
write 0x7C07 0x00736E6F
savedefault --wait=2
#title find and load IO.SYS of Windows 9x/Me
#fallback 4
#find --set-root /io.sys
#chainloader /io.sys
#savedefault --wait=2
#title find and boot 0PE.ISO
#fallback 5
#find --set-root /0PE/0PE.ISO
#map /0PE/0PE.ISO (0xff) || map --mem /0PE/0PE.ISO (0xff)
#map --hook
#chainloader (0xff)
#savedefault --wait=2
#title find and boot MicroPE.ISO
#fallback 6
#find --set-root /boot/MicroPE.ISO
#map /boot/MicroPE.ISO (0xff) || map --mem /boot/MicroPE.ISO (0xff)
#map --hook
#chainloader (0xff)
#savedefault --wait=2
#title Parted Magic ISO
#fallback 7
#find --set-root /pmagic.iso
#map /pmagic.iso (0xff) || map --mem /pmagic.iso (0xff)
#map --hook
#chainloader (0xff)
#savedefault --wait=2
#title Ultimate Boot CD ISO
#fallback 8
#find --set-root /ubcd.iso
#map /ubcd.iso (0xff) || map --mem /ubcd.iso (0xff)
#map --hook
#chainloader (0xff)
#savedefault --wait=2
title Boot "a.iso"
find --set-root /a.iso
map /a.iso (0xff) || map --mem /a.iso (0xff)
map --hook
chainloader (0xff)
boot
title commandline
commandline
title reboot
reboot
title halt
halt
###title floppy (fd0)
###chainloader (fd0)+1
###rootnoverify (fd0)
###title back to dos
###quit
###title MAXDOS.IMG
###find --set-root --ignore-floppies /boot/MAXDOS.IMG
###map --mem /boot/MAXDOS.IMG (fd0)
###map --hook
###chainloader (fd0)+1
###rootnoverify (fd0)
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/15173/showart_2166413.html |
|