---- Andrei Borzenkov <[email protected]> wrote: > В Fri, 26 Jun 2015 18:08:14 +0000 > <[email protected]> пишет: > > > > > 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. > > bor@opensuse:~> sudo losetup --find --show /tmp/floppy > /dev/loop0 > bor@opensuse:~> sudo losetup --find --show -o 1048576 /tmp/floppy > /dev/loop1 > bor@opensuse:~> sudo mount /dev/loop1 /mnt > bor@opensuse:~> sudo rm -rf /mnt/grub > bor@opensuse:~/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. > bor@opensuse:~/build/grub> > bor@opensuse:~> 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? _______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
