Use grub2 to guide Gentoo + win7

Source: Internet
Author: User

Gentoo's source code tree thinks grub2 is not stable enough, so grub0.97is used when the boot program is last installed in Gentoo install guid. I forgot to support NTFS file systems in the kernel, I mistakenly believe that grub1 (grub0.97) does not support NTFS (in fact, it should be supported), and the result is replaced with grub2 (grub1.99 ). the procedure is as follows:

1. Unlock grub2 from the portage source code tree.

#echo "=sys-boot/grub-9999" >> /etc/portage/package.unmask #echo "=sys-boot/grub-9999 **" >> /etc/portage/package.keywords#echo "=sys-boot/os-prober-1.47" >> /etc/portage/package.unmask 

2. Install grub2

#emerge -av sys-boot/grub:2

3. Configure grub. cfg. After grub2 is installed in the previous step, a grub2 directory will be generated under the/boot directory. After grub is started, grub reads the grub. cfg file under this directory. Grub2 provides an automatic configuration file generation tool. The Code is as follows:

grub2-mkconfig -o /boot/grub2/grub.cfg


Note that this command is written on Gentoo's official Wiki
Grub-mkconfig-O/boot/grub2/grub. cfg, but if grub1 is installed at the beginning of your hard disk, there will be a grub directory under the/boot directory. Executing the above commands provided by Gentoo will cause the generated grub. cfg to be written to the grub1 directory. As a result, grub2 cannot find the configuration file at startup and cannot enter the system. (Note that you should not make mistakes. I am so careless and stuck here for a while)

4. Write grub2 into MBR. This step is basically the same as that on Gentoo's official wiki. Code

grub2-install /dev/sda

If there is no major error in your kernel, restart the kernel to view the Gentoo startup Item and start it.

Since there was originally a win7 system on my hard disk, after installing Gentoo, we must use grub2 to guide win7. Therefore, we need to modify the/boot/grub2/grub. cfg file and add the win7 startup information. Here is my win7 startup information

menuentry 'Windows 7 (loader)(on /dev/sda2)'{        load_video        insmod gzio        insmod part_msdos        insmod ntfs        set root='(hd0,msdos1)'        search --no-floppy --fs-uuid --set=root AE3EFDE83EFDA98B        chainloader +1}


Note: In the set root = 'hd0, msdos1' line, msdos1 represents the position of your win7 boot partition. Note that the boot partition of win7 must not be the installation partition of the win7 System (usually the drive c). To determine the boot partition, run fdisk-L in Gentoo, which line of boot mark is *, and the Sorting System Is NTFS or fat, it indicates that it is the win7 boot partition. My name is/dev/sda1. Therefore, it is written as msdos1. the next item should be noted that the uuid of the startup partition can be viewed using the blkid command under Gentoo. Follow the above settings to start win7.


I don't often write blogs, but I don't know why all of them will be displayed after posting them, but copy them and paste them locally!


Refer:

1. http://en.gentoo-wiki.com/wiki/Grub2

2. http://hi.baidu.com/techofchaos/blog/item/b88c2f22d42d614cac34de32.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.