Jump to content

Windows Boot Manager

From Wikipedia, the free encyclopedia
Windows Boot Manager
Other namesBOOTMGR
Developer(s)Microsoft
Operating systemWindows
PredecessorNTLDR
TypeBootloader
LicenseProprietary

The Windows Boot Manager (BOOTMGR) is the bootloader provided by Microsoft for Windows NT versions starting with Windows Vista and Windows Server 2008. It is the first program launched by the BIOS or UEFI of the computer and is responsible for loading the rest of Windows.[1] It replaced the NTLDR present in older versions of Windows.

The boot sector or UEFI loads the Windows Boot Manager (a file named BOOTMGR on either the system or the boot partition), accesses the Boot Configuration Data store and uses the information to load the operating system through winload.exe or winresume.exe on BIOS systems, and winload.efi and winresume.efi on UEFI systems.[2]

Launching

[edit]

On system with BIOS firmware, the BIOS invokes MBR boot code from a hard disk drive at startup. The MBR boot code and the VBR boot code are OS-specific. In Microsoft Windows, the MBR boot code tries to find an active partition (the MBR is only 512 bytes), then executes the VBR boot code of an active partition. The VBR boot code tries to find and execute the bootmgr file from an active partition.[3]

On systems with UEFI firmware, UEFI invokes bootmgfw.efi from an EFI system partition at startup, starting the Windows Boot Manager.

Operation

[edit]

Once launched the Windows Boot Manager reads the Boot Configuration Data to determine what operating systems are present and if it should present the user with a menu allowing them to select which operating system to boot. Before Windows Vista, this data was contained in boot.ini.

These menu entries can include:

  • Options to boot Windows Vista and later by invoking winload.exe.
  • Options to resume Windows Vista and later from hibernation by invoking winresume.exe.
  • Options to boot a prior version of the Windows NT family by invoking its NTLDR.
  • Options to load and to execute a volume boot record.

Operating system loading

[edit]

The operating system is loaded by individual boot loaders for each install of Windows, called the Windows Boot Loader.

winload.exe

[edit]

The Windows Boot Manager invokes winload.exe—the operating system boot loader—to load the operating system kernel executive (ntoskrnl.exe) and core device drivers. In that respect, winload.exe is functionally equivalent to the operating system loader function of NTLDR in prior versions of Windows NT. In UEFI systems, the file is called winload.efi and the file is always located at \windows\system32 or \windows\system32\boot.

winresume.exe

[edit]

If the computer has recently hibernated, then bootmgr will instead invoke winresume.exe. In UEFI systems, the file is called winresume.efi and is always located at \windows\system32 or \windows\system32\boot.[4]

Boot Configuration Data

[edit]

BCD is a file that is used to store the configuration of Microsoft's Windows Boot Manager. It is the equivalent of NTLDR's boot.ini or GNU GRUB's grub.cfg.

For UEFI boot, the file is located at /EFI/Microsoft/Boot/BCD on the EFI System Partition. For traditional BIOS boot, the file is at /boot/BCD on the active partition.[5]

Boot Configuration Data is stored in a data file that has the same format as Windows Registry hives and is eventually mounted at registry key HKEY_LOCAL_MACHINE\BCD00000[6] (with restricted permissions[7]).

Boot Configuration Data (BCD) is a firmware-independent database for boot-time configuration data.[8]

Several command-line tool to edit this file have been made available: bootrec, bcdboot and bcdedit.

bcdedit

[edit]
bcdedit
Developer(s)Microsoft
Operating systemMicrosoft Windows
TypeCommand
LicenseProprietary commercial software
Websitedocs.microsoft.com/en-us/windows-server/administration/windows-commands/bcdedit

Boot Configuration Data may be altered using a command-line tool (bcdedit.exe), using the Registry Editor[6] (regedit.exe), using Windows Management Instrumentation, or with third-party tools such as EasyBCD, BOOTICE,[9] or Visual BCD Editor.[10]

Boot Configuration Data allows for third-party integration, so anyone can implement tools like diagnostics or recovery options

Syntax
      BCDEdit /Command [Argument1] [Argument2] ...

