Windows XP Embedded

Unlike Windows CE, XP embedded does not handle device drivers for you.  The drivers for all of your hardware devices, or at least a minimal set of them, need to included in your kernel for it to work.

 

Device Drivers

There 3 methods to obtain needed drivers for XP embedded.  The best way to make sure you have the correct drivers for your hardware is to run ta.exe or tap.exe on your target machine.  Ta.exe makes a basic image, whereas tap.exe will find around 10 times as many devices.  They are in the Program Files-> Windows Embedded->utilities folder.  Both will create a map of your hardware and produce a file named devices.pmq.  Now open target designer and open the menu file->import.  Now import the .pmq file you created and add the component into your build. 

This will add all of the device drivers for your recognized hardware.  It may take a few minutes to import the .pmq file.

 

However, target designer may not include all of the files you need, or you may not be able to run ta.exe or tap.exe.  To include custom (non-included) drivers into target designer, use component designer.  Windows XP embedded can use normal Windows XP drivers.  Import the .inf file into component designer, file->import.  Once you import the file a menu you pop up, run through it on auto and when it finishes save the file (.sld).  Now import that into target designer by running the component database manager.  Click import and select the .sld file.  Your device driver file will automatically be sorted into the list of drivers in target designer, so if you created and import an audio driver it will be under hardware->devices->sound,video, and game controllers.  It will retain the name of the .inf file.

The third option is to use generic drivers if no others can be acquired.  These can be found in the left window in target designer.

 

Building the image

One of the nice features of this software is the auto dependence revolver.  Add the applications that you want to your design then click the box with the check, this is check dependences.  Whatever files you need will be added automatically, however when there is a choice you must specify an error will be generated.  Click on each message in the tasks pane and choice which component meets your needs.  Once everything needed is included and there are no dependence errors you can build the image.  Click the hammer button to build the image; this may take a few minutes.  All the necessary files will be placed in your Windows Embedded Images folder.  Copy these to your bootable drive and everything should work.  The end of this page contains instructions on how to make a disk bootable from Jon Fincher at Microsoft.



 

Needed for booting

To use format and fdisk either attach the drive that is to be used to a DOS machine and use its format and fdisk, or use a DOS boot disk that has format.exe and fdisk.com (which can be taken from a DOS lab machine).  Type “format /?” or “fdisk /?” in DOS without the quotes for help with syntax.

 

            Deploying a Windows XP Embedded Runtime

 

Submitted by: Jon Fincher, Microsoft

 

Deploying a Windows XP Embedded runtime to your device can be very easy, but there are a few tips to help you avoid the pitfalls. For clarity, I'm using "deploying an image" to mean moving the runtime image to the device and booting the runtime on that device; and for simplicity, I'll use a standard integrated device electronics (IDE) hard drive as our boot media. There are a few things you should keep in mind when deploying the image.

 

There some easy things to check on your own:

 

    * Make sure the partition you're booting from is formatted FAT or FAT32.

    * Make sure the partition is active (use FDISK to verify or change this).

    * Make sure the boot partition (usually the C:, or the first partition on the first hard drive) has a valid Windows XP boot sector.

    * Make sure the boot partition has the necessary Windows XP boot files (these are NTLDR, NTDETECT.COM, and BOOT.INI).

    * Make sure the BOOT.INI has the proper ARC path pointing to the location of the system files.

    * Make sure the system files are where you said they'd be in the form they need to be.

    * Make sure the configuration knows where to put the files.

    * Make sure the system contains the necessary drivers to support booting.

 

The first two are rather easy to check on your own, but they cause some problems if you're not thinking of them.

 

You can put a valid Windows XP boot sector on your boot drive using the BOOTPREP.EXE utility shipped with Windows XP Embedded Beta 2. It is located in the \Program Files\Windows Embedded\utilities folder—if it's not there, use Add/Remove Programs to modify your Windows XP Embedded Client Tools installation and select the Boot Preparation utilities. There is a README associated with the tool that gives full usage information and some typical usage scenarios.

 

