Disk 1:ubuntu12.04 Win7
Disk 2:XP
sudo update-grub results only Win7 and Ubuntu, click win7 into the system, see Win7 and xp,win7 can start, but XP cannot. So I found a grub file with someone else's XP and Ubuntu in the web search.
Found my missing a word, drivemap-s (hd0) ${root}, so plus on the OK.
That is, add the following content to the/boot/grub/grub.cfg
Menuentry "Windows XP"--class Windows--class os {
Insmod NTFS
Set root= ' (hd0,1) '
Search--no-floppy--fs-uuid--set=root 4c844b34844b2036
Drivemap-s (hd0) ${root}
Chainloader +1
}
Set root= (hd0,1), which represents the first partition of the No. 0 disk, where the hard drive number starts at 0 and the partition number starts at 1. My XP is in the No. 0 partition. My XP and Ubuntu are no longer the same disk, grub in Ubuntu is shown in HD1 so XP must be in hd0, while the system is in C: disk, so is the first partition
The entire grub file is as follows:
#
# Don't EDIT this FILE
#
# It is automatically generated by grub-mkconfig using templates
# FROM/ETC/GRUB.D and Settings From/etc/default/grub
#
### Begin/etc/grub.d/00_header ###
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 Video_bochs
Insmod Video_cirrus
}
Insmod Part_msdos
Insmod ext2
Set root= ' (HD1,MSDOS6) '
Search--no-floppy--fs-uuid--set=root 2636856c-62cc-4195-8995-148eb8cfb30c
if LOADFONT/USR/SHARE/GRUB/UNICODE.PF2; Then
Set Gfxmode=auto
Load_video
Insmod Gfxterm
Insmod Part_msdos
Insmod ext2
Set root= ' (HD1,MSDOS6) '
Search--no-floppy--fs-uuid--set=root 2636856c-62cc-4195-8995-148eb8cfb30c
Set locale_dir= ($root)/boot/grub/locale
Set LANG=ZH_CN
Insmod GetText
Fi
Terminal_output Gfxterm
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/light-gray
If Background_color 44,0,30; Then
Clear
Fi
### End/etc/grub.d/05_debian_theme ###
### Begin/etc/grub.d/10_linux ###
function Gfxmode {
Set gfxpayload= "$"
If ["$" = "keep"]; Then
Set vt_handoff=vt.handoff=7
Else
Set vt_handoff=
Fi
}
If [${recordfail}!= 1]; Then
If [-e ${prefix}/gfxblacklist.txt]; Then
If Hwmatch ${prefix}/gfxblacklist.txt 3; Then
if [${match} = 0]; Then
Set Linux_gfx_mode=keep
Else
Set Linux_gfx_mode=text
Fi
Else
Set Linux_gfx_mode=text
Fi
Else
Set Linux_gfx_mode=keep
Fi
Else
Set Linux_gfx_mode=text
Fi
Export Linux_gfx_mode
If ["$linux _gfx_mode"!= "text"]; Then Load_video; Fi
Menuentry ' Ubuntu,linux 3.2.0-23-generic-pae '--class Ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Gfxmode $linux _gfx_mode
Insmod Gzio
Insmod Part_msdos
Insmod ext2
Set root= ' (HD1,MSDOS6) '
Search--no-floppy--fs-uuid--set=root 2636856c-62cc-4195-8995-148eb8cfb30c
Linux/boot/vmlinuz-3.2.0-23-generic-pae root=uuid=2636856c-62cc-4195-8995-148eb8cfb30c ro quiet Splash $vt _handoff
Initrd/boot/initrd.img-3.2.0-23-generic-pae
}
Menuentry ' Ubuntu,linux 3.2.0-23-generic-pae (recovery mode) '--class Ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod Gzio
Insmod Part_msdos
Insmod ext2
Set root= ' (HD1,MSDOS6) '
Search--no-floppy--fs-uuid--set=root 2636856c-62cc-4195-8995-148eb8cfb30c
echo ' Load Linux 3.2.0-23-generic-pae ... '
Linux/boot/vmlinuz-3.2.0-23-generic-pae root=uuid=2636856c-62cc-4195-8995-148eb8cfb30c ro Recovery nomodeset
Echo ' Loads initialization memory disk ... '
Initrd/boot/initrd.img-3.2.0-23-generic-pae
}
### End/etc/grub.d/10_linux ###
### Begin/etc/grub.d/20_linux_xen ###
### End/etc/grub.d/20_linux_xen ###
### begin/etc/grub.d/20_memtest86+ ###
Menuentry "Memory Test (memtest86+)" {
Insmod Part_msdos
Insmod ext2
Set root= ' (HD1,MSDOS6) '
Search--no-floppy--fs-uuid--set=root 2636856c-62cc-4195-8995-148eb8cfb30c
Linux16/boot/memtest86+.bin
}
Menuentry "Memory Test (memtest86+, serial console 115200)" {
Insmod Part_msdos
Insmod ext2
Set root= ' (HD1,MSDOS6) '
Search--no-floppy--fs-uuid--set=root 2636856c-62cc-4195-8995-148eb8cfb30c
Linux16/boot/memtest86+.bin CONSOLE=TTYS0,115200N8
}
### end/etc/grub.d/20_memtest86+ ###
### Begin/etc/grub.d/30_os-prober ###
Menuentry Windows 7 (loader) (ON/DEV/SDA1)--class windows--class os {
Insmod Part_msdos
Insmod NTFS
Set root= ' (HD0,MSDOS1) '
Search--no-floppy--fs-uuid--set=root 4c844b34844b2036
Chainloader +1
}
### End/etc/grub.d/30_os-prober ###
Menuentry "Windows XP"--class Windows--class os {
Insmod NTFS
Set root= ' (hd0,1) '
Search--no-floppy--fs-uuid--set=root 4c844b34844b2036
Drivemap-s (hd0) ${root}
Chainloader +1
}
### Begin/etc/grub.d/40_custom ###
# This file provides a easy way to add custom menu entries. Simply Type the
# menu entries you want to add after this comment. Be careful
# the ' EXEC tail ' line above.
### End/etc/grub.d/40_custom ###
### Begin/etc/grub.d/41_custom ###
If [f $prefix/custom.cfg]; Then
SOURCE $prefix/custom.cfg;
Fi
### End/etc/grub.d/41_custom ###