Jump to content
SoThOr

Creating EFI Boot entries using bcdedit in Windows.

1 post in this topic

Recommended Posts

This was spurred on from a discussion in the Clover General thread. Where there was a debate on bcdedit being able create/read/edit (U)EFI Boot entries. I didn't think it appropriate to post all this information there and somebody may want to make use of this and its likely to get lost in that massive thread.

 

Out of curiosity I decided to see if I could create an EFI entry using bcdedit. What can I say I like a challenge. :dev: Whilst is not a documented method by Microsoft, as it turns out in a round about way it IS possible to create an EFI entry using bcdedit and these are the steps I went through to add UEFI Shell located on a USB stick to the EFI entries. 

 

Third party software is available that can create and edit UEFI entries from Windows with better support and more features. I'm just making this information available in case those options are unavailable. 

 

DISCLAIMER - This is not a supported method. Use at your own risk. I recommend backing up your BCD/Firmware variables/settings beforehand.

 

1) Copy {bootmgr} entry.

C:\Windows\System32>bcdedit /copy {bootmgr} /d "UEFI Shell"
The entry was successfully copied to {34e8383c-73a7-11e9-9cb0-94de8078a7b5}.

2) Edit the new entry using the new GUID bcdedit generated in the copy step.

  a) Set the device and path for UEFI shell on my USB stick.

bcdedit /set {34e8383d-73a7-11e9-9cb0-94de8078a7b5} device partition=G:
bcdedit /set {34e8383d-73a7-11e9-9cb0-94de8078a7b5} path \EFI\SHELL\SHELLX64.efi

  b) Clean up some of the stuff that was copied from {bootmgr} (optional as far as I can tell, just makes things tidier in bcdedit)

Spoiler

bcdedit /deletevalue {34e8383d-73a7-11e9-9cb0-94de8078a7b5} locale
bcdedit /deletevalue {34e8383d-73a7-11e9-9cb0-94de8078a7b5} inherit
bcdedit /deletevalue {34e8383d-73a7-11e9-9cb0-94de8078a7b5} default
bcdedit /deletevalue {34e8383d-73a7-11e9-9cb0-94de8078a7b5} resumeobject
bcdedit /deletevalue {34e8383d-73a7-11e9-9cb0-94de8078a7b5} displayorder
bcdedit /deletevalue {34e8383d-73a7-11e9-9cb0-94de8078a7b5} toolsdisplayorder
bcdedit /deletevalue {34e8383d-73a7-11e9-9cb0-94de8078a7b5} timeout

 

3) Put the new EFI entry first in boot order. (optional)

Spoiler

bcdedit /set {fwbootmgr} displayorder {34e8383d-73a7-11e9-9cb0-94de8078a7b5} /addfirst

 

 

After completing the steps above, here is what "bcdedit /enum firmware" shows:

Spoiler

Firmware Boot Manager
---------------------
identifier              {fwbootmgr}
displayorder            {34e8383d-73a7-11e9-9cb0-94de8078a7b5}
                        {bootmgr}
                        {eace909f-3cb3-11e5-b87a-c28123693819}
timeout                 1

Windows Boot Manager
--------------------
identifier              {34e8383d-73a7-11e9-9cb0-94de8078a7b5}
device                  partition=G:
path                    \EFI\SHELL\SHELLX64.efi
description             UEFI Shell

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=S:
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
resumeobject            {631bdfec-580c-11e8-9c1a-9d7903c42521}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 0

Firmware Application (101fffff)
-------------------------------
identifier              {eace909f-3cb3-11e5-b87a-c28123693819}
device                  partition=\Device\HarddiskVolume8
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager

 

I shutdown my computer and when I turned my computer back on it booted up into UEFI Shell. After exiting the shell my PC went on to boot Windows.

Here is the resulting dump using "bcfg boot dump -v" from that shell:

Spoiler

