Creating an Embedded Recovery CD by Using Windows PE and SDI

 

by Kevin Otnes
Microsoft Corporation
December 2004
Applies to Microsoft® Windows® XP Embedded with Service Pack 2 and Microsoft® Windows® Preinstallation Environment (Windows PE)

Summary

This paper explains how to package Microsoft® Windows® Preinstallation Environment (Windows PE), a System Deployment Image (SDI) file, and SDI tools, to create a recovery CD. With this recovery CD, you can boot the device with Windows PE, and then restore the image on your device by installing an image from an SDI file.

With a few modifications to the process outlined in this paper, you can use Windows PE and SDI to deploy Windows XP Embedded to a device, or upgrade an existing device in the field.

Windows PE is also useful for many Windows Embedded development tasks, including bringing up devices that have no hard drive, hardware detection, and fine-tuning an image on your device. For more information, see Using Windows PE in Windows XP Embedded Development

Contents

Flowchart: Using Windows PE and SDI for Recovery, Field Upgrades, or Deployment

Introduction

Requirements

Build and Deploy Windows XP Embedded Image to Test Device

Boot and Test Until You Have a Master Image

Create an SDI File on Your Development Computer

Copy the Master Image to the SDI File/Mounted Drive

Choose Your Windows PE Options

Copy the SDI File, Windows PE, and SDIMGR.WSF Tool to a Working Folder

Create a Bootable CD

Boot the Device with the CD, and Install the Image

Duplicate Your Recovery CD, and Distribute with Installation Instructions

Network Deployment

For More Information

Flowchart: Using Windows PE and SDI for Recovery, Field Upgrades, or Deployment

Introduction

Creating a recovery CD with Microsoft® Windows® Preinstallation Environment (Windows PE) and a System Deployment Image (SDI) file allows you to boot a device regardless of the state of the operating system currently on the device, and install a recovery image. Once the recovery image is installed, you can reboot the device from the recovery image.

This recovery process does not repair individual files; rather, it installs the complete image as it was on the device when it left the factory. All existing files, data, and settings on the device, as well as any changes made since it left the factory, are replaced by the image. The recovery CD is not a method for deploying or upgrading individual components, settings, or QFEs.

Requirements

To complete the process outlined in this paper you will need the following tools and programs:

  • Microsoft Windows XP Embedded with Service Pack 2
    Provides the tools to build a Microsoft Windows XP Embedded image, and utilities for creating and installing an SDI image. Also provides a self-contained version of Windows PE that can be run from the installation disc or added to your recovery CD without modification.
  • Windows PE toolkit or OEM Preinstallation Kit (OPK)
    Provides tools to customize Windows PE, and is required for the actual recovery CD creation. To make your recovery CD bootable with Windows PE, you need to create your .iso image with the oscdimg.exe tool and include etfsboot.com, which are only available through the Windows PE toolkit or the OPK. You can obtain the Windows PE toolkit from your Microsoft Windows Embedded distributor. For more information, see this Microsoft Web site.
  • Your Windows XP Embedded image
    Provides the master image that you will include on the recovery CD. If you have not created a master image, you need to create one to deploy by means of the recovery CD.
  • Your Windows XP Embedded-based device
    Provides a device for perfecting your master image that you will include on the recovery CD, and provides a device for testing your recovery CD after you create it.
  • ISO 9660-compliant CD-burning software
    After you've created an .iso file with the oscdimg tool and ETFSboot.com file, you need to burn it to a CD using CD-burning software that is ISO 9660-compliant.

Build and Deploy Windows XP Embedded Image

The image you use for your recovery image should match the image that you installed on the shipped device.

If you are master-deploying the image, this would be the master. If you already have a master image for your device, you can skip ahead to Create an SDI File on Your Development Computer.

If you have not already created a master image for your device, you should build and deploy your image on a test device that represents your final hardware configuration. The build and deployment process generally follows this order:

  • Create a component for the target device.
  • Create a new configuration.
  • Update the configuration settings.
  • Check dependencies.
  • Build the Windows XP Embedded run-time image until there are no errors or warnings.
  • Deploy the Windows XP Embedded run-time image.

Additionally, you should include update and servicing capabilities, separate from the recovery CD. For more information, see Manage and Service a Run-Time Image and Run-Time Image Deployment Design Considerations.

For specific steps on how to build and deploy a run-time image, see Deploy a Run-Time Image and Tutorial: Building and Deploying a Run-Time Image.

