Creating an (Apple) EFI bootable media
Hello
Is there a way to reproducibly create Grub bootable media (CD, USB stick) that can be used with Apple efi?
I tried some ways of blessing the boot loader which I found on the net but none works.
Also the default core image probably lacks some essential parts. I managed to load it as rEFIt shell command by placing it in the tools directory but it complained about "prefix" not being defined and I seemingly had no commands - the help command was not available, and pressing tab did not show anything.
For some reason I cannot boot rEFIt from external media either but I can bless rEIFt on the built-in HDD.
I don't know what the Apple bless commnad is supposed to do so I have no idea if whatever it did was correct.
I suspect different arguments than those advised on the various web pages are needed when blessing a boot loader on an external medium (as opposed to the root volume).
Thanks
Michal
Quoted 7 lines · Michal Suchanek
Hello
Is there a way to reproducibly create Grub bootable media (CD, USB stick) that can be used with Apple efi?
I tried some ways of blessing the boot loader which I found on the net but none works.
Hi,
You should format it as GPT, MBR may not work. The fs of choice is hfsplus, although I heard someone have successful boot with FAT.
To bless the disk, use something like this: (only available for hfsplus)
sudo bless --folder=/Volumes/USBDISK --file=/Volumes/USBDISK/efi/grub/grub.efi
bless writes the location of boot file to the hfsplus header. bless doesn't work on FAT.
At startup, you need to press the Option key to show startup disk, and select the usb disk.
The following command writes the boot device to nvram so that it's used by default:
sudo bless --folder=/Volumes/USBDISK --file=/Volumes/USBDISK/efi/grub/grub.efi --setBoot
Quoted 6 lines
Also the default core image probably lacks some essential parts. I managed to load it as rEFIt shell command by placing it in the tools directory but it complained about "prefix" not being defined and I seemingly had no commands - the help command was not available, and pressing tab did not show anything.
You can add the command to the generated EFI image with grub-mkimage, here are the list of modules I usually use:
./grub-mkimage -d . -o grub64.efi minicmd part_gpt part_msdos part_apple fat ext2 hfsplus hfs ntfs reiserfs xfs iso9660 udf ls search loopback linux chain reboot halt appleldr help configfile hexdump loadbios memrw fixvideo crc sh video efi_fb gfxterm font png coreui loadcfg menutest gfxmenu textmenu
Quoted 9 lines
For some reason I cannot boot rEFIt from external media either but I can bless rEIFt on the built-in HDD.
I don't know what the Apple bless commnad is supposed to do so I have no idea if whatever it did was correct.
I suspect different arguments than those advised on the various web pages are needed when blessing a boot loader on an external medium (as opposed to the root volume).
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/
2009/10/1 Bean <[email protected]>:
Quoted 9 lines · Michal Suchanek
Quoted 7 lines
Hello
Is there a way to reproducibly create Grub bootable media (CD, USB stick) that can be used with Apple efi?
I tried some ways of blessing the boot loader which I found on the net but none works.
Quoted 8 lines
Hi,
You should format it as GPT, MBR may not work. The fs of choice is hfsplus, although I heard someone have successful boot with FAT.
To bless the disk, use something like this: (only available for hfsplus)
sudo bless --folder=/Volumes/USBDISK --file=/Volumes/USBDISK/efi/grub/grub.efi
That's what I use and what can be found on varoius forums and wikis.
It works neither with rEFIt nor grub for me. Perhaps I am not using the = character, I should check that but bless does not report any error and it actually changes the information (there is another bless option to show the state).
Quoted 6 lines
bless writes the location of boot file to the hfsplus header. bless doesn't work on FAT.
At startup, you need to press the Option key to show startup disk, and select the usb disk.
The disk does not show in the options offered by the firmware.
Quoted 6 lines
The following command writes the boot device to nvram so that it's used by default:
sudo bless --folder=/Volumes/USBDISK --file=/Volumes/USBDISK/efi/grub/grub.efi --setBoot
As I understand it this is not required for hfsplus, only for fat which cannot be blessed permanently.
It makes no difference either way.
Quoted 8 lines
Quoted 7 lines
Also the default core image probably lacks some essential parts. I managed to load it as rEFIt shell command by placing it in the tools directory but it complained about "prefix" not being defined and I seemingly had no commands - the help command was not available, and pressing tab did not show anything.
Quoted 8 lines
You can add the command to the generated EFI image with grub-mkimage, here are the list of modules I usually use:
./grub-mkimage -d . -o grub64.efi minicmd
part_gptpart_msdospart_applefat ext2 hfsplus hfs ntfs reiserfs xfs iso9660 udf ls search loopback linux chain reboot halt appleldr help configfile hexdump loadbios memrw fixvideo crc sh videoefi_fbgfxterm font png coreui loadcfg menutest gfxmenu textmenu
Hmm, I'm probably missing the shell or something. Can't the installation pre-create an efi image that contains most options? AFAIK the size of the image is not of much concern on efi so creating a mostly complete image would simplify things.
Thanks
Michal
Quoted 27 lines · Michal Suchanek
2009/10/1 Bean <[email protected]>:
Quoted 9 lines · Michal Suchanek
Quoted 7 lines
Hello
Is there a way to reproducibly create Grub bootable media (CD, USB stick) that can be used with Apple efi?
I tried some ways of blessing the boot loader which I found on the net but none works.
Quoted 8 lines
Hi,
You should format it as GPT, MBR may not work. The fs of choice is hfsplus, although I heard someone have successful boot with FAT.
To bless the disk, use something like this: (only available for hfsplus)
sudo bless --folder=/Volumes/USBDISK --file=/Volumes/USBDISK/efi/grub/grub.efi
That's what I use and what can be found on varoius forums and wikis.
It works neither with rEFIt nor grub for me. Perhaps I am not using the = character, I should check that but bless does not report any error and it actually changes the information (there is another bless option to show the state).
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
bless writes the location of boot file to the hfsplus header. bless doesn't work on FAT.
At startup, you need to press the Option key to show startup disk, and select the usb disk.
The disk does not show in the options offered by the firmware.
Hi,
Oh, perhaps some model doesn't support the usb boot method.
Quoted 10 lines
Quoted 6 lines
The following command writes the boot device to nvram so that it's used by default:
sudo bless --folder=/Volumes/USBDISK --file=/Volumes/USBDISK/efi/grub/grub.efi --setBoot
As I understand it this is not required for hfsplus, only for fat which cannot be blessed permanently.
It makes no difference either way.
Each partition has a default boot file, but the default boot device is stored in the nvram. --setBoot sets this value. This is the same as selecting the boot device from Startup Disk. Although if firmware can't boot from usb, setting this would have any effects.
Quoted 18 lines
Quoted 9 lines
Quoted 8 lines
Also the default core image probably lacks some essential parts. I managed to load it as rEFIt shell command by placing it in the tools directory but it complained about "prefix" not being defined and I seemingly had no commands - the help command was not available, and pressing tab did not show anything.
Quoted 8 lines
You can add the command to the generated EFI image with grub-mkimage, here are the list of modules I usually use:
./grub-mkimage -d . -o grub64.efi minicmd
part_gptpart_msdospart_applefat ext2 hfsplus hfs ntfs reiserfs xfs iso9660 udf ls search loopback linux chain reboot halt appleldr help configfile hexdump loadbios memrw fixvideo crc sh videoefi_fbgfxterm font png coreui loadcfg menutest gfxmenu textmenu
Quoted 4 lines
Hmm, I'm probably missing the shell or something. Can't the installation pre-create an efi image that contains most options? AFAIK the size of the image is not of much concern on efi so creating a mostly complete image would simplify things.
The above list contain most of the things I need, although you can use *.mod to include all modules, but I think some have unresolved symbol issue and you can get an error.
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/
OSX bless works for me with grub.efi in any hfsplus partition using the form
bless --folder /xyz --file /xyz/grub/grub.efi
(if the file paths are correct - I use GUI and drag the file icon onto a terminal commandline)
However it is not always necessary to bless. On Apple Mac, the UEFI spec will boot *.efi without needing to be blessed, and without refit, if it fits the naming convention in the UEFI spec. So a simple bootable package can be built.
http://www.uefi.org/specs/ -
EFI System Partition Subdirectory Registry
UEFI Specification Version 2.3
3.4.1.1 Removable Media Boot Behavior - Table 9. UEFI Image Types
If grub.efi is renamed to bootx64.efi or bootia32.efi and placed in fat32 or hfsplus tree /efi/boot, it will then be shown on the restart with Optiion key.
However to get an automatic default boot, probably requires the bless form with the --setBoot option.
For Apple Mac with 64 bit EFI -
pxw@im:~/test$ tree efi
efi
`-- boot
|-- bootx64.efi
|-- bootx64.icns
`-- grub.cfgSignature · 1 line
Cros (pxw)
2009/10/2 Peter Cros <[email protected]>:
Quoted 22 lines
OSX bless works for me with grub.efi in any hfsplus partition using the form bless --folder /xyz --file /xyz/grub/grub.efi
(if the file paths are correct - I use GUI and drag the file icon onto a terminal commandline)However it is not always necessary to bless. On Apple Mac, the UEFI spec will boot *.efi without needing to be blessed, and without refit, if it fits the naming convention in the UEFI spec. So a simple bootable package can be built.
http://www.uefi.org/specs/ -
EFI System Partition Subdirectory Registry
UEFI Specification Version 2.3
3.4.1.1 Removable Media Boot Behavior - Table 9. UEFI Image TypesIf grub.efi is renamed to bootx64.efi or bootia32.efi and placed in fat32 or hfsplus tree /efi/boot, it will then be shown on the restart with Optiion key.
However to get an automatic default boot, probably requires the bless form with the --setBoot option.
Quoted 8 lines
For Apple Mac with 64 bit EFI -
pxw@im:~/test$ tree efi efi `-- boot |-- bootx64.efi |-- bootx64.icns `-- grub.cfg
This sounds like an easy way of creating boot media from non-Apple OS.
I will try that and also a different brand of flash. I am sure I booted these machines from flash before.
Thanks
Michal
2009/10/2 Peter Cros <[email protected]>:
Quoted 22 lines
OSX bless works for me with grub.efi in any hfsplus partition using the form bless --folder /xyz --file /xyz/grub/grub.efi
(if the file paths are correct - I use GUI and drag the file icon onto a terminal commandline)However it is not always necessary to bless. On Apple Mac, the UEFI spec will boot *.efi without needing to be blessed, and without refit, if it fits the naming convention in the UEFI spec. So a simple bootable package can be built.
http://www.uefi.org/specs/ -
EFI System Partition Subdirectory Registry
UEFI Specification Version 2.3
3.4.1.1 Removable Media Boot Behavior - Table 9. UEFI Image TypesIf grub.efi is renamed to bootx64.efi or bootia32.efi and placed in fat32 or hfsplus tree /efi/boot, it will then be shown on the restart with Optiion key.
However to get an automatic default boot, probably requires the bless form with the --setBoot option.
Quoted 8 lines
For Apple Mac with 64 bit EFI -
pxw@im:~/test$ tree efi efi `-- boot |-- bootx64.efi |-- bootx64.icns `-- grub.cfg
This works nicely for me. The steps are:
1) build grub for efi 32bit a efi 64bit
2) use mkimage to add all modules (except kernel) to grub.efi
3) format a fat32/mbr flash disk
3) copy the appropriate .efi images to the directory structure as above
4) create a grub.cfg and remember to include a font if needed
Now the plug the flash disk into a mac and start/restart it while holding ALT. The boot menu welcomes you with a EFI boot option even before it finds the OS X boot options ;-)
Thanks
Michal