Due to limited time, I will only give a brief introduction to the method. For more information and explanations, see www.linuxsir.org or Google
Please correct the mistakes in this article. Thank you!
1. GRUB boot program
Except for version differences, grub is divided into grub1 (grub lengacy), wingrub (grub 4 DOS/grub for DOS), and grub2
Roughly speaking, grub1 is the original grub for Linux, while grub for DOS is the Windows version of grub. The two are the same in most commands.
Grub2 is the ultimate version of grub1. Its commands have been greatly changed based on grub1 and are more flexible. For example, grub2 uses grub. cfg instead of menu. lst.
It is actually a script. Grub2 uses Linux to load the kernel instead of kernerl, but the command structure does not change much.
If you still do not use the grub command, Tutorial: Google
Grub4dos tutorial Wiki
Grub2 basic tutorial
2. boot from windows to Linux (this is an indirect Guide)
Grub4dos is used here. Put it in the root directory of the system disk.
1: Windows boot program (ntldr for XP) directs wingrub (such as grldr ).
2: Then, wingrub will guide your Linux or other Windows systems.
Take XP as an example (in disk C), use the grldr boot program in wingrub
A. Open boot. ini (it is read-only. Change it to writable. You can use the doscommand: attrib-r boot. ini) and add a line:
C:/grldr = "grldr"
B. Create a menu. lst text file on drive C and add the system to be started.
For example:
Timeout = 10 <br/> title 'Install fedora 13 i686 live Cd' # boot fedora hard disk installation <br/> root (hd0, 17) <br/> kernel/vmlinuz0 root = live:/dev/sda17 liveimg rootfstype = auto vga = 791 # specify the kernel and put the iso root sda17, and some parameters <br/> initrd/initrd0.img # This is the initialization file <br/> title fedora 13 i686 <br/> root (hd0, 5) <br/> kernel/boot/vmlinuz0 root =/dev/sda5 ro quiet splash vga = 791 <br/> initrd/boot/initrd0.img <br/> title Ubuntu10.04 <br/> root (hd0, 8) <br/> kernel/boot/vmlinuz-2.6.32-21-generic root =/dev/sda9 ro <br/> initrd/boot/initrd. img-2.6.32-21-generic
3. Guided by grub2 to linux or windows
Note: The method is similar to the previous grubfor dos, but the kernel must be changed to linux.
Grub2 uses the grub. cfg menu. The file is in/boot/grub. cfg.
Instance:
Menuentry 'ubuntu, with Linux 2.6.32-23-generic '{<br/> set root =' (hd0, 15) '<br/> Linux/boot/vmlinuz-2.6.32-23-generic root = UUID = 82d0b06c-3639-4874-b3d4-856e6ca4e9ba Ro quiet splash <br/> initrd/boot/initrd. img-2.6.32-23-generic <br/>}< br/> menuentry 'ora ora 13 i686' {<br/> root (hd0, 5) <br/> inux/boot/vmlinuz0 root =/dev/sda5 Ro quiet splash VGA = 791 <br/> nitrd/boot/initrd0.img <br/>}< br/> menuentry "Microsoft Windows XP Professional (on/dev/sda1) "{<br/> set root = '(hd0, 1)' <br/> chainloader + 1 <br/>}
Note: uuid = *** can be replaced with/dev/sda. You can run the ls-l/dev/disk/by-uuid command to query the logs. When a new system is installed, the system may not be updated in grub. cfg.
Enter the preceding command in the command line of grub2 to start your system, and then modify grub. cfg,
You can also update grub. cfg: sudo update-grub2 in a command
4. Start linux from grub rescue. (Assume that grub is written to MBR)
After the adjusted partition, grub may not be able to find grub. cfg. In this case, you only need to tell the location of the grub operating system and the location of the boot, for example:
Grub rescue> set view <br/> grub rescue> prefix = (hd0, 8)/boot/GRUB determine the startup path <br/> grub rescue> root = hd0, 8. Determine the system path <br/> grub rescue> set prefix = (hd0, 8)/boot/GRUB to set the grub startup path <br/> grub rescue> set root = hd0, 8. Set the grub boot partition <br/> grub rescue> insmod normal to load the normal module. You can also specify the absolute path of the module/boot/GRUB/normal. moD <br/> grub rescue> normal entry to the normal module <br/> normal grub> Linux/boot/vmlinuz-** root =/dev/sda8 load the kernel and confirm/partition, of course, it can also be like grub above. add some parameters like: VGA = 791 splash quiet <br/> normal grub> initrd/boot/initrd. IMG load initialization program <br/> normal grub> boot startup <br/>
After the above work is done, remember to recreate grub. cfg: sudo update-grub2
And rewrite grub to mbr: sudo grub-install/dev/sda
For more information, see my previous article: Guide and repair for XP and ubuntu.