Boot and Test Until You Have a Master Image

Once you have deployed the image to your device, you need to boot the device. This allows you to:

  • Complete the First Boot Agent (FBA) phase.
  • Uncover possible run-time image or boot errors.
  • Verify that your device and applications work properly.
  • Perform additional post-FBA configuration changes or customization, if needed.

Note   For mass deployment, you should reseal the device after completing FBA. This ensures that when the image is deployed, each device has a unique security ID (SID) and computer name. For more information about cloning and resealing see Cloning Overview.

Rebuild, boot, and retest until your device functions properly. Your final image should meet the following criteria:

  • The image boots successfully and runs correctly on your target device.
  • All extraneous applications have been removed – remove any internal diagnostic, testing, or debugging applications that you don't want to appear on the customer's device.
  • The run-time image has been resealed so that a new and unique SID is created on each device when the image is deployed.
  • The image is available offline on a drive accessible from your development computer. This can be a mounted SDI volume, a folder on your development computer, or a Universal Naming Convention (UNC) network path.

Create an SDI File on Your Development Computer

Use SDI to create an image of a partitioned, formatted disk on your development computer. With SDI, you create an SDI file on your computer, which will then appear as a mounted regular drive that you can add files to.

To create an SDI file

  1. On the Start menu, click All Programs, point to Microsoft Windows Embedded Studio, and then click SDI Loader.

    The Storage Device Image Loader dialog box appears.

  2. Click Add Disk.

  3. Specify a new file name, for example "recovery.sdi."

  4. Click Open, and then click Yes to confirm that you want to create the file.

  5. Specify the size of disk that you want to create to hold your run-time image, and then click OK.

    Set this to a size just larger than the total size of your master image. In most cases, you can set this to 490 MB. Depending on whether you are using a 74-minute or 80-minute CD-R, your recovery CD will hold about 650-700 MB of data. Your recovery CD will include the following:

    • Windows PE (unmodified, 154 MB; a customized version can be larger or smaller depending on your changes)
    • Your SDI file (400-490 MB)
    • SDI Manager (sdimgr.wsf, 217 KB)
    • A few small miscellaneous files (1 KB each)
    • Any other additional files you want to include outside of the image

    Given these default sizes, you may have 40 to 200 MB of free space on your disc depending on your disc capacity.

    Found New Hardware notifications appear in the Taskbar notification area for the new SDI disk and disk drives.

  6. Click Done.

To initialize the SDI file as a disk drive

  1. On the Start menu, click Control Panel, and then double-click Administrative Tools.

  2. Double-click Computer Management, and then click Disk Management.

    The Initialize and Convert Disk Wizard appears.

  3. Click Next to accept the defaults, and then click Finish to complete the wizard.

  4. In the bottom pane of the Computer Management window, locate the new disk you just created. Right-click the area where Unallocated appears, and then click New Partition.

  5. Follow the steps in the New Partition Wizard to:

    • Create a primary boot partition, using the default value.
    • Specify partition size. Accept the default value, which will be slightly smaller than the size you specified for the SDI file you created in the previous procedure).
    • Assign a drive letter. Accept the default value, or change if needed).
    • Specify the file system. Accept the default value, NTFS.
    • Format the partition by selecting Perform a quick format.
  6. Click Next, and then click Finish.

    Depending on the size of the disk, it may take a few minutes to format the drive.

  7. Right-click the new volume, and then click Mark Partition as Active.

    You should now have a drive with a drive letter, ready to receive your image.

Copy the Master Image to the SDI File/Mounted Drive

At this stage, you are using the SDI file you created as a mounted drive. It appears in My Computer as a drive, and you can add files to it. The SDI file will only be used to store your master image. After you copy the image to the mounted drive, you can dismount the drive so that it is just a file that you can move or copy.

To complete the SDI file and dismount the drive

  1. Locate the folder or drive that contains your master image (for example, C:\ ), and copy the contents of that folder to the mounted SDI disk drive you just created (For example G:\).

  2. If you get a Confirm Folder Replace dialog box, click Yes to replace the existing System Volume Information folder (on the new virtual disk) with the version you are copying from your master image.

  3. Dismount the disk from your computer in one of the following ways:

    On the Start menu, click All Programs, point to Microsoft Windows Embedded Studio, and then click SDI Loader. Select the image you want to remove, and then click Remove Disk.

    For example, click C:\recovery.sdi, and then click Remove Disk. Doing so removes it as a mapped drive. Now you can move or copy it as a file.

    -or-

    In the Taskbar notification area, right-click the Safely Remove Hardware icon to dismount the SDI file.