Option: 00. Variable: Boot0001   
  Desc    - UEFI Shell
  DevPath - HD(1,MBR,0x00020fa6,0x3f,0x64000)/\EFI\SHELL\SHELLX64.efi
  Optional- Y
  00000000: 57 49 4E 44 4F 57 53 00-01 00 00 00 88 00 00 00  *WINDOWS.........*
  00000010: 78 00 00 00 42 00 43 00-44 00 4F 00 42 00 4A 00  *x...B.C.D.O.B.J.*
  00000020: 45 00 43 00 54 00 3D 00-7B 00 33 00 34 00 65 00  *E.C.T.=.{.3.4.e.*
  00000030: 38 00 33 00 38 00 33 00-64 00 2D 00 37 00 33 00  *8.3.8.3.d.-.7.3.*
  00000040: 61 00 37 00 2D 00 31 00-31 00 65 00 39 00 2D 00  *a.7.-.1.1.e.9.-.*
  00000050: 39 00 63 00 62 00 30 00-2D 00 39 00 34 00 64 00  *9.c.b.0.-.9.4.d.*
  00000060: 65 00 38 00 30 00 37 00-38 00 61 00 37 00 62 00  *e.8.0.7.8.a.7.b.*
  00000070: 35 00 7D 00 00 00 30 00-01 00 00 00 10 00 00 00  *5.}...0.........*
  00000080: 04 00 00 00 7F FF 04 00-                         *........*
Option: 01. Variable: Boot0000   
  Desc    - Windows Boot Manager
  DevPath - HD(2,GPT,1aca364d-82dd-4f63-ac0e-aa9aa224e877,0xe1800,0x31800)/\EFI\Microsoft\Boot\bootmgfw.efi
  Optional- Y
  00000000: 57 49 4E 44 4F 57 53 00-01 00 00 00 88 00 00 00  *WINDOWS.........*
  00000010: 78 00 00 00 42 00 43 00-44 00 4F 00 42 00 4A 00  *x...B.C.D.O.B.J.*
  00000020: 45 00 43 00 54 00 3D 00-7B 00 39 00 64 00 65 00  *E.C.T.=.{.9.d.e.*
  00000030: 61 00 38 00 36 00 32 00-63 00 2D 00 35 00 63 00  *a.8.6.2.c.-.5.c.*
  00000040: 64 00 64 00 2D 00 34 00-65 00 37 00 30 00 2D 00  *d.d.-.4.e.7.0.-.*
  00000050: 61 00 63 00 63 00 31 00-2D 00 66 00 33 00 32 00  *a.c.c.1.-.f.3.2.*
  00000060: 62 00 33 00 34 00 34 00-64 00 34 00 37 00 39 00  *b.3.4.4.d.4.7.9.*
  00000070: 35 00 7D 00 00 00 30 00-01 00 00 00 10 00 00 00  *5.}...0.........*
  00000080: 04 00 00 00 7F FF 04 00-                         *........*
