help-grub
[Top][All Lists]
Advanced

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

Re: Grub-install documentation or override?


From: mgreger
Subject: Re: Grub-install documentation or override?
Date: Sat, 27 Jun 2015 15:48:23 +0000

---- Andrei Borzenkov <address@hidden> wrote: 
> В Fri, 26 Jun 2015 18:08:14 +0000
> <address@hidden> пишет:
> 
> > 
> > I am automating the build with the following goals:
> > 
> >    1) Not to add any additional dependencies into the LFS system itself 
> > beyond what is standard, so the LFS system uses GRUB but does not have LVM.
> >    2) To have minimal impact on the host system, so installing grub to the 
> > host if they don't have it is not an option.
> >    3) It needs to be able to be installed to an actual drive or to a disk 
> > image, at the choice of the end user.
> > 
> > The only part of this causing me pain is grub-install at the very end of 
> > the build.
> > 
> 
> Try mounting / as separate loop device. It will give you suboptimal
> GRUB configuration (where it will need to search for root instead of
> encoding partition directly) but you can redo grub-install later from
> booted system.
> 
> address@hidden:~> sudo losetup --find --show /tmp/floppy
> /dev/loop0
> address@hidden:~> sudo losetup --find --show -o 1048576 /tmp/floppy
> /dev/loop1
> address@hidden:~> sudo mount /dev/loop1 /mnt
> address@hidden:~> sudo rm -rf /mnt/grub
> address@hidden:~/build/grub> sudo pkgdatadir=$PWD ./grub-install -d grub-core 
> --boot-directory=/mnt --modules=part_msdos /dev/loop0
> Installing for i386-pc platform.
> Installation finished. No error reported.
> address@hidden:~/build/grub> 
> address@hidden:~> ll /mnt/grub/
> итого 28
> drwxr-xr-x 2 root root  2048 июн 27 09:17 fonts
> -rwxr-xr-x 1 root root  1024 июн 27 09:17 grubenv
> drwxr-xr-x 2 root root 20480 июн 27 09:17 i386-pc
> drwxr-xr-x 2 root root  2048 июн 27 09:17 locale
> drwxr-xr-x 3 root root  2048 июн 27 09:17 themes
> 
> 
> Replace part_msdos with part_gpt if needed.
> 
> The reason to explicitly include partition driver is that in this case
> GRUB does not know that filesystem is located on partition at all, so
> it cannot automatically detect and add it. And that is very good
> illustration why GRUB must be able to correctly relate your
> device-mapper "partition" to parent device.



Thank you. I'm making real progress now. I tried losetup -P like you suggested 
and used the command: grub-install --target=i386-pc --boot-directory=/boot 
--modules=part_msdos /dev/loop0
It completed successfully and the image was able to be booted up to a grub 
shell. I can complete the boot by entering grub commands manually.

One last question: You said 'it will need to search for root instead of 
encoding partition directly'
That sounds like what I want to do, but the boot stopped at the grub shell. How 
do I get the behavior you described?





reply via email to

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