Skip to content

Instantly share code, notes, and snippets.

@hzhangxyz
Created August 22, 2018 15:07
Show Gist options
  • Save hzhangxyz/c61447d5dd8720d3ae67794444c3dfe3 to your computer and use it in GitHub Desktop.
Save hzhangxyz/c61447d5dd8720d3ae67794444c3dfe3 to your computer and use it in GitHub Desktop.
boot from iso via grub
menuentry 'ubuntu live' {
set rootuuid=709ba2df-2ded-4a27-83fe-34093fe97ce7
search --no-floppy --fs-uuid --set=root $rootuuid
set isofile='/img/ubuntu-18.04.1-desktop-amd64.iso'
loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile
initrd (loop)/casper/initrd.lz
}
menuentry 'debian live' {
set rootuuid=709ba2df-2ded-4a27-83fe-34093fe97ce7
search --no-floppy --fs-uuid --set=root $rootuuid
set isofile='/img/debian-live-9.5.0-amd64-gnome.iso'
loopback loop $isofile
linux (loop)/live/vmlinuz-4.9.0-7-amd64 boot=live findiso=$isofile
initrd (loop)/live/initrd.img-4.9.0-7-amd64
}
menuentry 'centos live' {
set rootuuid=709ba2df-2ded-4a27-83fe-34093fe97ce7
search --no-floppy --fs-uuid --set=root $rootuuid
set isofile='/img/CentOS-7-x86_64-LiveGNOME-1804.iso'
set isolabel='CentOS-7-x86_64-LiveGNOME-1804'
loopback loop $isofile
linux (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=$isofile root=live:LABEL=$isolabel ro rd.live.image quiet rhgb
initrd (loop)/isolinux/initrd0.img
}
menuentry 'arch live' {
set rootuuid=709ba2df-2ded-4a27-83fe-34093fe97ce7
search --no-floppy --fs-uuid --set=root $rootuuid
set isofile='/img/archlinux-2018.08.01-x86_64.iso'
loopback loop $isofile
linux (loop)/arch/boot/x86_64/vmlinuz archisodevice=/dev/loop0 img_dev=/dev/disk/by-uuid/$rootuuid img_loop=$isofile
initrd (loop)/arch/boot/x86_64/archiso.img
}
@hzhangxyz
Copy link
Author

  • change your rootuuid or set something like root="hd0,gpt3" directly
  • change you isofile path
  • maybe you need to change linux into linuxefi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment