Boot Camp EFI - Programmatically Boot to OSX

Hi,


I'm supporting an environment of mostly iMac 16,2s dual booting OS X 10.11 and Windows 10, with Windows as the default startup volume. In the past, we've been able to reboot from Windows to OS X with a script that ran "Bootcamp.exe -StartupDisk OSX" and rebooted the computer.


Due to iMacs no longer supporting legacy booting, either that or a switch from hybrid to protective MBR seems to have broken that functionality. Does anyone know a way to programmatically tell an EFI Windows Boot Camp installation to boot to the OS X partition?

iMac, OS X El Capitan (10.11.6), And Windows 10

Posted on Nov 30, 2016 10:27 AM

Reply
12 replies

Nov 30, 2016 10:36 AM in response to ajdavis8

Please see Setboot? Formerly bless? Command line OS switching? .


If you use Bootcamp.exe, you are already in Windows and are switching to OSX, which is an EFI OS.


If you are in OSX, then bless works for legacy Boot as shown in the link. For non-legacy EFI Windows, you will need to switch to Windows using the OSX systemsetup -setstartupdisk command. See the the man page of systemsetup.

Dec 1, 2016 2:13 PM in response to Loner T

Well, I reset the NVRAM, and Windows didn't show up in the startup disk page in System Preferences. I couldn't get systemsetup to work either, so I just reimaged my test computer. A solution has emerged, though!


I don't know if it's the legacy/EFI difference, or a change between Boot Camp versions, but removing some quotation marks fixed my problem. For reference, my OS X partition was named OSX, and here are the commands in detail.


Was working on the legacy systems:

"C:\Program Files\Boot Camp\Bootcamp.exe" -StartupDisk "OSX"


Works on both legacy and EFI, iMac 13,1 to 16,2 as far as I can tell:

"C:\Program Files\Boot Camp\Bootcamp.exe" -StartupDisk OSX


Thanks for helping!

Dec 2, 2016 7:45 AM in response to Loner T

The issue with systemsetup may have just been that I'm not familiar with it, or it could be something with our setup. The only startup disk it listed was /System/Library/CoreServices, and I couldn't get it to to find the Windows partition or Windows' boot.efi file that's sitting on a separate EFI partition.


OS X was not updated to Sierra, and we're doing some pretty non-standard things to automatically install Boot Camp drivers, like a custom script to select a Boot Camp version based on model name, copy that locally during a zero-touch Windows installation, and run BootCamp.msi. So, we're kind of bypassing BC Assistant.


Anyway, quotation marks. Use them sparingly, I guess.

Dec 2, 2016 9:10 AM in response to Loner T

Sure, it's totally there. I just don't know how to make it work. Out of curiosity, and an interest in using the correct commands, here's what I'm seeing.


User uploaded file


After looking at another thread (Setboot? Formerly bless? Command line OS switching?), I tried mounting the Boot Camp partition (named Windows), and found /Volumes/Windows/Windows/Boot/EFI, but haven't gotten systemsetup to work there either, and it still only lists /System/Library/CoreServices as an available startup disk.


Also, "bless --folder /Volumes/Windows --setBoot" works fine, and it was my understanding that bless isn't supposed to work on EFI Windows installations. Have I created some kind of Frankenstein's Boot Camp?

Dec 2, 2016 9:25 AM in response to ajdavis8

If you notice Systemsetup always adds /System/Library/CoreServices. I have been playing around with using a symbolic link. It is designed for other OSX versions, not for Windows file structure.


If the Windows EFI is in C:, bless will work. It is confusing that the S: (System) is used initially to install Windows, but never really used once the installation completes. OSX Sierra will support a 'grand-fathered' W7 installation, but will not allow a new W7 installation. This is why I had posted the link where we used bless to make Windows boot. Your testing confirms it.


file /System/Library/CoreServices/boot.efi

/System/Library/CoreServices/boot.efi: PE32+ executable (EFI application) 32-bit

Dec 2, 2016 9:43 AM in response to Loner T

The S: drive in Windows kind of makes sense. Since firmwares/BIOS can't read NTFS, they would need a boot.efi file on a FAT32 partition to be able to to boot Windows. OS X can read NTFS (but not write), so it's able to boot EFI from the C: drive.


If there wasn't an EFI file in S:, or in the Mac's EFI partition, I don't think you would be able to option boot to Windows. I can't say I've tested that, though.


Thanks again for helping.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Boot Camp EFI - Programmatically Boot to OSX

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.