配置基于UEFI的硬盘启动WinPE


Walkthrough: Boot Windows PE from a UEFI-based Hard Disk

Updated: June 22, 2011

Applies To: Windows 7, Windows Server 2008 R2

https://technet.microsoft.com/zh-cn/library/hh265131(v=ws.10).aspx

noteNote
This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

This walkthrough describes how to boot Windows® PE directly from a hard disk instead of into a RAM disk. This enables you to start a computer for the purposes of performing deployment and recovery.

These instructions are for a UEFI-based computer with an AMD64 architecture. For instructions for a BIOS-based computer, see Walkthrough: Boot Windows PE from a BIOS-based Hard Disk.

Prerequisites

To complete this walkthrough, you need the following:

How to boot a computer in UEFI mode

Different UEFI firmware implementations support different installation methods. Some EFI platforms support both UEFI and BIOS firmware. On some of those systems, it might be unclear if the default DVD boot option is an EFI or BIOS boot option. On these systems, using the EFI shell command might be required. If you do not specifically start Windows Setup by using the EFI boot entry, the default firmware boot entry for BIOS may be used. If Windows Setup starts in BIOS mode on a combined EFI/BIOS system, the ESP and MSR partitions are not created. After Windows Setup completes, use the Diskpart command to verify that the ESP and MSR partitions were created.

Sample boot instructions
  1. Insert the installation DVD or USB flash drive, and boot the computer.

  2. When the firmware starts to initialize, press the key that opens the UEFI firmware boot device menu, such as Esc.

  3. Select an EFI drive, examples: EFI DVD/CD DriveEFI USB Drive, or EFI Network Drive. You may be immediately prompted to press a key to boot from the drive to continue.

    The firmware uses the UEFI-specific boot information to boot into either Windows or Windows PE for UEFI.

If the computer does not have a Boot from EFI Drive option
  1. Use the EFI internal shell, as follows:

    1. Start the EFI internal shell from the EFI boot menu and select the drive with the Windows product DVD or Windows PE. The following example assumes that the drive is Fs0:

      Shell> Fs0:
      
      
    2. Start the EFI boot application. For an x64 system, you might run the following command: 

      fs0:> \EFI\BOOT\BOOTX64.EFI
      
      
      For an Itanium system, you might run the following command:

      Fs0:\EFI\BOOT\BOOTIA64.EFI
      
      
    3. After the application starts, you might be immediately prompted to press a key to boot from the drive to continue. Press a key to continue booting from the installation media.

    4. After the installation is complete, you can check whether Windows used the EFI boot environment by running Diskpart and verifying that the drive is formatted using the GPT file structure and that the ESP and MSR partitions are present.

Step 1: Create bootable Windows PE RAM media

Select one of topics listed below and follow the instructions for building bootable Windows PE RAM media. Ensure that you include the ImageX tool with your image. After you create your bootable media, continue to the next step.

Step 2: Prepare the hard drive

In this step, you boot the new computer with your Windows PE media and format the hard drive.

  1. On the new computer, insert your Windows PE media and restart the computer.

    Windows PE starts and launches a Command Prompt window.

  2. At a command prompt, format the hard drive by using the DiskPart tool. Windows PE requires an active partition with a size equal to or greater than the size of your Windows PE image. 

    The following example shows these commands:

    select disk 0
    clean
    convert GPT
    rem === 1. Create the EFI system partition ===
    create partition EFI size=200
    format quick fs=fat32 label=EFI
    assign letter=S
    rem === 2. Create the Microsoft reserved partition ===
    create partition MSR size=128
    rem === 3. Create the Windows PE partition ===
    rem (The partition size is set to 400 MB, though a smaller partition size may be used.)
    create partition primary size=400
    format quick fs=ntfs label=WinPE
    assign letter=C
    rem === 4. Create a Windows or data partition ===
    rem (This partition fills the rest of the disk.)
    create partition primary
    format quick fs=ntfs label=Windows
    assign letter=W
    list vol 
    exit
    

Step 3: Copy Windows PE files to the hard disk

