Enter in the terminal: sudo gedit/boot/grub/grub.cfg
Install Windows and then install Linux system, the default startup item will be very many, after executing the above command, will open a document, the following code:
--------------------------------------------------------------------------------------------------------------- (These little lines are for me to add)
#
# Don't 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 $prefix/grubenv]; Then
Load_env
Fi
Set default= "8"
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
}
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
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 and versions of terminal.mod that don ' t
# Understand Terminal_output
Terminal Gfxterm
Fi
Fi
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Set locale_dir= ($root)/boot/grub/locale
Set Lang=zh
Insmod GetText
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
### End/etc/grub.d/05_debian_theme ###
### Begin/etc/grub.d/10_linux ###
Menuentry ' Ubuntu, with Linux 2.6.32-31-generic '--class ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Linux/boot/vmlinuz-2.6.32-31-generic root=uuid=fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f ro Quiet Splash
Initrd/boot/initrd.img-2.6.32-31-generic
}
Menuentry ' Ubuntu, with Linux 2.6.32-31-generic (recovery mode) '--class Ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Echo ' Loading Linux 2.6.32-31-generic ... '
Linux/boot/vmlinuz-2.6.32-31-generic root=uuid=fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f RO Single
Echo ' Loading initial ramdisk ... '
Initrd/boot/initrd.img-2.6.32-31-generic
}
Menuentry ' Ubuntu, with Linux 2.6.32-30-generic '--class ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Linux/boot/vmlinuz-2.6.32-30-generic root=uuid=fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f ro Quiet Splash
Initrd/boot/initrd.img-2.6.32-30-generic
}
Menuentry ' Ubuntu, with Linux 2.6.32-30-generic (recovery mode) '--class Ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Echo ' Loading Linux 2.6.32-30-generic ... '
Linux/boot/vmlinuz-2.6.32-30-generic root=uuid=fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f RO Single
Echo ' Loading initial ramdisk ... '
Initrd/boot/initrd.img-2.6.32-30-generic
}
Menuentry ' Ubuntu, with Linux 2.6.32-24-generic '--class ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Linux/boot/vmlinuz-2.6.32-24-generic root=uuid=fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f ro Quiet Splash
Initrd/boot/initrd.img-2.6.32-24-generic
}
Menuentry ' Ubuntu, with Linux 2.6.32-24-generic (recovery mode) '--class Ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Echo ' Loading Linux 2.6.32-24-generic ... '
Linux/boot/vmlinuz-2.6.32-24-generic root=uuid=fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f RO Single
Echo ' Loading initial ramdisk ... '
Initrd/boot/initrd.img-2.6.32-24-generic
}
### End/etc/grub.d/10_linux ###
### begin/etc/grub.d/20_memtest86+ ###
Menuentry "Memory Test (memtest86+)" {
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Linux16/boot/memtest86+.bin
}
Menuentry "Memory Test (memtest86+, serial console 115200)" {
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
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)" {
Insmod NTFS
Set root= ' (hd0,1) '
Search--no-floppy--fs-uuid--set de1ca47d1ca45277
Chainloader +1
}
### End/etc/grub.d/30_os-prober ###
### 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 ###
--------------------------------------------------------------------------------------------------------------- -----------------------
As shown above, each menuentry represents a startup item, such as:
Menuentry "Windows 7 (loader) (on/dev/sda1)" {
Insmod NTFS
Set root= ' (hd0,1) '
Search--no-floppy--fs-uuid--set de1ca47d1ca45277
Chainloader +1
}
Represents the Win7 startup item, in the last one (My computer has a total of 9 startup items, the general may be 7, etc.). To modify a startup item, simply make a change to the number in the red marked section, such as set default= "8" to indicate that the default boot entry is the nineth in the list, the Win7 system in My Computer, and "0" to represent the first in the list of startup items. The part set timeout=10 of the blue flag indicates that the time left for 10 seconds is for the user to select. Of course, if the startup item is too much trouble, simply remove the menuentry and the portion of the curly brace that follows it, the corresponding startup entry will not appear at startup.
Another approach could be taken:
Part that will contain the Win7 startup item
### Begin/etc/grub.d/30_os-prober ###
Menuentry "Windows 7 (loader) (on/dev/sda1)" {
Insmod NTFS
Set root= ' (hd0,1) '
Search--no-floppy--fs-uuid--set de1ca47d1ca45277
Chainloader +1
}
### End/etc/grub.d/30_os-prober ###
Put the whole place in front of the section:
### Begin/etc/grub.d/10_linux ###
Menuentry ' Ubuntu, with Linux 2.6.32-31-generic '--class ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod ext2
Set root= ' (hd0,9) '
Search--no-floppy--fs-uuid--set fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f
Linux/boot/vmlinuz-2.6.32-31-generic root=uuid=fd9c0f6c-5c20-4d95-b3f4-eebca82bea0f ro Quiet Splash
Initrd/boot/initrd.img-2.6.32-31-generic
}
。。。。。 (Omitted here)
### End/etc/grub.d/10_linux ###
(Note: At this time the set default= "0" does not need to be modified, because at this time Win7 already ranked first, as for the other many startup items, anyway, in the back, do not need to tube them. )
Original address: http://hi.baidu.com/conperint/blog/item/65ba19ab20c406edfaed50fa.html