Edit or import a BCD file from within OS X

Look
Valued Contributor III

I am working on trying to get SCCM prestaged imaging working using solely UEFI in this case Windows 8.1 on a 2015 MacBook Pro.
I have managed to get everything working successfully.
However I am unable to automate one particular step without having to boot of a USB and do it manually.
Basically before it can work I need to generate the BCD file on the EFI partition that points the WinPE ramdisk boot.
There is some internal information within this that appears to reference the drive itself(UUID perhaps), so if you copy it onto a newly formated EFI partition it no longer works.
Does anyone know a method of creating/modifying a BCD from within OS X, preferably something that can be done from a command line.
It would appear WinClone can somehow do this as part of their Make EFI Bootable option in 4.4, it looks like an import and modify somehow.

4 REPLIES 4

virtual1
New Contributor

I'm sure something like this is possible using DD to hop around on the drive, gather the information, and make the repair, so curiosity got the better of me and I went looking.

As you've probably already determined, information on this process is mighty hard to find. I found numerous references to the new EFI BCD data being stored "on the EFI system partition", but no one seems to know what the format is, or where precisely it's stored. (the BCD block format may be proprietary) I found many dozens of ways of repairing/rebuilding it, every single one of which was a windows application or windows command line tool. Obviously people have figured out how to do it, they're just not sharing that information. (they'd probably prefer you buy their app)

At the very least, it involves starting with a basic BCD template, and filling in a pointer to the windows partition. (and other information may be necessary or at least a good idea to fill in) This may be a UUID, a block number, or both. Then write that data to the hard drive where it belongs. (it's likely a single block at a predetermined location in the partition table) I wasn't able to locate this information though. If you manage to dig it up, post back here or get ahold of me and I'll see if I can apply it for you. I enjoy working on challenges like this, and my google-foo is usually sufficient, but in this case the necessary information is buried deeper than I have time to go digging for right now.

Look
Valued Contributor III

@virtual1 If I find anything will let you know.
The very helpful Tim from Two Canoes (WinClone) is also giving me a bit of assistance so we will see how we get on!

homepup
New Contributor III

We've been using a pre-package installer that harnesses Winclone, SCCM & Bittorrent to deploy Windows to thousands of Macs every summer. Worked fine until the latest Early 2015 MacBook Pros were released which require UEFI booting.

Been working with the guys that Make Winclone and they've been very helpful but no solution yet. They did let me know that Winclone makes changes to the BCD file to make it bootable which works fine for a vanilla Windows 8.1 install (and I've had that working no problem), but since we're using prestaged media with a combination of a full Windows install and WinPE on the same partition, it ends up butchering the BCD file. They are fully aware of the problem and that people really need this to work for mass deployments.

I've worked this week and made a command-line OS X script that goes in and edits the UUID from the Windows volume into the BCD file in the correct locations (and in the proper format) which got me a few seconds deeper into the WinPE boot process (I believe it is finding the proper partition now, but gets lost attempting to find the file boot path, keeps getting changed to "unknown"), but it's still not perfect yet. There's other changes that happen from one computer to another that I'm missing that I can see when comparing the BCD files in hex.

I wonder if there's more info that is necessary, like a UUID or serial number for the machine or hard drive that's unique for each computer?

Our current solution is to package and image like normal, then the first boot has to be on external media (WinPE in our case) that runs a quick script to recreate the BCD file. Then SCCM picks up just fine from that point on. 99% automated but I've been working on that other 1% for months now.

Look
Valued Contributor III

@homepup Any progress on this, still banging my head against it, the whole thing being made much worse when you throw SIP into the mix!
Someone needs to just make a commercial product that just deals with all this crap so we can just give them our money and go back to deploying packages!