Choose Your Windows PE Options

Regardless of which version of Windows PE you use on your recovery CD, you must use the Windows PE Toolkit or OEM Preinstall Kit (OPK) for the final steps that precede actually burning the CD. When creating the .iso file, which is the image file of the entire CD, you must use the oscdimg tool and etfsboot.com. These are only available in the Windows PE toolkit or the OPK. Oscdimg.exe creates the .iso file, and etfsboot.com creates the CD boot sector. If you use other software to create the .iso image, the CD will not boot. Once you have created the .iso file, you can burn the CD with any software that burns an ISO-9660 compliant image.

Windows PE is available in the following two forms:

  • Self-contained version

    Windows PE is supplied on Windows XP Embedded CD-ROM Disc 1, or a separate Windows PE disc, depending on whether you have the Full Price Product or the Upgrade Product. In this form, it can be used as a boot disc to perform many development tasks. You can also include it on a recovery CD, deployment disc, or field upgrade disc, along with SDI, to enable installation and deployment of the SDI image.

    To use this version in your CD-ROM or Deployment, you will copy the entire I386 folder (the folder and folder name) from Windows XP Embedded CD-ROM Disc 1.

  • Customizable version

    You may also create your own customized version of Windows PE with a separately licensed Windows PE toolkit, or with the Windows PE tools included in the OPK.

    To create a customizable version, follow the instructions in the Windows PE Help, provided with the Windows PE toolkit and the OPK.

You can obtain the Windows PE toolkit from your Microsoft Windows Embedded distributor. For more information, see this Microsoft Web site

In either form, there are specific licensing restrictions governing the use of and redistribution of Windows PE. For more information, see the appropriate license that accompanies your version.

The following table shows how you may incorporate Windows PE with your Windows XP Embedded distribution.

Distribution Description
Recovery CD Includes Windows PE and SDI as the recovery image. Typically ships with the device to be used in the field on the physical device to reinstall the factory image.
Field upgrade CD Includes Windows PE and SDI as an image that can be used to upgrade an embedded device that has been running Windows NT Embedded, or a non-Microsoft operating system.

Requires signed 2004 version of the Field Upgrade Additional Rights Agreement (indirect) or Version 2 Field Upgrade Schedule (direct).

You can ship this disc separate from the device, so that it can be deployed in the field at the device.

Deployment CD or RIS Server Includes Windows PE and SDI for in-factory deployment. You can use these together to deploy your initial installation to an embedded device by using a deployment disc, or by using RIS Server. For more information, see Network Deployment at the end of this paper.

You can ship this disc separate from the device, so that it can be deployed in the field at the device.

Copy the SDI file, Windows PE, and SDIMGR.WSF Tool to a Working Folder

Once you have created your image file, and chosen or customized a version of Windows PE, you can assemble your recovery disc components.

  1. Create a new working folder on your development computer.

    For example, create a folder named "Working."

  2. Copy the recovery.sdi file to the Working folder.

  3. Copy Windows PE to the Working folder in one of the following ways:

    Insert your Windows XP Embedded disc 1 into your computer, and copy the following to the Working folder:

    • I386 folder
    • win51 file
    • win51ip file
    • win51ip.SP2 file
    • winbom.ini

    -or-

    Copy your custom version of Windows PE to the Working folder.

  4. Copy sdimgr.wsf from the Windows Embedded\utilities folder to the Working folder.

    For example, if C:\ is your primary drive on your development computer, then sdimgr.wsf should be located in C:\Program Files\Windows Embedded\utilities.

  5. From the I386\SYSTEM32 folder of your Windows PE disc, copy sdiaut.dll to the Working folder.

  6. Copy any additional files you need to the Working folder, such as installation instructions or additional files you want to install outside of the image contained in the SDI file.

    When you have copied all of the necessary files to the Working folder, it should look something like this:

Create a Bootable CD

Once you have all of the files together in the working folder, you can create an .iso file and burn that file to a CD. To burn the CD, you need software that burns an ISO-9660 compliant image.

Note   You must use oscdimg.exe and etfsboot.com to create the .iso file. These are only available in the Windows PE toolkit or the OPK. Oscdimg.exe creates the .iso file, and etfsboot.com creates the CD boot sector. If you use other software to create the .iso image, the CD will not boot.

