Booting into WinPE from internal hard disk

Discussion in 'Windows, Linux & Others on the Mac' started by joraff, Apr 25, 2012.

  1. joraff macrumors newbie

    Joined:
    Jul 26, 2010
    #1
    Here at work we're experimenting with a different method to deploy Windows to our mac workstations. Part of this is to try and boot the macs into the windows pre boot environment (winpe). So far, we can boot the few models that we have from a CD that we burned through SCCM (from an iso), and also from a USB key that has been formatted from windows (has an MBR-only partition table).

    Since srs5694 and murphychris seem to be active in this forum and very knowledgable in hybrid MBRs, I'm hoping they can chime in.

    So far this is the progress I've made:

    "No bootable device -- insert boot disk and press any key" with the following output from gdisk:

    Code:
    GPT fdisk (gdisk) version 0.8.4
    
    Partition table scan:
      MBR: hybrid
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with hybrid MBR; using GPT.
    
    Command (? for help): r
    
    Recovery/transformation command (? for help): p
    Disk /dev/disk0: 976773168 sectors, 465.8 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 4AE2EB88-3C2F-4BA9-B6B0-F76C96CD9380
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 976773134
    Partitions will be aligned on 8-sector boundaries
    Total free space is 263637 sectors (128.7 MiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              40          409639   200.0 MiB   EF00  EFI System Partition
       2          409640       842441279   401.5 GiB   AF00  Macintosh HD
       3       842704896       976773119   63.9 GiB    0700  Untitled
    
    Recovery/transformation command (? for help): o
    
    Disk size is 976773168 sectors (465.8 GiB)
    MBR disk identifier: 0x2912C428
    MBR partitions:
    
    Number  Boot  Start Sector   End Sector   Status      Code
       1                     1       409639   primary     0xEE
       2                409640    842441279   primary     0xAF
       3             842704896    976773119   primary     0x0B
    And fdisk:

    Code:
    fdisk: 1> p
    Disk: /dev/disk0	geometry: 60801/255/63 [976773168 sectors]
    Offset: 0	Signature: 0xAA55
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     1: EE 1023 254  63 - 1023 254  63 [         1 -     409639] <Unknown ID>
     2: AF 1023 254  63 - 1023 254  63 [    409640 -  842031640] HFS+        
     3: 0B 1023 254  63 - 1023 254  63 [ 842704896 -  134068224] Win95 FAT-32
     4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

    So, I thought that maybe my MBR was wrong and I tried it a different way (more along the lines of rob's article found here):

    Code:
    GPT fdisk (gdisk) version 0.8.4
    
    Partition table scan:
      MBR: hybrid
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with hybrid MBR; using GPT.
    
    Command (? for help): r
    
    Recovery/transformation command (? for help): o
    
    Disk size is 976773168 sectors (465.8 GiB)
    MBR disk identifier: 0x2912C428
    MBR partitions:
    
    Number  Boot  Start Sector   End Sector   Status      Code
       1                     1    842704895   primary     0xEE
       2      *      842704896    976773119   primary     0x0B
       4             976773120    976773167   primary     0x0A
    
    
    
    
    
    fdisk: 1> p
    Disk: /dev/disk0	geometry: 60801/255/63 [976773168 sectors]
    Offset: 0	Signature: 0xAA55
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     1: EE    0   0   2 - 1023 254  63 [         1 -  842704895] <Unknown ID>
    *2: 0B 1023 254  63 - 1023 254  63 [ 842704896 -  134068224] Win95 FAT-32
     3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
     4: 0A 1023 254  63 - 1023 254  63 [ 976773120 -         48] OS/2 Bootmgr
    
    and an now getting just a blinking cursor. That's better, I think. Maybe now it just needs the bootloader code. I dd'd the first 440 bytes from my USB flash drive that does boot, but stopped at that. I don't know where to restore that MBR code section for a hybrid MBR.

    So, I went on trying some microsoft tools to fix the MBR. From a windows 7 DVD, `bootrec /FixBoot` didn't fix the problem. However, `bootrec /FixMbr` made the windows partition show up in the Mac's EFI (I had to use bless before), but resulted in "Disk Error Press any key to restart". Trying `bootrec /fixboot` again still did not do anything.

    So, back into fdisk and gdisk to see what fixmbr did: no difference.

    Finally, as a last ditch effort I tried a modified version of gptsync (found here), and it recommended adding another 0xEE in the 4th MBR slot (which I thought would break OS X from booting).

    Now, I'm back at "No bootable device -- insert boot disk and press any key".

    Interestingly, if I have the WinPE CD or USB flash drive inserted, it automatically fails over to one of those.

    What piece to this puzzle am I missing to make this work?
     
  2. Quad5Ny macrumors 6502a

    Quad5Ny

    Joined:
    Sep 13, 2009
    Location:
    New York, USA
    #2
    Your forgetting the VBR (Volume Boot Record). The MBR transfers control to the first sector of the active partition (a sector is 512 bytes).

    BIOS > MBR > VBR > bootmgr > winload.exe > ntfs.sys/ntoskrnl.exe > ect.

    I'll post back with instructions.
     
  3. Quad5Ny, Apr 26, 2012
    Last edited: Apr 26, 2012

    Quad5Ny macrumors 6502a

    Quad5Ny

    Joined:
    Sep 13, 2009
    Location:
    New York, USA
    #3
    Here are the steps needed to copy WinPE over. Also, if you want I can show you how to manually edit the sectors using a Hex editor to install/edit the MBR/VBR.

     

Share This Page