Update 2
Okay, I've managed to get a working live USB with Grub2.
First I created created a gpt
partition table with GParted and created the following partitions:
exfat
- [Remaining space] Live CD ISOs and files. (Created with gnome-disk-utility since GParted doesn't support it.)ntfs
- [5.50 GiB] Extracted Windows 10 recovery ISO files.fat16
- [100 MiB] Grub2.
I followed this answer on how to change the partition number order just so they were in the correct order. I used fat16 in hoping my PS4 couldn't see it so that it could auto mount the exfat partition without being asked which partition to mount - it didn't work. I'm only aware that fat16 and fat32 are the only compatible Grub2 UEFI boot-able partitions.
Then to install Grub2. I mounted the partition were I wanted to install Grub2 were "GRUB2" is the label given under GParted and "user" is my Xubuntu account name.
sudo grub-install --removable --boot-directory=/media/user/GRUB2/boot --efi-directory=/media/user/GRUB2
Then I create the grub.cfg under /media/user/GRUB2/boot/grub/grub.cfg
with the following entries.
menuentry "Lubuntu Boot Recovery Live CD (AMD64)" {
insmod part_gpt
insmod exfat
insmod search_fs_uuid
set iso=/iso/boot-repair-disk-64bit.iso
search --no-floppy --set=root --fs-uuid 92AE-07D5
loopback loop ($root)$iso
linux (loop)/casper/vmlinuz.efi boot=casper file=/preseed/lubuntu.seed iso-scan/filename=$iso noprompt noeject
initrd (loop)/casper/initrd.lz
}
menuentry "Windows 10 Installer on SDB2 (AMD64)" {
insmod part_gpt
insmod ntfs
insmod search_fs_uuid
insmod chain
search --no-floppy --set=root --fs-uuid 13B187F260B1ACD6
chainloader ($root)/efi/boot/bootx64.efi
}
menuentry "Xubuntu Live CD (AMD64)" {
insmod part_gpt
insmod exfat
insmod search_fs_uuid
set iso=/iso/xubuntu-18.04.4-desktop-amd64.iso
search --no-floppy --set=root --fs-uuid 92AE-07D5
loopback loop ($root)$iso
linux (loop)/casper/vmlinuz boot=casper file=/preseed/lubuntu.seed iso-scan/filename=$iso noprompt noeject
initrd (loop)/casper/initrd
}
Took a while researching but from my understanding.
insmod
- This is used to load the following module. Presumably, I don't think these are needed in 2.02> but I added them just in case. I found a handy list here.set
- Is used to set a variable.search
- This searches for certain criteria such as matching directory, UUID of the partition, partition name, etc and stores it in a variable under --set.
I'm not entirely sure how or what loopback, linux, initrd, preseed and chainloader actual functionality are. But I copied the file paths but the extension maybe different or may not have an extension.
So far I've got everything I want working but I presume running a Windows 10 ISO from an ISO file isn't possible without a more complicated script. This is a code snippet I've got so far for the menu entry but it doesn't work.
menuentry "Windows 10 Installer (AMD64) (ISO) (Doesn't work)" --class windows --class os {
# Load module to be able to read GPT partition table.
insmod part_gpt
# Load module to read the partition that ISO is stored.
insmod exfat
# Load module to find partition with UUID.
insmod search_fs_uuid
# Load module to chain load to another EFI.
insmod chain
# Set UUID of partition that has ISO image and store it in variable.
set uuid="92AE-07D5"
search --no-floppy --set=root --fs-uuid $uuid
# Set ISO Directory.
set iso=/iso/win10-1909-english-x64.iso
# Mount ISO.
loopback loop ($root)$iso
# Boot ISO.
#chainloader (loop)/efi/microsoft/boot/cdboot.efi
chainloader (loop)+1
}
I've tried #chainloader (loop)/efi/microsoft/boot/cdboot.efi
uncommented before chainloader (loop)+1
but to not success.
All that's left of the question is: How do I boot Windows 10 Installer ISO to boot from a ISO file?
grub-install --version
and it's currently 2.02 so I don't think it got pushed to Xubuntu 18.04 yet. I should be fine running ISO from UEFI mode since my laptop doesn't support legacy booting. So if I understand correctly. P1 exFat for data, P2 NTFS of Windows ISO extracted contents, P3 for ISO and Grub2? – Nova Apr 24 '20 at 16:02