To create an .iso file with the OPK/Windows PE Toolkit oscdimg utility

  1. Locate the winpe.chm help file provided with the OPK and Windows PE Toolkit.
  2. Search for the topic "Creating a Customizable Windows PE Image" and/or "Creating a Custom Windows PE CD."

Boot the Device with the CD, and Install the Image

  1. Make sure the target device is configured to allow booting from CD-ROM. Usually this is specified in the target device's BIOS.

  2. Start the target device with the recovery CD-ROM in the CD drive.

    The device starts in Windows PE and provides a command prompt, at drive X:.

  3. At the command prompt, type:

    regsvr32 sdiaut.dll
    

    This registers the SDI Manager.

  4. Change directories to the location of your SDI file, and then type:

    sdimgr.wsf recovery.sdi /writedisk:0 /yes  
    

    This tells SDI Manager to write the DISK blob from the SDI file "recovery.sdi" to the physical drive 0. The /yes switch prevents the accidental erasure of data on the drive. Otherwise, the disk writing operation erases all data.

    SDI Manager writes the image to disk, and a message similar to the following appears:

    *Writing to disk  :"\\.\PhysicalDrive0"...
    
  5. When a message appears that the writing is complete, exit Windows PE, remove the CD-ROM, and restart the computer.

  6. Test the run-time image on the device. Troubleshoot as needed until you have an image that installs from a burned CD and runs correctly.

Duplicate Your Recovery CD, and Distribute with Installation Instructions

Once you have a flawless CD, you can duplicate the CD and distribute it with installation instructions. Depending on how you intend to use the CD, your instructions should explain how to use it for recovery, deployment, or field upgrade.

Your instructions may be as simple as telling the user to insert the CD in the target device, boot, let it run its course, and remove the CD when prompted to reboot. You may want to create a batch file to automatically register the sdiaut.dll and run sidmgr.wsf. You may also want to include post-install instructions for when the device restarts in its new image.

Network Deployment

Another way to deploy your Windows XP Embedded image is to use Preboot eXecution Environment (PXE) boot technologies, RIS, Windows PE, and SDI.

After Windows PE has been customized to deploy the SDI disk image, the bootable version of Windows PE must be placed on an RIS server. This provides target devices (with PXE support) with the ability to boot Windows PE from the RIS server. Windows PE will then deploy the SDI disk to the device. This paper does not detail the process of setting up an RIS server. For more information about how to set up and configure RIS, see the RIS Installation Guide.

Using Windows PE on a RIS server requires:

  • A Windows XP product disc and a Windows PE disc of the same build number, or the self-contained version of Windows PE from the Windows XP Embedded installation discs
  • A properly configured Windows 2000 with Service Pack 2 (SP2) or later installation
  • Destination computers that have a PXE-enabled network interface card (NIC), or have a NIC that is supported by the RIS boot disk
  • Windows 2000 or later RIS Server

To install on a computer running Windows 2000 RIS server, deploy the hotfix referenced in KB article Q299541.

To create a RIS image and boot from it

  1. On the RIS server, open a command prompt and run RISetup.exe –add.
  2. When prompted for a source, point RISetup to the Windows XP product disc.
  3. Browse to the location where RISetup installed the image, such as \\Server_name\Share_name\REMINST\Setup\Language\Images.
  4. In the folder of the new image, open the I386 folder.
  5. Browse the Windows XP Embedded Service Pack 1 disc, which contains the Windows PE files, and open the I386 folder.
  6. Copy the contents of the Windows PE I386 folder into the new I386 folder that was just opened, overwriting all files if prompted.
  7. Open the Templates folder in the I386 folder that you just copied over.
  8. Open the RIStndrd.sif file in a text editor, and on the line that starts with OSLoadOptions, add the switch /minint.
  9. Copy sdimgr.wsf from the Windows XP Embedded folder on Windows XP Embedded disc 1 to the Windows PE I386\System32 folder.
  10. If you want to automate the process of laying down the SDI disk (gold.sdi), modify startnet.cmd in the I386\System32 folder.
  11. Start a RIS client, and select the operating system image that was created in Step 1. Windows PE starts.

For more Information

Using Windows PE in Windows XP Embedded Development

Microsoft Windows Embedded Purchasing Options

Manage and Service a Run-Time Image

Run-Time Image Deployment Design Considerations

Deploy a Run-Time Image

Tutorial: Building and Deploying a Run-Time Image

Cloning Overview

RIS Installation Guide