How to Demonstrate Windows XP Embedded using Virtual PC

 

How to Demonstrate Windows XP Embedded using Virtual PC

by Mario Biazzi

Microsoft Corporation

February 2005

Applies to Microsoft Windows XP Embedded with Service Pack 2, Microsoft® Windows® Preinstallation Environment (Windows PE) and Microsoft® Virtual PC 2004.

Summary

In a presentation demonstrating Window XP Embedded's power and usability, it's common to only have a single machine available. You can use two partitions; however, you must then reboot your machine to switch from Windows XP Professional to Windows XP Embedded. In a presentation, this is not the ideal scenario.

This document describes the following procedures:

  • Using Microsoft Virtual PC to host a Windows XP Embedded image on your Windows XP Professional machine
  • Creating the Windows XP Embedded image in a single partition, using Windows PE to transfer the image

This process is similar to the process in Mike Hall's article, describing how to use Windows XP Embedded on the first partition of the virtual machine.

Contents

Creating the Virtual Machine

Preparing the Virtual Disk with Windows PE

Capturing the Hardware Information

Creating the Hardware Component

Finalizing the Component

Building Your Windows XP Embedded Image

Transferring the Windows XP Embedded Image from the Development Machine to the Virtual PC

Running Windows XP Embedded

For More Information

Creating the Virtual Machine

To create a new Virtual PC (VPC) machine, click the New button in the Virtual PC console (Figure 1).

Aa460095.xpe_vc_01_console(en-US,WinEmbedded.5).jpg

Figure 1: Virtual PC Console

A New Virtual Machine Wizard opens (Figure 2). This wizard will guide you through the steps to configure your virtual machine.

Aa460095.xpe_vc_02_newvm(en-US,WinEmbedded.5).jpg

Figure 2: New Virtual Machine Wizard

The following screenshots show the steps required to create and configure the virtual machine for the Windows XP Embedded demonstration.

Because we are creating a new operating system from scratch, choose the Create a virtual machine button. (At this point, the VPC file is not yet available.)

In the Name and location field, enter the path and file name for your project. The file will be saved with the .vmc extension. Because this is not the file storing your virtual hard disk, it will be small in size.

Aa460095.xpe_vc_04_xpe(en-US,WinEmbedded.5).jpg

In the Operating System field, choose Windows XP as the operating system for the VPC machine. Windows XP Embedded and Windows XP Professional use the same binary files.

Aa460095.xpe_vc_05_os_xp(en-US,WinEmbedded.5).jpg

Select the RAM amount for the virtual machine.

Aa460095.xpe_vc_06_ram(en-US,WinEmbedded.5).jpg

The default amount (128 MB) is sufficient; however, you can adjust the amount.

Choose the A new virtual hard disk button to create a new virtual hard disk that will store the operating system image.

Aa460095.xpe_vc_07_new_+hd(en-US,WinEmbedded.5).jpg

In the Name and location field, type the name and path for the file that will contain your Virtual PC machine's hard disk. This file will be approximately 300 MB in size.

Aa460095.xpe_vc_08_hd_path(en-US,WinEmbedded.5).jpg

Preparing the Virtual Disk with Windows PE

To prepare the Virtual Disk, you must partition the disk and then format the partition.

Partition the Disk

