help-grub
[Top][All Lists]
Advanced

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

Re: What does grub-install do?


From: Goh Lip
Subject: Re: What does grub-install do?
Date: Fri, 01 Oct 2010 13:12:39 +0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100922 Thunderbird/3.1.4

On Friday 01,October,2010 12:23 PM, Dennis Cao wrote:
> Hi buddies,
> 
> I want to install GRUB2 on my USB disk, so that I can boot my computer
> if my system crashes.
> 
> I read manual of GRUB2 and tried to understand what grub-install did,
> especially the '--root-directory' parameter. The manual says:
>       "... ....  If you want GRUB to use images under a directory other
> than the root directory, you need to specify the option
> --root-directory .... ...."
> 
> I think grub-install first creates and installs 'boot.img' to MBR. And
> it hardcodes the location of core.img inside boot.img. So, does
> '--root-directory' tells grub-install to use core.img in the specific
> directory?
> 
> Another question. I use the following command to try to install grub
> to my usb disk.
>            grub-install --root-directory=/boot  /dev/hdb
> But when I boot my computer from USB disk,  my computer just stops
> after printing 'GRUB' on the left-top conner of the screen :(
> 
> Can anybody explain the details and usage of grub-install command?
> What does it do? Which images are used and where are they copied to on
> the hard or usb disk?
> 
>   Thanks in advence:)
> 
On Friday 01,October,2010 12:23 PM, Dennis Cao wrote:
> > Hi buddies,
> >
> > I want to install GRUB2 on my USB disk, so that I can boot my computer
> > if my system crashes.
> >
> > I read manual of GRUB2 and tried to understand what grub-install did,
> > especially the '--root-directory' parameter. The manual says:
> >       "... ....  If you want GRUB to use images under a directory other
> > than the root directory, you need to specify the option
> > --root-directory .... ...."
> >
> > I think grub-install first creates and installs 'boot.img' to MBR. And
> > it hardcodes the location of core.img inside boot.img. So, does
> > '--root-directory' tells grub-install to use core.img in the specific
> > directory?
> >
> > Another question. I use the following command to try to install grub
> > to my usb disk.
> >            grub-install --root-directory=/boot  /dev/hdb
> > But when I boot my computer from USB disk,  my computer just stops
> > after printing 'GRUB' on the left-top conner of the screen :(
> >
> > Can anybody explain the details and usage of grub-install command?
> > What does it do? Which images are used and where are they copied to on
> > the hard or usb disk?
> >
> >   Thanks in advence:)
> >


曹贵林,  "grub-install --root-directory=/boot  /dev/hdb"  does not make
a grub.cfg (menu) for you. You have to recreate the grub.cfg manually or
just copy the
original and modify the grub.cfg.

Before we talk about modifying the grub.cfg, you used "dev/hdb". Please
check first if it is really "hdb" or "sdb" by either "sudo fdisk -l" or
"sudo blkid". Also when you do that note the uuid number of the usb disk.

Then after you do the "sudo grub-install --root-directory=/boot
/dev/hdb" or most likely "sudo grub-install --root-directory=/boot
/dev/sdb", copy over the /boot/grub/grub.cfg to the usb's
/boot/grub/grub.cfg and modify as follows...


>> >> Modifying the grub.cfg at /media/usb/grub/........
> >
> > To modify the grub.cfg, all entries before the d/10_linux entries can be
> > deleted with the exception of the following
> >
> > set default=0
> > set timeout=7
> > insmod ext2
> > set root=(hd0,x)
> > search --no-floppy --fs-uuid --set xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >
> > if loadfont /usr/share/grub/ascii.pf2 ; then
> > set gfxmode=1152x864
> > insmod gfxterm
> > insmod vbe
> > if terminal_output gfxterm ; then true ; else
> > # For backward compatibility with versions of terminal.mod that don't
> > # understand terminal_output
> > terminal gfxterm
> > fi
> > fi
> >
> > set menu_color_normal=cyan/blue
> > set menu_color_highlight=yellow/blue
> >
> >
> > It is highly recommended that the following 2 functions be deleted from
> > the grub.cfg
> > function savedefault
> > function recordfail
> >
> > The following can also be deleted unless you want to use non-english
> > text for grub (or it can be left untouched)
> > set locale_dir=
> > set lang=en
> > insmod gettext
> >
> >
> > *important note*
> > the above two lines (lines #7 and #8) with (hd0,x) and UUID, please
> > substitute with (hd0,x) and UUID of /media/usb.

曹贵林, hope this is what you are looking for. There are further
modifications to 'improve' automatic booting of any kernel changes at ..
http://forum.nginx.org/read.php?26,67573

Regards - Goh Lip - �橇�






reply via email to

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