In this step, you copy Windows PE resource files to the hard drive from your bootable media. This example assumes the hard drive is blank.

  1. If you rebooted the computer, use diskpart to verify and reassign drive letters you assigned in Step 2: Prepare the hard drive.

  2. At a command prompt, copy the \EFI folder from your bootable media to the EFI folder of the EFI system partition on your hard drive, as in the following example:

    xcopy D:\EFI\* S:\EFI\* /cherkyfs
    
    where D is the letter of your bootable Windows PE media, and S is the EFI System Partition.

  3. Copy the \Sources folder from your bootable media to the sources folder of the Windows PE partition on your hard drive, as in the following example:

    xcopy D:\sources\* C:\sources\* /cherkyfs
    
  4. Copy the \Boot\boot.sdi file from your bootable media to the \Sources folder of the Windows PE partition on your hard drive, as in the following example:

    copy D:\boot\boot.sdi C:\sources\
    
  5. Copy all of the files with an .efi extension from the \windows\boot\EFI folder of the Windows PE RAM disk to the \EFI\Microsoft\Boot folder of the EFI system partition on your hard drive, as in the following example:

    copy D:\windows\boot\EFI\*.efi S:\EFI\Microsoft\Boot\*
    
  6. Delete the boot configuration data (BCD) file that you copied from your bootable media. Note that you will create a new one in the next step, as in the following example,

    del S:\EFI\Microsoft\Boot\BCD /f
    

Step 4: Configure the System Store

In this step, you will create and configure a new system store by using the BCDEdit tool. The system store is a file named BCD that holds information required to load Windows or other boot applications. BCD replaces Boot.ini.

BCDEdit is a command-line tool that is designed to manage system stores. BCDEdit is available in Windows PE and Windows® 7.

  1. Create a new system store, as in the following example:

    bcdedit -createstore S:\EFI\Microsoft\Boot\BCD
    
  2. Create new entries in the system store for bootmgr, globalsettings, dbgsettings, ramdiskoptions, and Windows PE.

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {bootmgr} /d "Boot Manager"
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {globalsettings} /d "globalsettings"
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {dbgsettings} /d "debugsettings"
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {ramdiskoptions} /d "ramdiskoptions"
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create /d "Windows PE" -application osloader
    
    noteNote
    The last command returns a GUID value for Windows PE store.

  3. Set the default entry that the boot manager selects when the timeout expires. Substitute <GUID> with the GUID value for the Windows PE store in the following example:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD /default <GUID from Windows PE store>
    
  4. Run the following commands to configure bootmgr:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} device partition=s:
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} locale en-us
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} timeout 10
    
  5. Run the following commands to configure the boot loader:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} device ramdisk=[C:]\sources\boot.wim,{ramdiskoptions}
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} path \windows\system32\winload.efi
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} osdevice ramdisk=[C:]\sources\boot.wim,{ramdiskoptions} 
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} systemroot \windows
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} winpe yes
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} nx optin
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} detecthal yes
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -displayorder {Default} -addfirst
    
  6. Run the following commands to configure dbgsettings:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {dbgsettings} debugtype Serial
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {dbgsettings} debugport 1
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {dbgsettings} baudrate 115200
    
  7. Run the following commands to configure ramdiskoptions:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {ramdiskoptions} ramdisksdidevice partition=C: 
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {ramdiskoptions} ramdisksdipath \sources\boot.sdi
    

Your computer is now ready to boot Windows PE directly from the hard disk.

See Also

社区附加资源

添加

Gotchas

Some gotchas that I worked through over the last month.


1.  You can only boot in UEFI mode if you are using a 64bit OS.  I was originally trying to boot PE4 32bit and having no success.


2.  This article asks you to assign drive letter C to the WinPE partition.  However, if you are doing this from Windows, letter C is already taken up by your primary boot partition.  I substituted letter X for this section of the diskpart command script.  Once you do that, step 5 of bcdedit needs to have "C" changed to "X"  in the first and third lines.  Additionally, in the last step, change partition=C: to partition=X: of the bcdedit section.  If you do that, it'll boot up like a charm. 


3. You cannot do this on a USB flash drive (removeable disk).  For whatever reason, diskpart refuses to format or assign a drive letter to the EFI partition on a GPT disk.  I don't know if this is an arbitrary decisions on Microsoft's part or if there is some technical issue preventing this.  So then I tried to capture an image of the USB hard drive using Ghost or RDeploy.  They either crash or say they cannot read the efi files.  This doesn't bode well for installing Windows images in efi mode to get that faster boot up time.  I'd try imageX, but you have to create the partition ahead of time with imagex and I cannot get diskpart to work.  Guess this is a USB hard drive only thing for now.

3/13/2013

Some bios may not boot using above steps

If the bios doesn't support booting from \EFI\boot\bootx64.efi or \EFI\Microsoft\Boot\Bootmgfw.efi from Hard drive (default locations for boot files on uEFI system)


Then the above steps may not work for you.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值