grub boots other operating systems and iso images

Boot archlinux image 64-bit system

menuentry "Archlinux-ISO-x86-64" --class iso {
  set isofile=""
  set partition=""
  loopback loop (hd0,$partition)$isofile
  linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_ISO_X86-64 img_dev=/dev/sda$partition img_loop=$isofile earlymodules=loop
  initrd (loop)/arch/boot/x86_64/archiso.img
}

Start archlinux image 32-bit system 

menuentry "Archlinux-ISO-i686" --class iso {
  set isofile=""
  set partition="2"
  loopback loop (hd0,$partition)$isofile
  linux (loop)/arch/boot/i686/vmlinuz archisolabel=ARCH_ISO_I686 img_dev=/dev/sda$partition img_loop=$isofile earlymodules=loop
  initrd (loop)/arch/boot/i686/archiso.img
}

start ubuntu mirror

menuentry "ubuntu-ISO" {
  set isofile=""
  loopback loop (hd0,1)$isofile
  linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile quiet noeject noprompt splash --
  initrd (loop)/casper/initrd.lz
}

Start the win7 system installed on the first mbr partition of the first hard disk
# "9AB0287EB028634D" in the search line is the uuid of the win7 system partition

menuentry "Microsoft Windows Vista/7/8/8.1/10 BIOS-MBR" {
    insmod part_msdos
    insmod ntfs
    insmod search_fs_uuid
    insmod ntldr     
    search --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 9AB0287EB028634D
    ntldr /bootmgr
}

Start Win10 EFI installed on the first gpt partition of the first hard disk
# "0007-C871" in the search line is the uuid of the win10 EFI partition

menuentry "Microsoft Windows 10" {
		insmod part_gpt
		insmod fat
		insmod search_fs_uuid
		insmod chain
		search --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 0007-C871
		chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

shutdown

menuentry "System shutdown" {
	echo "System shutting down..."
	halt
}

reboot

menuentry "System restart" {
	echo "System rebooting..."
	reboot
}

UEFI configuration

menuentry "Firmware setup" {
	fwsetup
}

For details, refer to  GRUB-ArchWiki

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325302156&siteId=291194637