Key
      /? command   To display detailed help for a particular command, run bcdedit /? command,
                    where command is the name of the command you are searching for more information about.
                    e.g. bcdedit /? createstore

   Store commands:

      /createstore  Creates a new empty boot configuration data store.
                    The created store is not a system store.

      /export       Export the contents of the system store into a file.
                    This file can be used later to restore the state of the system store.
                    Valid only for the system store.

      /import       Restore the state of the system store by using a backup data file
                    previously generated with /export.
                    This command deletes any existing entries in the system store before
                    the import takes place. Valid only for the system store.

      /store        This option can be used with most BCDedit commands to specify
                    the store to be used. If this option is not specified, then
                    BCDEdit operates on the system store.
                    Running the bcdedit /store command by itself is equivalent to running
                    the bcdedit /enum active command.

      /sysstore     Set the system store device. This only affects EFI-based systems.
                    It does not persist across reboots, and is only used in cases where the system
                    store device is ambiguous.

   Operating on entries in a store:

      /copy         Make a copy of a specified boot entry in the same system store.

      /create       Create a new entry in the boot configuration data store.
                    If a well-known identifier is specified, then the /application, /inherit, and
                    /device options cannot be specified. If an identifier is not specified or not well
                    known, an /application, /inherit, or /device option must be specified. 

      /delete       Delete an element from a specified entry.

      /mirror       Create a mirror of entries in the store.

   Changing entry options:

      /deletevalue  Delete a specified element from a boot entry.

      /set          Set an entry option value, e.g. bcdedit /set {bootmgr} displaybootmenu yes
                    To display the Advanced Boot Options menu without tapping the [F8] key during boot.

   List current settings:

      /enum [type | id] [/v]
                    List entries in a store.
                    Types: ACTIVE, FIRMWARE, BOOTAPP, BOOTMGR, OSLOADER, RESUME, INHERIT, ALL
                    The /enum option is the default value for BCEdit, so running
                    the bcdedit command without options is equivalent to running the bcdedit /enum active command.

      /v            Verbose mode.
                    Usually, any well-known entry identifiers are represented by their friendly shorthand form.
                    Specifying /v as a command-line option displays all identifiers in full.
                    Running the bcdedit /v command by itself is equivalent to running the bcdedit /enum active /v command.

   Controlling the boot manager:

      /bootsequence Specifies a one-time display order to be used for the next boot.
                    This command is similar to the /displayorder option, except that it is used only the
                    next time the computer starts. Afterwards, the computer reverts to the original
                    display order.
      /default      Specifies the default entry that the boot manager selects when the timeout expires.

      /displayorder Specifies the display order that the boot manager uses when displaying boot options
                    to a user.
      /timeout      Specifies the time to wait, in seconds, before the boot manager selects the default entry.

      /toolsdisplayorder  Specifies the display order for the boot manager to use when displaying the Tools menu.

   Emergency Management Services options:

      /bootems      Enable or disable Emergency Management Services (EMS) for the specified entry.

      /ems          Enable or disable EMS for the specified Operating System boot entry.

      /emssettings  Set the global EMS settings for the computer.
                    /emssettings does not enable or disable EMS for any particular boot entry.

   Debugging:

      /bootdebug    Enable or disable the boot debugger for a specified boot entry.
                    Although this command works for any boot entry, it is effective only for boot applications.

      /dbgsettings  Specifies or displays the global debugger settings for the system.
                    This command does not enable or disable the kernel debugger; use the /debug option for
                    that purpose. To set an individual global debugger setting, use the
                    bcdedit /setdbgsettings type value command.

      /debug        Enable or disable the kernel debugger for a specified boot entry.

      /hypervisorsettings  Set the hypervisor parameters.

   Undocumented:

      /loglevel level [/raw]

                 level is one of the following:
                     t  : trace (stdout)
                     i  : info (stdout)
                     w  : warning (stderr)
                     e  : error (stderr)

                 /raw   : Display extra details for the device and osdevice fields.

                 Normal display:
                 device                  partition=\Device\HarddiskVolume2
                 osdevice                partition=C:

                 With /raw
                 device                  PartEx 2800000 HD MBR Sig:151767d7
                 osdevice                PartEx 3ed200000 HD MBR Sig:151767d7

bcdboot

[edit]

