none
WinPE transition with Legacy BIOS and UEFI support

    Question

  • I have a bootable flash drive which boots PE5x32 and PE5x64 via BCD boot menu. These entries work on Legacy mode only as bootmgr was taken from PE2 and bootmgr.efi didn't exist back then.  These two working WinPE5 boot.wim files are used in the following trials. 

    The short version of the following is that files copied using MakeWinPEMedia,cmd /ufd will not boot any boot.wim file when a legacy boot option is chosen on the computer's "select a boot device" menu. 

    Using ADK 8.1, I created a flash drive using "MakeWinPEMEdia.cmd".  If I point that script at a 64bit WinPE source folder, it makes a bootable flash which only works if I have a 64bit boot.wim and I choose UEFI mode when booting the desktop.  If I choose legacy bios boot, it crashes at NTOSKRNL.exe.  If I choose a 32bit boot.wim, neither Legacy or UEFI work.

    If I point "MakeWinPEMedia.cmd" at a 32bit WinPE source folder, it adds the 32bit bootmgr.efi and bootmgr seems to be the same version.  This flash drive will not boot in legacy or UEFI on 32bit or 64bit boot.wim. 

    BCDEDIT says that the default boot entry is using \windows\system32\boot\winload.exe which should be appropriate for legacy boot.

    The ultimate goal is to have a flash drive with a boot.wim and a boot64.wim file, either of which can be booted in legacy mode or UEFI mode.  If only the 64bit one is supported in UEFI mode, that is acceptable.

    Monday, August 03, 2015 9:26 PM

All replies

  • Pretty much uEFI requires a matching architecture winPE.  I honestly have never used the MakeWinPEMedia because if you use MDT it does it for you.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Monday, August 03, 2015 10:14 PM
    Moderator
  • I managed to figure it out.  First up, something I didn't understand prior.

    If you tell a computer to give you a boot device menu (f9 on HP computers, f12 on Dell), and choose boot from Flash Drive in Legacy mode, it loads up the file USB\boot\bcd.  If you choose boot from Flash drive in UEFI mode, it loads up USB\EFI\Microsoft\Boot\bcd.  I have heard some hardware supports UEFI in 32bit mode, but mine does not. 

    Here's the whole process

    Create a boot.wim for both 32bit PE and 64bit PE boot.wim.  Rename the later to boot64.wim

    Partition your flash drive (back up files first

    1. Diskpart
    2. Clean
    3. Create partition primary
    4. format fs=fat32 quick label="USB Boot"
    5. active
    6. assign
    7. exit

    Using Windows 8.1 ADK, copy the following files/folders to the root of the flash drive

    1. "Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\Media\EFI"
    2. "Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\Media\Boot"
    3. "Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\Media\bootmgr"
    4. "Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\Media\bootmgr.efi"

    Create a Sources folder on the root of the flash drive and put your boot.wim and boot64.wim files inside it

    Use BCDEdit to add a boot entry to the legacy BCD and fix the device path for the UEFI BCD

    1. bcdedit /store e:\boot\bcd /set {default} description "PE5x32"
    2. bcdedit /store e:\boot\bcd /copy {default} /d "PE5x64"
    3. Take note of the new GUID  (not you can right click a cmd windows and choose mark to copy the guid}
    4. bcdedit /store e:\boot\bcd /set {new guid} device ramdisk=[boot]\sources\boot64.wim,{guid-referenced-in-default-entry}
    5. bcdedit /store e:\boot\bcd /set {new guid} osdevice ramdisk=[boot]\sources\boot64.wim,{guid-referenced-in-default-entry}
    6. bcdedit /store e:\efi\microsoft\boot\bcd    (Take note of the guid for the default device)
    7. bcdedit /store e:\efi\microsoft\boot\bcd /set {default} device ramdisk=[boot]\sources\boot64.wim,{guid-referenced-in-default-entry}
    8. bcdedit /store e:\efi\microsoft\boot\bcd /set {default} osdevice ramdisk=[boot]\sources\boot64.wim,{guid-referenced-in-default-entry}

    With some luck, you should have two boot entries when booting this drive in legacy mode and it's auto go into 64bit PE when booting in UEFI mode. 

    Monday, August 03, 2015 10:46 PM
  • You are correct about MDT2013 doing most of this for you.  MDT falls short though when you need to multicast thousands of machines, touch free (not lite touch).  SCCM is the answer to that but even at 16,000 computers, it's too complicated to set up without consultant help.  Symantec GSS 3.0 is based on Altiris DS 6.9 and is very easy to get up and running with.  They use Ghost to multicast but their driver deliver system is limited so I inject drivers using DISM manually.  When computers fail during imaging, flash drive or PXE boot is the best solution.  PXE is taken care of by WDS but this tri boot option for flash requires more information. 

    In general, WinPE 32bit can service 32bit Windows images as well as 64bit ones.  WinPE 64bit can only service 64bit Windows.  This is true of DISM vs DISM64 as far as driver injection as well.

    Windows PE bit level must match the OS bit level of the Windows image you are applying only when you intend to run setup.exe.  If you use DISM, you can apply a 32bit windows image or a 64bit one without trouble.  You'll only have problems if you try to service a 32bit windows image from PE 64bit. 

    The mode that Windows is installed in (UEFI or Legacy) is only effected by what mode you booted WinPE from when running setup.exe.  Using Diskpart, DISM, and BCDBoot, you can make windows boot in Legacy or UEFI mode, regardless of how you booted PE. 

    Monday, August 03, 2015 10:56 PM
  • That is an interesting way to handle this. When you create boot media in ConfigMgr does it keep your customizations?

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Wednesday, August 05, 2015 6:15 PM
    Moderator