help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default Grub legacy menu.lst to Grub2 grub.cfg


From: Chris Murphy
Subject: Re: Default Grub legacy menu.lst to Grub2 grub.cfg
Date: Mon, 7 Jan 2013 14:05:13 -0700

I'm not sure about Ubuntu 12.10 (current) but 12.04 and Linux Mint 13 have a 
positively ancient version of GRUB2, it's not the release 2.00. So I suggest 
you get a release version of 2.00, either building it yourself from current 
source or snag the RPM from Fedora 18.

Maybe what's confusing are the parts of grub. There's a grub package that 
includes a bunch of scripts and .mod files, which are platform specific. When 
you run grub-install, it causes the *.mod files to be created/replaced, a new 
core.img created, which is then placed into one of three locations.

Is the partition scheme MBR or GPT? I'm going to guess this is BIOS, not UEFI, 
hardware in which case the default is probably MBR. If the 1st partition start 
sector is 2048 you have a ~1MB gap between the MBR at LBA0, and LBA2048 where 
the first partition starts. And GRUB's core.img goes in that gap. If you're 
using GPT, you need a 1MB BIOS Boot partition into which GRUB's core.img will 
go. For UEFI, it'll go on the EFI System partition. In any case, these 
locations are found automatically by grub-install.

For BIOS, technically there are two parts: the part that fits into the first 
440 bytes of LBA 0, which is merely code to jump to, load, and run core.img 
which is in the MBR gap, or the BIOS Boot partition on GPT disks. That core.img 
code has a PREFIXED baked into it, so it can find the rest of GRUBs modules, 
the *.mod files, and also the grub.cfg. At that point is when you see the menu.

So this statement:
> Quote:
> Grub is installed in /boot/Grub in the utuntu file system

is true, and fine. It's not a mistake.

If you are going to use GPT, I suggest using gdisk (atp-get gdisk I'm guessing 
for Ubuntu). It doesn't matter where the 1MB partition is for BIOS boot, it's 
identified by grub-install by its GUID. The gdisk type code for this is EF02. 
If you use parted, you set a bios_grub flag on the 1MB partition to do the same 
thing.

This idea of a 512MB partition for GRUB makes no sense to me. This partition 
for GRUB only doesn't contain anything but GRUB's core.img which is usually 
around 32KB. It's tiny. If you use LVM or Btrfs then it gets bigger, but still 
way less than 100KB. So 1MB is recommended for padding and to keep subsequent 
partitions aligned in the event they're 512e AF disks with 4K physical sectors.

As for the FreeBSD menu entry, I'm pretty sure the current GRUB 2 release's 
grub-mkconfig will find it, and create the proper menu entry in the grub.cfg.

Now, it's not exactly obvious how you install grub if you're not already booted 
from the disk you're going to install it to, i.e. if you've booted from a live 
cd or something. You need to mount that OS's partitions, and I use mount -o 
bind for /proc, /sys, and /dev. I always forget which two are needed by 
grub-install so I just do all three. Then chroot that. Then 'grub-install 
/dev/sda' or whatever; then 'grub-mkconfig -o /boot/grub/grub.cfg'. Done.


Chris Murphy


reply via email to

[Prev in Thread] Current Thread [Next in Thread]