To start your new Virtual Machine, use the Windows PE CD (CD 1 of your Windows Embedded tools). (The Windows XP Embedded evaluation CD is available at this web site.

It is also available from a Microsoft Embedded Authorized Distributor.

To partition the disk:

  1. Type the following command from a command prompt: DISKPART

  2. Type the following commands to create the partition:

    SELECT DISK 0
    CLEAN
    CREATE PARTITION PRIMARY
    

    This creates a 16 GB partition.

  3. Type the following command to verify the partition:

    LIST PARTITION
    
  4. Type the following commands to verify that the partition is active:

    SELECT PARTITION 1
    ACTIVE
    
  5. Type EXIT to quit DISKPART.

  6. Type EXIT again to reboot Windows PE.

Format the Partition

At the command prompt, type the following command to format the new partition:

FORMAT C: /FS:NTFS /q

Capturing the Hardware Information

To develop a Windows XP Embedded image for a device, you must use the Windows XP Embedded Target Analyzer tool (tap.exe) to automatically capture the information about the hardware you want to support. Tap.exe (Target Analyzer 32 bit version) is available on the Windows PE CD in the \XPe folder.

When you run tap.exe, the resulting Devices.pmq file is created. This is an XML file containing the description of all devices identified in your hardware.

To save the results of tap.exe in the host machine, create a mapped drive from the host machine inside VPC.

  • Open a command prompt and type the following command:

    NET USE Z: \\xx.xx.xx\XPe
    

where xx.xx.xx is the IP address of your machine. The default folder is: *C:\Windows Embedded images/*

For the purposes of this article, we assume you created a share named XPe that points to this folder.

To be able to access your machine, you must configure the networking of Virtual PC. To select the Network Settings, right click the network icon in VPC's status bar and select Shared Networking (NAT) in the first adapter. For more information about networking configuration in VPC, refer to the following document: Rapid Prototyping with Windows XP Embedded. Refer to the Installing Loopback Adapter section for additional information.

If we assume that X: is the CD drive and Z: is the letter assigned to this network share, use the following command to move the TAP output to the location you want:

X:\XPE\TAP /O Z:\VPC-HW.PMQ

The following figure (Figure 3) shows the result of this process:

Aa460095.xpe_vc_09_winpe_tap(en-US,WinEmbedded.5).jpg

Figure 3: Moving the TAP output

You can now switch from the Virtual PC to your development machine and start Component Designer. From the Start menu, choose All Programs, then choose Microsoft Windows Embedded Studio.

Creating the Hardware Component

Use Component Designer to create components imported from the TAP output:

  1. From the File menu, choose Import.
  2. Select the file, VPC-HW.PMQ, which you created in the shared folder. In our example, the file can be found in the C:\Windows Embedded images/\folder.

Finalizing the Component

To finalize the component:

  1. In the configuration editor, expand the Components node in the left panel and select the new component created by the import process.
  2. Give the component a meaningful name, such as VirtualPC.
  3. From the Prototype field, click Browse (Figure 4).

Aa460095.xpe_vc_10_compdesigner(en-US,WinEmbedded.5).jpg

Figure 4: Microsoft Component Designer

In the Select Prototype Component dialog box, expand the Software/Test & Development node and select the Selector Prototype component. You can optionally select and deselect items detected in your hardware while building your image.

  1. From the File menu, choose Save to save your component. A file with extension SLD is created with your component definition.

With the component finalized, we still need to import it into the Windows XP Embedded database. Use the following procedure:

  1. From the Tools menu, choose Component Database Manager to open this tool.
  2. Select Import and choose the SLD file that you just created.

Building your Windows XP Embedded Image

You use Target Designer to build the Windows XP Embedded image. You can choose the components needed in our device from the more than 11,000 components that exist in the database.

We will start by creating a new project.

  1. From the File menu, choose New and name the project, for example VPC-XPe.
  2. Select the components you want in your image.

You should first choose the component you just added to the database, in this example, the Virtual PC component. This component addresses your hardware and brings the device drivers you will need.

You must now select the software components you want. We will use the Kiosk/Gaming Console macro component, a design template that can be found under Design Templates.

The Runtime Quick Start Helper macro, found in the Software / Test & Development node, is another component that will speed up the process. This macro component resolves most of the common component dependencies that are needed to create a Winlogon run-time image.

Next, update the settings for the User Interface Core component. Expand the User Interface Core component and select settings. The settings appear in the details pane. Select to Show Run on Start Menu, Show All Programs List on Start Menu, and any other settings you want to apply.

To build our image, press F5 to check dependencies. All necessary underlying components are added to the image.

When the Check Dependencies process finishes, press F7 build the run-time image.

Transferring the Windows XP Embedded Image from the Development Machine to the Virtual PC

We must now copy the Windows XP Embedded image from our host operating system to the Virtual PC, using the networking of VPC in the same way we created the TAP output in the shared folder.

To copy the image to the Virtual PC:

  • On the virtual machine, open a command prompt and type the following command:

    ROBOCOPY z:\ c:\ *.* /E
    

You can find the ROBOCOPY utility in the Windows Server 2003 Resource Kit Tools.

Access this tool in VPC by using the NET USE command to map to another folder. For example you can map \UTIL, a shared folder where you would have copied ROBOCOPY.EXE, from the host machine to the VPC. Type the following command:

NET USE Y: \\xx.xx.xx\Util

You can then run ROBOCOPY from the Y: drive.

Running Windows XP Embedded

After you detach the CD, your virtual machine will boot the Windows XP Embedded image. The first boot will go through the First Boot Agent (FBA) process, which builds the machine registry, enumerates the device drivers, registers all components, and so on. At the end of FBA, the machine will automatically reboot. When your machine restarts, it will be running Windows XP Embedded.

For More Information

Be sure to check this web site for the latest technical information, as well as the tutorials.

For additional technical information, review Mike Hall's article: Going Virtual II: Remote Debugging.

You can also find information in his blog.