usb boot iso loopback
Ready and mount usb driver
-
paritition and format to
fat32
-
optional: add
esp
flag to parition-
note udisk2 default hide esp paritition, then you need mount it manualy
-
sudo mount /dev/sdc1 /media/fancy/usb -o umask=0022,uid=$UID,gid=$UID
-
Install grub boot manager
here /media/fancy/usb
is the mount point.
grub-install --target x86_64-efi --removable \
--boot-directory=/media/fancy/usb/boot --efi-directory=/media/fancy/usb
Config grub.cfg
put iso file in <mount point>/boot/iso/
edit <mount point>/boot/grub/grub.cfg
A tested example following:
insmod all_video
if loadfont /boot/grub/fonts/unicode.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set timeout=5
# archlinux series,see:
# https://wiki.archlinux.org/index.php/Multiboot_USB_drive#Arch_Linux_monthly_release
menuentry 'Archlinux 2019.10.1' {
probe -u $root --set=rootuuid
set imgdevpath="/dev/disk/by-uuid/$rootuuid"
set isofile='/boot/iso/archlinux-2019.10.01-x86_64.iso'
loopback loop $isofile
linux (loop)/arch/boot/x86_64/vmlinuz img_dev=$imgdevpath img_loop=$isofile earlymodules=loop
initrd (loop)/arch/boot/intel_ucode.img (loop)/arch/boot/amd_ucode.img (loop)/arch/boot/x86_64/archiso.img
}
menuentry 'Manjaro 18.1.4' {
probe -u $root --set=rootuuid
export rootuuid
set iso_path='/boot/iso/manjaro-kde-18.1.4-191210-linux54.iso'
export iso_path
loopback loop $iso_path
root=(loop)
configfile /boot/grub/loopback.cfg
loopback --delete loop
}
# debian series, using findiso
menuentry "Install Deepin" {
set gfxpayload=keep
set isofile='/boot/iso/deepin-15.11-amd64.iso'
loopback loop $isofile
linux (loop)/live/vmlinuz.efi boot=live findiso=$isofile
initrd (loop)/live/initrd.lz
}
# ubuntu series, using iso-scan/filename
menuentry 'ubuntu server 18.04.3' {
set gfxpayload=keep
set isofile='/boot/iso/ubuntu-18.04.3-live-server-amd64.iso'
loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet ---
initrd (loop)/casper/initrd
}
menuentry 'ubuntu desktop 19.10' {
set gfxpayload=keep
set isofile='/boot/iso/ubuntu-19.10-desktop-amd64.iso'
loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet ---
initrd (loop)/casper/initrd
}
Quick test
-
use vmware or virtualbox
refer https://www.virten.net/2014/12/howto-usb-boot-a-vm-in-vmware-workstation-11/
-
qemu not support uefi
参考