I installed Ubuntu and while fresh, captured the whole drive with the command
sudo dd if=/dev/sda of=/dev/sdb/image.img
then placed it into
/boot/images/image.img
I want GRUB2 to boot from this image, as Windows does with "native boot" technology from VHDX. I copied memdisk into /boot
with
cp /usr/lib/syslinux/memdisk /boot/
And created the new file 50_memdisk
/etc/grub.d/50_memdisk
with this content:
#!/bin/sh
set -e IMAGES=/boot/images .
/usr/lib/grub/grub-mkconfig_lib
if test -e /boot/memdisk ; then
MEMDISKPATH=$( make_system_path_relative_to_its_root "/boot/memdisk" )
echo "Found memdisk: $MEMDISKPATH" >&2 find $IMAGES -name "*.img" | sort | while read image;
do
IMAGEPATH=$( make_system_path_relative_to_its_root "$image" )
echo "Found floppy image: $IMAGEPATH" >&2
cat << EOF menuentry "Bootable floppy: $(basename $IMAGEPATH | sed s/.img//)"
{ EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF linux16 $MEMDISKPATH bigraw initrd16 $IMAGEPATH
} EOF
done
fi
Then I ran
chmod +x /etc/grub.d/50_memdisk && update-grub
But GRUB2 shows while the boot process is returning
out of memory
What did I do wrong?