Set up a system partition, repair the boot environment located on the system partition. BCDBoot can create a Boot Configuration Data (BCD) store on the system partition using the latest version of the Windows files.

Syntax
      BCDBOOT source [/l locale] [/s volume-letter [/f firmware]] [/v]
         [/vbcd] [/m [{OS_Loader_GUID}]] [/addlast] [/p] [/bcdclean [full]] [/c]

Options

   source  The location of the Windows directory to use as the source for
           copying boot-environment files.

   /l      The locale to use when initialising the BCD store. default = US English.

   /s      Optional. Specifies the volume letter of the system partition.
           This option should not be used in typical deployment scenarios.
           Use this setting to specify a system partition when you are configuring a drive that will
           be booted on another computer, such as a USB flash drive or a secondary hard drive.
           The default is the system partition identified by the firmware.

   /v      Enable verbose mode.

   /vbcd   Enable BCD Logging.

   /m      If an OS_Loader_GUID is specified, merge the given loader object within
           the system template to produce a bootable entry.
           Otherwise, by default, merge only global objects.

   /d      Preserve the existing default Windows Boot entry.

   /f      Used with /S, specifies the firmware type of the target system partition
           Options for firmware are 'UEFI', 'BIOS', or 'ALL'

           If you specify 'ALL', BCDBoot will create both the \Boot and the \Efi\Microsoft\Boot
           directories, and will copy all required boot-environment files for BIOS and UEFI.

  /addlast  Specifies that the Windows Boot Manager firmware entry should be added last.
           The default behavior is to add it first. Cannot be used with /p.

  /bcdclean Clean the BCD Store. By default, simply removes any duplicate entries in
           the BCD. Can be followed by 'full'. In this case, each entry is scanned
           If the corresponding device for that entry does not exist, the entry is deleted.

   /p      Specifies that the existing Windows Boot Manager firmware entry position should be
           preserved in the UEFI boot order. If the entry does not exist, a new entry is
           added in the first position. Cannot be used with /addlast.

           By default, during an upgrade BCDBoot moves the Windows Boot Manager to be
           the first entry in the UEFI boot order.

   /c      Specifies that any existing BCD elements should not be migrated.
           By default, during an upgrade, BCD elements such as debugsettings or flightsigning are preserved.


bootrec

[edit]
Syntax  
      BOOTREC /FIXMBR      Write an MBR to the system partition.
      BOOTREC /FIXBOOT     Writes a new boot sector onto the system partition.
      BOOTREC /SCANOS      Scans all disks for Windows installations and display entries not currently in the BCD store.
      BOOTREC /REBUILDBCD  Scans all disks for Windows installations and provide a choice of which entries to add to the BCD store.

See also

[edit]

References

[edit]
  1. ^ barrygolden. "Boot and UEFI – Windows drivers". learn.microsoft.com. Retrieved 2023-03-20.
  2. ^ de Boyne Pollard, Jonathan. "The Windows NT 6 boot process". Frequently Given Answers. Archived from the original on August 26, 2016.
  3. ^ "Boot Sequence of Windows Multi-Boot – Multibooters.com". www.multibooters.com. Archived from the original on 2024-02-27. Retrieved 2020-11-19.
  4. ^ Hudek, Ted; Marshall, Don; Graf, Eliot (23 April 2019). "Overview of Boot Options in Windows". Microsoft Docs Hardware Dev Center. Microsoft. Archived from the original on 21 April 2020. Retrieved 21 April 2020.
  5. ^ Microsoft. "Knowledge Base Article ID: 2004518". Archived from the original on 16 January 2010.
  6. ^ a b Russinovich, Mark (8 November 2011). "Fixing Disk Signature Collisions". Mark's Blog. Microsoft Corporation. Microsoft TechNet. Retrieved 5 February 2021.
  7. ^ "Why can't I edit the system BCD store via regedit?".
  8. ^ Marshall, Don. "Overview of Boot Options in Windows – Windows drivers". learn.microsoft.com. Retrieved 2023-03-20.
  9. ^ Pauly. "BOOTICE board index". Archived from the original on 2013-12-28. Retrieved 2013-12-27.
  10. ^ Bo Yans. "Visual BCD Editor".

Further reading

[edit]