BCD system store and the device and osdevice elements

Discussion in 'Mobile and Portable' started by balubeto, May 8, 2015.

  1. balubeto

    balubeto MDL Senior Member

    Dec 22, 2009
    465
    9
    10
    #1 balubeto, May 8, 2015
    Last edited by a moderator: Apr 20, 2017
    Hi

    I installed the latest version of Windows ADK on Windows 8.x to create Windows PE 32/64 bit.

    Before starting, I noticed a very odd particular:

    If I analyze the BCD system store of Windows PE 32-bit with the bcdedit /store "C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\microsoft\boot\BCD" and bcdedit /store "C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\microsoft\boot\BCD" /v commands, I get:

    Code:
    C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools>bcdedit /store "C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\Microsoft\Boot\BCD"
    Windows Boot Manager
    --------------------
    identifier              {bootmgr}
    description             Windows Boot Manager
    locale                  en-US
    inherit                 {globalsettings}
    flightsigning           Yes
    default                 {default}
    displayorder            {default}
    toolsdisplayorder       {memdiag}
    timeout                 30
    Windows Boot Loader
    -------------------
    identifier              {default}
    device                  ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    path                    \windows\system32\boot\winload.efi
    description             Windows Setup
    locale                  en-US
    inherit                 {bootloadersettings}
    osdevice                ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    systemroot              \windows
    bootmenupolicy          Standard
    detecthal               Yes
    winpe                   Yes
    ems                     No
    C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools>bcdedit /store "C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\Microsoft\Boot\BCD" /v
    Windows Boot Manager
    --------------------
    identifier              {9dea862c-5cdd-4e70-acc1-f32b344d4795}
    description             Windows Boot Manager
    locale                  en-US
    inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
    flightsigning           Yes
    default                 {7619dcc9-fafe-11d9-b411-000476eba25f}
    displayorder            {7619dcc9-fafe-11d9-b411-000476eba25f}
    toolsdisplayorder       {b2721d73-1db4-4c62-bf78-c548a880142d}
    timeout                 30
    Windows Boot Loader
    -------------------
    identifier              {7619dcc9-fafe-11d9-b411-000476eba25f}
    device                  ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    path                    \windows\system32\boot\winload.efi
    description             Windows Setup
    locale                  en-US
    inherit                 {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
    osdevice                ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    systemroot              \windows
    bootmenupolicy          Standard
    detecthal               Yes
    winpe                   Yes
    ems                     No
    C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools>
    
    When, however, I modify the device and osdevice elements with the bcdedit /store "C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\microsoft\boot\BCD" /set {7619dcc9-fafe-11d9-b411-000476eba25f} device ramdisk=[boot]\sources\boot_x32.wim,{7619dcc9-fafe-11d9-b411-000476eba25f} and bcdedit /store "C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\microsoft\boot\BCD" /set {7619dcc9-fafe-11d9-b411-000476eba25f} osdevice ramdisk=[boot]\sources\boot_x32.wim,{7619dcc9-fafe-11d9-b411-000476eba25f} commands, I get:

    Code:
    C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools>bcdedit /store "C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\Microsoft\Boot\BCD"
    Windows Boot Manager
    --------------------
    identifier              {bootmgr}
    description             Windows Boot Manager
    locale                  en-US
    inherit                 {globalsettings}
    flightsigning           Yes
    default                 {default}
    displayorder            {default}
    toolsdisplayorder       {memdiag}
    timeout                 30
    Windows Boot Loader
    -------------------
    identifier              {default}
    device                  ramdisk=[boot]\sources\boot_x32.wim,{default}
    path                    \windows\system32\boot\winload.efi
    description             Windows Setup
    locale                  en-US
    inherit                 {bootloadersettings}
    osdevice                ramdisk=[boot]\sources\boot_x32.wim,{default}
    systemroot              \windows
    bootmenupolicy          Standard
    detecthal               Yes
    winpe                   Yes
    ems                     No
    C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools>bcdedit /store "C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\Microsoft\Boot\BCD" /v
    Windows Boot Manager
    --------------------
    identifier              {9dea862c-5cdd-4e70-acc1-f32b344d4795}
    description             Windows Boot Manager
    locale                  en-US
    inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
    flightsigning           Yes
    default                 {7619dcc9-fafe-11d9-b411-000476eba25f}
    displayorder            {7619dcc9-fafe-11d9-b411-000476eba25f}
    toolsdisplayorder       {b2721d73-1db4-4c62-bf78-c548a880142d}
    timeout                 30
    Windows Boot Loader
    -------------------
    identifier              {7619dcc9-fafe-11d9-b411-000476eba25f}
    device                  ramdisk=[boot]\sources\boot_x32.wim,{7619dcc9-fafe-11d9-b411-000476eba25f}
    path                    \windows\system32\boot\winload.efi
    description             Windows Setup
    locale                  en-US
    inherit                 {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
    osdevice                ramdisk=[boot]\sources\boot_x32.wim,{7619dcc9-fafe-11d9-b411-000476eba25f}
    systemroot              \windows
    bootmenupolicy          Standard
    detecthal               Yes
    winpe                   Yes
    ems                     No
    C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools>
    
    How do I avoid that the {7619dcc9-fafe-11d9-b411-000476eba25f} identifier is construed as the {default} alias in the device and osdevice elements?

    Thanks

    Bye
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,544
    662
    60
    #2 Flipp3r, May 8, 2015
    Last edited by a moderator: Apr 20, 2017
    I normally copy the default, add my changes, delete default & set my mod as default. Restore an original BCD & try my cmd:
    Code:
    @echo off
    set MyBCD="C:\Users\Public\Documents\Windows_PE\x32-x64\Media\EFI\Microsoft\Boot\BCD"
    
    FOR /F "delims={} tokens=2" %%I IN ('bcdedit /store %MyBCD% /copy {default} /d "WinPE beta 32bit UEFI Mode"') DO SET OSGUID=%%I
    SET OSGUID={%OSGUID%}
    
    bcdedit /store %MyBCD% /set %OSGUID% device ramdisk=[boot]\sources\boot_x32.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    bcdedit /store %MyBCD% /set %OSGUID% osdevice ramdisk=[boot]\sources\boot_x32.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    bcdedit /store %MyBCD% /displayorder %OSGUID% /addfirst
    bcdedit /store %MyBCD% /delete {default}
    bcdedit /store %MyBCD% /default %OSGUID%
    bcdedit /store %MyBCD% /v
    pause
     
  3. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,544
    662
    60
    #3 Flipp3r, May 8, 2015
    Last edited by a moderator: Apr 20, 2017
    Actually, I've never had a device that could boot UEFI in 32bit. You could have both 32 & 64 by adding:
    Code:
    bcdedit /store %MyBCD% /timeout 8
    bcdedit /store %MyBCD% /set {default} bootmenupolicy Legacy
    FOR /F "delims={} tokens=2" %%I IN ('bcdedit /store %MyBCD% /copy {default} /d "WinPE beta 64bit UEFI Mode"') DO SET OSGUID=%%I
    SET OSGUID={%OSGUID%}
    bcdedit /store %MyBCD% /set %OSGUID% device ramdisk=[boot]\sources\boot_x64.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    bcdedit /store %MyBCD% /set %OSGUID% osdevice ramdisk=[boot]\sources\boot_x64.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
     
  4. balubeto

    balubeto MDL Senior Member

    Dec 22, 2009
    465
    9
    10
    Could you explain why it is always necessary to copy, modify and delete, and the default object you can never to modify correctly?

    What is the use of the for cycle given that I have only one object to be copied?

    Thanks

    Bye
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. balubeto

    balubeto MDL Senior Member

    Dec 22, 2009
    465
    9
    10
    #5 balubeto, May 8, 2015
    Last edited: May 8, 2015
    (OP)
    A moment:

    When I run the bcdedit /store %MyBCD% /default %OSGUID% command, the values of the device and osdevice elements returned to have the values ...,{default}. Why?

    Thanks

    Bye
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. balubeto

    balubeto MDL Senior Member

    Dec 22, 2009
    465
    9
    10
    #6 balubeto, May 12, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Now, my procedure is as follows:

    Code:
    1) md "<Windows_PE_Path>"
    2) md "<Windows_PE_Path>\x32-x64\Media"
    3) md "<Windows_PE_Path>\ISO"
    4) copype x86 "<Windows_PE_Path>\x32"
    5) copype amd64 "<Windows_PE_Path>\x64"
    6) MakeWinPEMedia /ISO "<Windows_PE_Path>\x32" "<Windows_PE_Path>\ISO\Windows_PE_x32.iso"
    7) MakeWinPEMedia /ISO "<Windows_PE_Path>\x64" "<Windows_PE_Path>\ISO\Windows_PE_x64.iso"
    8) robocopy "<Windows_PE_Path>\x32\fwfiles" "<Windows_PE_Path>\Boot_files"
    9) rd "<Windows_PE_Path>\x32" /s /q
    10) rd "<Windows_PE_Path>\x64" /s /q
    11) powershell Mount-DiskImage -ImagePath "<Windows_PE_Path>\ISO\Windows_PE_x32.iso"
    12) powershell Get-DiskImage -ImagePath "<Windows_PE_Path>\ISO\Windows_PE_x32.iso" ^| Get-Volume
    13) robocopy <Drive_Letter>:\ "<Windows_PE_Path>\x32-x64\Media" /e /a-:R
    14) powershell Dismount-DiskImage -ImagePath "<Windows_PE_Path>\ISO\Windows_PE_x32.iso"
    15) ren "<Windows_PE_Path>\x32-x64\Media\sources\boot.wim" boot_x32.wim
    17) powershell Mount-DiskImage -ImagePath "<Windows_PE_Path>\ISO\Windows_PE_x64.iso"
    18) powershell Get-DiskImage -ImagePath "<Windows_PE_Path>\ISO\Windows_PE_x64.iso" ^| Get-Volume
    19) robocopy <Drive_Letter>:\sources "<Windows_PE_Path>\x32-x64\Media\sources" boot.wim /a-:R
    20) ren "<Windows_PE_Path>\x32-x64\Media\sources\boot.wim" boot_x64.wim
    21) robocopy <Drive_Letter>:\EFI\Boot "<Windows_PE_Path>\x32-x64\Media\EFI\Boot" bootx64.efi /a-:R
    22) powershell Dismount-DiskImage -ImagePath "<Windows_PE_Path>\ISO\Windows_PE_x64.iso"
    23) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\Boot\BCD" | find "device"
    24) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\Boot\BCD" /set {default} description "<Windows_PE_x32_name>"
    25) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\Boot\BCD" /copy {default} /d "Windows_PE_x64_name>"
    26) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\Boot\BCD" /set {default} device "ramdisk=[boot]\sources\boot_x32.wim,<Options_ID>"
    27) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\Boot\BCD" /set {default} osdevice "ramdisk=[boot]\sources\boot_x32.wim,<Options_ID>"
    28) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\Boot\BCD" /set <Windows_PE_x64_ID> device "ramdisk=[boot]\sources\boot_x64.wim,<Options_ID>"
    29) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\Boot\BCD" /set <Windows_PE_x64_ID> osdevice "ramdisk=[boot]\sources\boot_x64.wim,<Options_ID>"
    30) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\Boot\BCD" /set {bootmgr} displaybootmenu true
    31) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\EFI\microsoft\boot\BCD" /set {default} description "<Windows_PE_x32_name>"
    32) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\EFI\microsoft\boot\BCD" /copy {default} /d "Windows_PE_x64_name>"
    33) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\EFI\microsoft\boot\BCD" /set {default} device "ramdisk=[boot]\sources\boot_x32.wim,<Options_ID>"
    34) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\EFI\microsoft\boot\BCD" /set {default} osdevice "ramdisk=[boot]\sources\boot_x32.wim,<Options_ID>"
    35) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\EFI\microsoft\boot\BCD" /set <Windows_PE_x64_ID> device "ramdisk=[boot]\sources\boot_x64.wim,<Options_ID>"
    36) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\EFI\microsoft\boot\BCD" /set <Windows_PE_x64_ID> osdevice "ramdisk=[boot]\sources\boot_x64.wim,<Options_ID>"
    37) bcdedit /store "<Windows_PE_Path>\x32-x64\Media\EFI\microsoft\boot\BCD" /set {bootmgr} displaybootmenu true
    38) robocopy "<Windows_PE_Path>\Boot_files" "<Windows_PE_Path>\x32-64\fwfile"
    39) MakeWinPEMedia /iso "<Windows_PE_Path>\x32-x64" "<Windows_PE_Path>\ISO\Windows_PE_x32-x64.iso"
    40) isoburn /Q <Drive_Letter>: "<Windows_PE_Path>\ISO\Windows_PE_x32-x64.iso"
    
    Windows PE 32/64 bit works properly with computers that have the BIOS; while with those that have the UEFI, the CD does not boot and the screen remains black. Why?

    Thanks

    Bye
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,544
    662
    60
    Is WinPE 32bit the default for UEFI? Why not make 64bit the default & see what happens.
    You can't boot 32bit UEFI if your system UEFI is 64bit.
    Also perhaps try setting bootmenupolicy from standard to legacy...
     
  8. balubeto

    balubeto MDL Senior Member

    Dec 22, 2009
    465
    9
    10
    I tried to change the value of bootmenupolicy but it did not solve the problem.

    After several attempts on different computer, I noticed that the only case in which the computer does not boot from my CD is the one in which this computer is a 64 bit with the UEFI.

    So, how do I solve this problem ie how do I make this CD so that it starts even with the 64 bit computers with UEFI?

    Thanks

    Bye
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. balubeto

    balubeto MDL Senior Member

    Dec 22, 2009
    465
    9
    10
    Perhaps, I discovered the problem:

    I noticed that the efisys.bin file of Windows PE 32 bit is different than 64 bit.

    So, how do I create a CD of Windows PE 32/64 bit fully working? Or rather, how do I create a efisys.bin single file?

    Thanks

    Bye
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. balubeto

    balubeto MDL Senior Member

    Dec 22, 2009
    465
    9
    10
    #10 balubeto, May 14, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    To create an iso that works in any case, I thought to rename the two Efisys.bin in efisys_x32.bin and efisys_x64.bin and then use the command

    Code:
    oscdimg -o -u2 -udfver102 -bootdata:3#p0,e,b"<Windows_PE_Path>\Boot_files\etfsboot.com"#pEF,e,b"<Windows_PE_Path>\Boot_files\efisys_x32.bin"#pEF,e,b"<Windows_PE_Path>\Boot_files\efisys_x64.bin" "<Windows_PE_Path>\x32-x64" "<Windows_PE_Path>\ISO\Windows_PE_x32-x64.iso"
    
    to create the ISO.

    For you, with this method, I can reach my goal?

    Thanks

    Bye
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. balubeto

    balubeto MDL Senior Member

    Dec 22, 2009
    465
    9
    10
    I think I have understand what does not work: the efisys.bin and bootmgr.efi files are different in the two editions of Windows PE 5.x.

    So, there is a method to recreate them so that they work with both editions so that my CD will not have more problems to start with any type of UEFI-based computer?

    Thanks

    Bye
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...