I have played sometime with grub2 on diskfile : not sure to help you but have a look around this https://sites.google.com/site/playgrub2/home/pseudo-install-grub2-on-raw-diskfile-a-k-a-nopartitioning
and other items on the same subject there . Le jeudi 29 mars 2012 à 12:54 -0400, Charles Yost a écrit : > On Thu, Mar 29, 2012 at 5:00 AM, Jordan Uggla <[email protected]> wrote: > > On Wed, Mar 28, 2012 at 10:32 PM, Charles Yost <[email protected]> wrote: > >> Here are the commands I used. > >> > >> #!/bin/bash > >> # disk is a 1GB image, with 4 primary partitions, starting at: 1049kB, > >> 50M, 71M, 547M > >> # grub is compiled and waiting in the the grub directory next to disk.img > >> IMAGE_FILE=disk.img > >> IMAGE_FILE_LOOP=$(losetup --find) > >> IMAGE_FILE_LOOP_BASE=$(basename ${IMAGE_FILE_LOOP}) > >> losetup --verbose ${IMAGE_FILE_LOOP} ${IMAGE_FILE} > > > > I can understand this use of losetup in the script, and only this use, > > because this is a script and using "losetup --find" you can > > conveniently and safely store the loop device being used for later in > > the script. If it were not in a script then I would simply do "kpartx > > -a -v /path/to/image" and let kpartx setup the loopback device as well > > since it's one less step to worry about. > > > >> BOOT_LOOP=$(losetup --find) > >> losetup --verbose ${BOOT_LOOP} /dev/mapper/${IMAGE_FILE_BASENAME}p1 > > > > I explicitly said not to do this and this is what is causing the > > problem. Just do > > > > mount /dev/mapper/${IMAGE_FILE_BASENAME}p1 /mnt/disk_image-boot > > > > When I tried this, here is what happens. The grub-install script exits > with the following: > /usr/sbin/grub-probe: error: no such disk > Auto-detection of a filesystem of /dev/mapper/loop1p1 failed. > Try with --recheck. > If the problem persists please report this together with the output of > "/usr/sbin/grub-probe > --device-map="/mnt/image_os-boot/grub/device.map" --target=fs -v > /mnt/image_os-boot/grub" to <[email protected]> > > If I try running grub-install again and adding --recheck, I get the same > error. > > The contents of /mnt/image_os-boot/grub/device.map are the physical > disks on my system. > > The output of the suggested grub-probe commandline is: > /usr/sbin/grub-probe: info: the size of hd0 is 488397168. > /usr/sbin/grub-probe: info: the size of hd0 is 488397168. > /usr/sbin/grub-probe: info: the size of hd0 is 488397168. > /usr/sbin/grub-probe: info: the size of hd0 is 488397168. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd0 is 488397168. > /usr/sbin/grub-probe: info: the size of hd0 is 488397168. > /usr/sbin/grub-probe: info: the size of hd0 is 488397168. > /usr/sbin/grub-probe: info: the size of hd0 is 488397168. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: the size of hd1 is 4001760. > /usr/sbin/grub-probe: info: changing current directory to /dev. > /usr/sbin/grub-probe: info: changing current directory to mapper. > /usr/sbin/grub-probe: info: opening loop1p1. > /usr/sbin/grub-probe: error: no such disk. > > > >> cp grub/* /mnt/disk_image-os > > > > If the grub directory referenced here contains anything other than a > > grub.cfg file then I am suspicious that you're doing something wrong. > > grub-install will create and populate the grub directory itself, you > > should *not* be copying around grub's modules manually. Having a > > pre-populated grub directory won't prevent grub-install from working > > as it will overwrite files as needed, but you should still remove this > > cp command to avoid confusing yourself or others. > > > This is not the same as the grub directory that resides in /boot. This > is the compiled grub source. So grub-setup and grub-mkimage, etc. > > Thanks, > => Charles > > _______________________________________________ > Help-grub mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-grub _______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