Option: 02. Variable: Boot0004   
  Desc    - Windows Boot Manager
  DevPath - HD(2,GPT,8429c978-b940-4995-82c2-1981df946ece,0x96800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi
  Optional- N
 

 

You may notice that the shell shows as "Windows Boot Manager" in the bcdedit output. This I believe is because of the "WINDOWS" at the beginning of the option data that bcdedit added to the EFI Boot entry. I also believe this why bcdedit shows my Windows 8 installation as "Firmware Application" because it has no option data. I don't know how to remove this data using bcdedit nor do I know how the option data, that bcdedit adds, will affect other EFI applications.


There might be a way to create the EFI entry without copying the Windows entry but if there is I'm unable to find any documentation on how one would do so. If you use the create command then it just puts it in the BCD and I'm unaware of a way to tell it to create it in EFI instead, other than by doing the above.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By tlac
      Simple steps to create macOS Installer for Vmware on Linux or Windows
       
      This guide describes how you can create a Vmware image (vmdk) for installing macOS in Vmware. Most tutorials about this topic require an ISO installer file that was typically created in macOS or you have to download some preinstalled image file from unknown source. None of them are ideal. But if you follow the steps below, you will not need to access macOS and will use official and trusted sources.
       
      First of all download gibMacOS from here and set up
      https://github.com/corpnewt/gibMacOS
        Run the script to download the full macOS installer:
      on Linux: gibMacOS.command on Windows: gibMacOS.bat  
      Install qemu-img converter

      on Linux (Debian or Ubuntu):
      install qemu-tools package

      on Windows use this installer:
      https://qemu.weilnetz.de/w64/
      when you run the installer, it is enough to select the "tools" and "dll library".
       
      Convert the downloaded BaseSystem.dmg to Vmware image
      run the following commmand in that directory where BaseSystem.dmg was downloaded (somewhere here: gibMacOS-master/macOS Downloads/publicrelease/061-44387 - 10.15.3 macOS Catalina)
      on Linux:
      qemu-img convert -O vmdk -o compat6 BaseSystem.dmg recovery.vmdk on Windows:
      c:\"Program Files"\qemu\qemu-img convert -O vmdk -o compat6 BaseSystem.dmg recovery.vmdk  
      Use the previously created image to install macOS in Vmware
       
      I assume you have a patched and working Vmware already. If not, find another guide but in nutshell:
      - confirm the VT-x is supported on your Intel machine (if you are on AMD you may not able to virtualize macOS or you need to do more work)
      - install VMware Workstation or VMware Workstation Player (free for non-commercial use)
      - use an unlocker to patch the Vmware to support macOS guest
       currently this works well: https://github.com/BDisp/unlocker/
       
      So when you are here you have a patched Vmware and a Vmware image (recovery.vmdk).
      Run Vmware and create a new virtual machine by choosing macOS guest. But add another hard disk as well with selecting to use an existing virtual disk. Browse the recovery.vmdk. You will get a warning about the image is not in the latest format but choose to keep the existing format.
      After you installed the macOS, install the vmware tools as well.
       
      Tested on Windows 10 with macOS Catalina 10.15.3 in Vmware 15.5 Player
       
      Comments are welcome.
       
    • By kushwavez
      A really good motherboard with macOS compatible bult-in Wifi & Bluetooth

      ASUS Z170-Deluxe (with Wifi)
      BIOS: v3801
      CPU: i7-6700K 4.0 to 4.2 GHz (w/o OC)
      RAM: 1x 16 GB Corsair DDR4 2400 MHz
      GPU: Intel HD 530 (Headless) & ASUS Radeon RX 5700 OC 8 GB
      Audio: ALC 1150
      Ethernet: I219V2, I211-AT
      WiFi & Bluetooth: Broadcom BCM94360HMB Half-Mini-PCI-E
      More Specs: https://www.asus.com/Motherboards/Z170-DELUXE/specifications/
       
      Catalina 10.15.3 - Windows 10
      What is working:
      BCM94360HMB Wifi and Bluetooth AirDrop, Handoff, FaceTime, Messages, App Store, iCloud, etc. Intel HD 530 (QE/CI tested, but now I'm using it in headless) Sleep RX 5700 (QE/CI with 2 1080p monitors connected) Sound USB Ports Two Ethernet ports macOS with a light OC (4.12 GHz - 4.5 Ghz, XMP, ASUS optimal) No problem so far ASUS HyperKit with a KINGSTON NVMe SSD - 250 GB  
      What is not working:
      -  
       
      Not tested:
      VideoProc says that Hardware Decoding\Encoding is fully supported and enabled on both HD 530 and RX 5700 but I didn't test it Thunderbolt (no equipment)  
      Issues:
      None  
      BIOS Settings:
      Boot\CSM (Compatibility Support Module): Launch CSM: Disabled Boot\Secure Boot: OS type: Other OS Secure Boot State: Disabled Advanced\System agent (sa) Configuration: VT-d: Enabled Graphics Configuration: Primary Display: Auto iGPU Multi-monitor: Enabled RC6(Render Standby): Enabled DVMT Pre-Allocated: 128M Advanced\PCH Storage Configuration: SATA Mode Selection: AHCI HyperKit: Enable (if you have NVMe SSD with ASUS HyperKit) Advanced\CPU Configuration: Intel Virtualization Technology: Enabled CPU- Power Management Control: Intel SpeedStep: Enabled CPU- C-States: Enabled Intel SpeedShift: Enabled  
      Getting ready for installation:
      Download the bootpack (Clover v5098): Click here -> ASUS-Z170_catalina.zip  
      Installation:
      Create an installer with any method you know (- Mac: createinstallmedia - Windows: Transmac, Vmware, Win32diskimager) Copy my Clover folder to the USB's EFI folder Boot with the Installer USB If you have any problem (kp or freeze) boot with config_debug.plist to see what causes the issue  
      Post Installation:
      Download Clover Configurator and generate a new Serial Number for yourself  
      Some pictures:
       

       




       
       
       
      Catalina & Windows 10 Dual-Boot (clean install, on one drive):
       Boot into your Mac installer, Create 2 partitions in GUID table (1 for Win (I used FAT32 but I think it doesn't matter what you choose), 1 for Mac)
       Install Mac, boot with your USB, mount your EFI partition (use terminal or an EFI mounter app), create an EFI folder (if there is no folder), copy the CLOVER folder I attached to the EFI folder, restart
      Boot into your Win installer, Format the partition you created for Win, install. 
      Now, it's automatically booting into Windows. To use Clover open cmd in administrator, type: 
      bcdedit /set {bootmgr} path \EFI\CLOVER\CLOVERX64.efi  
      You're done! It will booting into Clover when you start the system, and you can select Win or Mac (or another OS if installed on a 3rd partition).
       
      IF YOU GETTING ERRORS DURING WINDOWS INSTALLATION (could not be formatted, etc):
      Make sure you have GPT partitions, and GPT (UEFI) installer, also disconnect all external storage drives (except the installer USB)  
      Mounting EFI from Windows:
      Open cmd in administrator mode and type: mountvol b: /s (This will mount your EFI) Open Total Commander or Explorer++ in administrator mode to manage EFI mountvol b: /d (This will unmount your EFI)  
      Notes:
       
      2020.02.11: Updated to 10.15.3 -> No problem when/after installing
      2020.01.19: Added ASUS HyperKit NVMe SSD to the "What is working" list
      2020.01.12: Tested system with OC, added more informations to BIOS settings
      2020.01.11: Added SmallTreeIntel82576.kext for 2nd Ethernet, Tested Ethernet ports
      2020.01.11: First upload
       
    • By johnny28
      Ho una tastiera wireless Apple Magic Keyboard con tastierino numerico (layout italiano), con Catalina OK, ma quando la uso con Windows 10, ho un piccolo problema i tasti "<" e "\" sono scambiati, nel senso che quando pigio sul tasto "\" ottengo invece "<" e viceversa. C'è modo di correggere il problema, senza dover ricorrere ad un software a pagamento come "Magic Keyboard Utlities" ?
    • By kingoffright
      Dear all,
       
      I have a external harddisk about 500GB, I installed the clover into it and the harddisk is GPT format, below is the 3 partitions details:
      FS01: EFI - disk0s1 - fat32
      FS02: install mac  image - disk0s2 -  hfs+
      FS03: install windows 10 - disk0s3 - fat32
       
      I can use this external harddisk to install Mac without issue, I use below steps to install windows 10
      enter the FS03:
      cd to efi/boot/ and excuete bootx64.efi
      after pop up the windows install screen, i click next and it shows error 'A media driver your computer needs is missing...' and the installation can not go any further.
      Firstly I use ultraiso to write the windows 10 image to a flash disk and no issue to start install window 10 so the image is working fine. Since I dont know how to write
      a wiindow installation image into harddisk partition, I used winrar extra all the files into disk0s3, am I missing some steps or actually clover not support to install windows
      by partitions, apprecating any helps.
       
×