BCDEdit and debug setup

This blog is a short guide to provide some basic info regarding Boot Configuration Data Editor (BCDEdit), and present a collection of useful links where more detail is available.

Boot Configuration Data (BCD) provides a store that is used to describe boot applications and their settings. These objects and elements effectively replace Boot.ini. The data in the store is managed via command line using Bcdedit.exe (or using WMI Classes), or by using any one of several third party BCDEdit GUI tools available online. When Windows is not loaded and GUI programs are not possible, only command line bcdedit.exe is available through WinPE.

The following site shows Boot.ini parameters and their corresponding BCDEdit options:

https://msdn.microsoft.com/en-us/library/aa906217.aspx

If you have problems starting Windows and you need to turn on debugging during boot, use the /bootdebug switch.

Follow the instructions here: https://msdn.microsoft.com/en-us/library/ee220364.aspx

(Be aware that you will have to include complete path for “bcdedit.exe” in your command as it doesn’t know where it is coming from.)

To set (or display the current) global debugger settings ( /dbgsettings), use the following instructions:

https://msdn.microsoft.com/en-us/library/aa906219.aspx

To enable or disable kernel debugging, use the /debug switch. (https://msdn.microsoft.com/en-us/library/aa906217.aspx)

When you have test-signed code you must enable or disable test signing according to your needs. Use:

https://msdn.microsoft.com/en-us/library/aa906238.aspx

To Enable or Disable Emergency Management Services (EMS) or to change its settings use:

https://msdn.microsoft.com/en-us/library/aa906213.aspx

https://msdn.microsoft.com/en-us/library/aa906209.aspx

To configure specific boot entry elements such as kernel debugger settings, data execution protection (DEP) and processor address extension (PAE), and to load alternate hardware abstraction layer (HAL) and kernel files, use the /set parameter. Read more about it below:

https://msdn.microsoft.com/en-us/library/aa906211.aspx

To setup the target system for Debugging, launch an elevated command prompt and use one of the following commands:

·         bcdedit /dbgsettings 1394 channel:1

·         bcdedit /dbgsettings USB targetname:usbdbg

·         bcdedit /dbgsettings serial debugport:2

Following is some useful BCD commands run in an elevated command prompt:

·         bcdedit /enum all (verify if the debugger settings is configured correctly)

·         bcdedit /copy {current} /d DebugEntry (if the command succeeds, BCDEdit displays a message with a GUID. Copy the GUID for further usage.)

·         bcdedit /displayorder {current} {GUID}

·         bcdedit (verify the GUID entry is configured to display in Windows Boot Manager correctly)

·         bcdedit /debug {GUID} ON

To setup USB debugging, you need to start with specific USB debug cables that have been tested and are supported

Identify which USB port is the first port in a USB EHCI controller following the steps below:

1.       Run USBview.exe on target system

2.       Plug in a USB flash drive to various USB ports and keep refreshing the display until it shows up as plugged in to port 1

3.       Once you find which external USB port is Port 1, launch device manager to find the corresponding USB (or USB2) Host Controller under “Universal Serial Bus controllers”.

4.       Check the device properties, General tab and look at “Location:” get the PCI device bus, device and function number (such as PCI bus 0, device 29, function7)

5.       For Windows Vista enter the Hex value such as below:

Bcdedit /set loadoptions busparams= 0.1d.7 (which is saying bus 0, device 29, function7 in Hex)

6.       For Windows 7 enter the Decimal value such as below:

Bcdedit /set loadoptions busparams= 0.29.7 (which is saying bus 0, device 29, function7 in Dec)

 

You might have to enter BIOS and disable legacy USB, however be aware that your USB mouse and keyboard may not function while Legacy USB is disabled.

 

To setup 1394 and Com port debugging, you can launch msconfig and select the Advanced option in Boot tab. There you can select “Debug” to enable the Global debug settings.