If you do not properly specify the boot ARC path during build, the BOOT.INI will not have the proper path to your system. I won't repeat information on ARC pathing here—query the KB or MSDN® for information on "BOOT.INI" or "ARC paths" for more information on how to properly construct ARC paths.

 

Obviously, if the ARC path is correct, then the system files better be there—what you need to make sure doesn't happen is long filename (LFN) conversion to DOS 8.3 names. There are Microsoft and third-party tools to help you preserve LFN's when copying using operating systems that don't support them. The best way to effect a copy is to install the embedded system in the development machine, then copy the files over in the native Windows 2000 or Windows XP operating system. You can also copy them over a network. There are also third-party tools to enable LFN network copying on devices that are floppy booted.

 

Of course, you need to make sure the system files have the proper components to support booting. The easiest way to ensure this is to use TAP.EXE to discover the HW on your machine. However, if you have to run TA.EXE, or are adding components by hand, you may be missing crucial components. The list of components necessary varies from machine to machine, but the minimum you need are a BIOS component (Standard PC, for example—found under Hardware:Computers in Target Designer) an IDE controller (specific to your hardware), the Primary IDE Channel and Secondary IDE Channel components, and the Disk Drive component. This last one is tricky, as there are three Disk Drive components in the Windows XP Embedded database. Inspect the Properties of each component, and look at the Advanced Properties. You want the component with the "cmiPnPDevID" property value of "GenDisk".

 

You also need to make sure you set the target drive properties in the configuration to point to the proper locations. Highlight the configuration (top node in the Configuration Editor tree), then click Advanced in the Details pane. There are four properties to set:

cmiTargetBootDrive     Where the system will boot from (usually C:)

cmiTargetWinDir          Where the \Windows folder will be located

cmiTargetProgramFiles             Where the \Program Files folder will be located

cmiTargetDocsAndSettings       Where the \Documents and Setting folder will be located

 

If these are not set properly before building your image, you will have problems booting and problems during the First Boot Agent sequence.

 

If you are booting from one partition (say C:) but running the system from another (say D:), your runtime image on the development machine will have a DriveD folder containing the system files, while the root contains the necessary boot files. Make sure the contents of these folders get copied to the correct drives.

 

Obviously, this might not solve for all boot issues, but running through these items should help you troubleshoot boot problems more quickly.

 

These tips are for informational purposes and are provided only as a convenience. The entire risk of use or results in connection with the use of these tips remains with the user.

 

***************************************

Microsoft Windows XP Embedded       

BootPrep Usage

 

To use the BootPrep commands, type the following syntax in a command prompt.

 

BootPrep [/dDrive] [/mMBRBackupFileName]

[/bBackupFileName] [/y] [/r] [/iExternalDataFile]

 

Parameters

 

/dDrive

    Uppercase drive letter without the colon (:), for example, /dC. The default is the C drive.

/mMBRBackupFileName

    Name of file for MBR sector backup, for example, /mmbr.old. If /m is specified with no file name, no backup is created, which is the default behavior.

/bBackupFileName

    Name of file for PARTITION BOOT sector backup, for example, /bbootrec.old. If /b is specified with no file name, no backup is created. The default file is Bootrec.old.

/iExternalDataFile

    Name of file containing data for the new PARTITION BOOT sector. The default is to use internal data.

/r

    Read-only mode. Save output for MBR and BOOT sectors to their backup file locations.

/y

    Answers "Yes" to all questions. Use this parameter with caution.

 

Example

 

The following code sample shows a typical syntax.

 

A:\>BootPrep

 

This example copies the PARTITION BOOT sector of the C drive to A:\Bootrec.old, and then replaces it with a new PARTITION BOOT sector using internal data. The new boot sector is in read/write mode.

******************************************