1

I'm wondering how I can manipulate the boot menu on a Mac to add an option for a "Ubuntu ISO". To be 100% clear as I can see the non-answers coming, I am not looking to install Ubuntu, but just boot the ISO from the HD. From what I have researched I need to use efibootmgr from inside a Linux Distro to manipulate the boot options.

For example this would be what I would do with Grub:

sudo nano /etc/grub.d/40_custom && sudo update-grub2
 menuentry "Ubuntu ISO" {
        set isofile="/home/isos/ubuntu.iso"
        loopback loop $isofile
        linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noprompt noeject toram
        initrd (loop)/casper/initrd.lz
}

But I need something like:

https://wiki.gentoo.org/wiki/Efibootmgr#Creating_a_boot_entry

efibootmgr -c -d /dev/sda -p 2 -L "Gentoo" -l '\efi\boot\bootx64.efi' -u 'root=/dev/sda3 initrd=\efi\boot\initramfs.img quiet'

1 Answers1

1

Not sure how MacBook works with EFI, but EFI can only boot only specific executable files on EFI partition without parameters. It can not boot from ISO files. Here is the way to use grub to run Ubuntu from ISO files:

  1. Create a 10GB rescue partition.
  2. Format it as ext4. Label and enter name "rescue".
  3. Create the grub.cfg file in Linux

    $HOME/grub.cfg:

    menuentry "Rescue Ubuntu 18.04 LiveCD" 
    {
      set isoname="/ubuntu-18.04.3-desktop-amd64.iso"
      search --label --set rescue rescue
      loopback loop ($rescue)$isoname
      linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isoname quiet splash
      initrd (loop)/casper/initrd
    }
    
  4. Create a standalone grubx64.efi with memdisk and the needed modules

    Creates binary with modules and grub.cfg embedded:

    grub-mkstandalone --modules="minicmd normal search search_fs_file search_fs_uuid search_label ext2 echo cat ls disk part_gpt part_msdos" \
    -o grubx64.efi \
    -O x86_64-efi --compress=xz \
    "/boot/grub/grub.cfg=$HOME/grub.cfg"
    
  5. Create an entry in the EFI boot manager and place grubx64.efi inside the new entry. Add all other files EFI expects (BOOTX64.CSV, shimx64.efi, mmx64.efi).

Eliah Kagan
  • 117,780
huksley
  • 19
  • Can you post how to create the entry in EFI boot mgr? Also, there's no need for a separate partition, but I could see that being a safe route. – FreeSoftwareServers Sep 27 '19 at 03:28
  • Basically you add a new entry and change the order of booting using efibootmgr command:

    efibootmgr -c -L NAME -d /dev/sda -p 1 -l /EFI/entry/shimx64.efi. Check current entries using efibootmgr -v first to see how parameters look.

    – huksley Sep 27 '19 at 05:51
  • That should be an update to the answer you gave, my downvote is locked until you edit the question. I felt the questions most important answer I wanted was the efibootmgr line of code so I voted accordingly, but would like to change to upvote. Will accept answer after testing. Can you confirm would this load the OS in the RAM which is my desire? I don't want any HD mounted and the ability to do partitioning on HD. – FreeSoftwareServers Sep 27 '19 at 06:33