删除 BCD 和 NVRAM 中的重复固件对象

原文

On some Unified Extensible Firmware Interface (UEFI)-based computers, the firmware creates non-volatile random access memory (NVRAM) entries for local devices, such as a CD-ROM or hard disk drive when the computer boots. Bcdedit synchronizes the firmware namespace objects in NVRAM with the system boot configuration data (BCD). Bcdedit opens the system BCD store when you perform a bcdedit /set or /enum command. When bcdedit opens the BCD, it compares entries in NVRAM with entries in BCD. Entries in NVRAM that were created by the firmware that do not exist in BCD are added to the system BCD. When bcdedit closes the system BCD, any boot manager entries in BCD that are not in NVRAM are added to NVRAM. The bcdedit /import command copies all firmware namespace objects from system BCD into NVRAM.

If you perform multiple bcdedit /import operations, the NVRAM may contain multiple entries for the devices on the system, such as the CD ROM and hard disk. Multiple /import operations may result in many duplicate entries. The following command is used to enumerate the firmware namespace objects in BCD:

Copy
Bcdedit /enum firmware

The following example is similar to the output from the bcdedit /enum firmware command:

Copy
Firmware Boot Manager
---------------------
identifier              {fwbootmgr}
displayorder            {bootmgr}
                        {93cee840-f524-11db-af62-aa767141e6b3}
                        {93cee841-f524-11db-af62-aa767141e6b3}
                        {93cee842-f524-11db-af62-aa767141e6b3}
                        {93cee844-f524-11db-af62-aa767141e6b3}
                        {93cee843-f524-11db-af62-aa767141e6b3}
timeout                 2

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30

Firmware Application (101fffff)
-------------------------------
identifier              {93cee840-f524-11db-af62-aa767141e6b3}
description             Primary Master CDROM

Firmware Application (101fffff)
-------------------------------
identifier              {93cee841-f524-11db-af62-aa767141e6b3}
description             Harddisk 4

Firmware Application (101fffff)
-------------------------------
identifier              {93cee842-f524-11db-af62-aa767141e6b3}
description             Internal EFI Shell

Firmware Application (101fffff)
-------------------------------
identifier              {93cee843-f524-11db-af62-aa767141e6b3}
description             Floppy

Firmware Application (101fffff)
-------------------------------
identifier              {93cee844-f524-11db-af62-aa767141e6b3}
description             Acpi(PNP0A03,0)/Pci(1F|1)/Ata(Primary,Master)/CDROM(Entry1)

If you use bcdedit /import more than once, there might be multiple firmware objects in NVRAM and in the system BCD. If you import the BCD store from a master computer to a target computer, multiple firmware entries might exist for the same device. If multiple firmware entries exist, you will see a bcdedit /enum firmware output that contains firmware entries that are similar to the following example:

Copy
Firmware Boot Manager
---------------------
identifier              {fwbootmgr}
displayorder            {bootmgr}
                        {93cee840-f524-11db-af62-aa767141e6b3}
                        {93cee841-f524-11db-af62-aa767141e6b3}
                        {93cee842-f524-11db-af62-aa767141e6b3}
                        {93cee844-f524-11db-af62-aa767141e6b3}
                        {93cee843-f524-11db-af62-aa767141e6b3}
                        {8b87c5a0-f2f2-11db-9717-f87ee6ea6002}
                        {8b87c5a1-f2f2-11db-9717-f87ee6ea6002}
                        {8b87c5a2-f2f2-11db-9717-f87ee6ea6002}
                        {8b87c5a3-f2f2-11db-9717-f87ee6ea6002}
                        {8b87c5a4-f2f2-11db-9717-f87ee6ea6002}
timeout                 2

Two or more entries for each device with different GUIDs might exist. For example, the Primary Master CDROM might include multiple entries:

Copy
Firmware Application (101fffff)
-------------------------------
identifier              {93cee840-f524-11db-af62-aa767141e6b3}
description             Primary Master CDROM

Firmware Application (101fffff)
-------------------------------
identifier              {8b87c5a0-f2f2-11db-9717-f87ee6ea6002}
description             Primary Master CDROM

You can remove multiple or duplicate entries in the NVRAM and BCD system store by using multiple Bcdedit commands. To use the correct object GUIDs for multiple object entries that you want to remove, you might be required to manually create a command script.

To remove duplicate entries

  1. Save a copy of the current system store by using the following Bcdedit command:

    Copy
    Bcdedit /export savebcd
    

    You can use this file later for recovery purposes.

  2. Make a copy of the SaveBCD file to use for the Bcdedit delete operations:

    Copy
    Copy savebcd newbcd
    
  3. Enumerate the firmware namespace objects in the system BCD store and save the output results to a text file:

    Copy
    Bcdedit /enum firmware > enumfw.txt
    
  4. Open Enumfw.txt with Notepad.exe to view the list of duplicate GUID entries to delete. Review the list of GUID entries on the computer.

  5. Use Notepad to create a new command file. Save the file as RemoveDups.cmd.

  6. Add a command line in the RemoveDups.cmd file to delete the duplicate firmware GUIDs listed under the Firmware Boot Manager display order:

    Copy
    Bcdedit /store newbcd /delete {93cee840-f524-11db-af62-aa767141e6b3}
    

    Repeat the command for each GUID to remove. For the preceding example, add the following commands to RemoveDups.cmd:

    Copy
    Bcdedit /store newbcd /delete {93cee841-f524-11db-af62-aa767141e6b3}
    Bcdedit /store newbcd /delete {93cee842-f524-11db-af62-aa767141e6b3}
    Bcdedit /store newbcd /delete {93cee843-f524-11db-af62-aa767141e6b3}
    Bcdedit /store newbcd /delete {93cee844-f524-11db-af62-aa767141e6b3}
    Bcdedit /store newbcd /delete {8b87c5a1-f2f2-11db-9717-f87ee6ea6002}
    Bcdedit /store newbcd /delete {8b87c5a2-f2f2-11db-9717-f87ee6ea6002}
    Bcdedit /store newbcd /delete {8b87c5a3-f2f2-11db-9717-f87ee6ea6002}
    Bcdedit /store newbcd /delete {8b87c5a4-f2f2-11db-9717-f87ee6ea6002}
    

    On computers where the EFI firmware initializes NVRAM entries for local devices, you may delete all GUID entries if desired. Do not delete the entry for {bootmgr}

  7. Add a final command to RemoveDups.cmd to import the new BCD file by using the /clean option to remove all NVRAM entries as part of the import operation:

    Copy
    Bcdedit /import newbcd /clean
    
  8. Save the file and, at a command prompt, run RemoveDups.cmd to remove all duplicate entries from the newbcd store and import the newbcdstore to the system BCD.

  9. Reboot the system. During reboot, the EFI firmware reinitializes the NVRAM with the firmware object GUIDs corresponding to the devices attached to the system. Use the bcdedit /enum firmware command to verify that all duplicate firmware entries have been removed.


阅读更多
个人分类: 其他
上一篇CAN总线协议开发资料
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