The most important and difficult stage for learning a development tool is the establishment of concepts. As long as a correct concept is established and the system architecture and the role of various tools are understood, the rest of the work is the actual operation, accumulated experience, but you can check the manual when necessary.
This article guides readers through practical operations and completes a complete development step by step, so as to help readers establish a clear and clear concept.
Because the product we developed is not a common software but a dedicated operating system, we need to develop a specific hardware platform (target machine; first, a powerful workstation is required to run the development environment and development tools. Then, the development is based on the hardware configuration and software requirements of the target machine) work with the hardware of the target machine to run and test the system.
Configure development Workstation
First, introduce the development workstation, a standard PC, the hardware configuration requirements are as follows:
Windows XP Professional
PiII 500 MHz or above (1 GHz or above is recommended)
256 MB memory (512 MB recommended)
3 GB remaining hard disk space
The configuration for this PC is as follows:
Set two partitions for the hard disk
The second partition is allocated as 700 mb, which can be in FAT32 or NTFS format (this partition will contain the Windows XP embedded image that can be started)
The primary partition uses all the remaining hard disk space, which can be set to FAT32 or NTFS.
Install Windows XP Professional in the primary partition and install Windows XP embedded development tool
Modify boot. INI file, add the following code to this file, which can enable the PC to start up twice as a Windows XP Professional system for development, the developed Windows XP embedded image starts from partition 2.
Timeout = 30
Default = multi (0) disk (0) RDISK (0) Partition (1) // windows
Multi (0) disk (0) RDISK (0) Partition (1) // windows = "Microsoft Windows XP Professional"/fastdetect
Multi (0) disk (0) RDISK (0) Partition (2) // windows = "Microsoft Windows XP embeddedd"/fastdetect
Install Windows XP embedded development tool
Put CD1 in the Windows XP embedded development kit into the CD-ROM and install the xpe development tool in the following sequence in the auto run prompt:
Tools setup: Install xpe development tools (including target designer, component designer, component database manager, and other tools)
Database Engine setup: Install SQL Server 2000 desktop edition Database Engine (MSDE)
Database setup: Install component databases and repositories
Other configurations of the Development Workstation
Create an xpe_demo directory on drive C to store the configuration definition files and component definition files generated during development.
Install the tweakui sample file from the CD-ROM to C: // program files // tweakui.
This completes the preparation of the Development workstation.
Hardware Platform Analysis
During the development process, you must first run the hardware analysis program to analyze the hardware configuration of the current machine.
The operating system is closely related to the hardware. Only by fully understanding and supporting the hardware can the operating system run normally and stably. Because x86 structured computers have complex hardware, it is difficult for common developers to fully understand them. Therefore, Microsoft provides a hardware analysis tool to help developers analyze hardware.
The tool provided by Windows XP embedded is called target analyzer, which can automatically analyze the hardware information of the device. Target analyzer has two versions: ta.exeand tap.exe. After the analysis is complete, an output file named devices. pmq in XML format is generated in the same directory.
Tap.exe is a 32-bit application running on Windows XP and Windows 2000. It can run some advanced hardware detection.
Ta.exe is a 16-bit application that runs on dos. It can be used to detect systems that cannot install Windows 2000 or Windows XP, but the detection function is less powerful, some hardware devices cannot be identified.
Next, run tap.exe to check the hardware configuration of this development machine:
Go to the C: // program files // Windows Embedded // utilities directory
Run tap.exe to generate devices. pmq in the same directory.
Open the device. pmq file in a text editor. The file describes the hardware information of the target device in XML. For example, the intel 21440 Ethernet controller is described in the PCI segment.
Because we run this program on the Development workstation, devices. pmq contains the hardware information of the Development workstation.
Save hardware platform information
There are two ways to use the information in devices. pmq. One can generate
Xpe components to prepare for the future development of a complete operating system; second, you can directly import this file during development; the advantage of making the pmq file into an xpe component is that it can be used repeatedly at a time: make the xpe component and save it to the component database. It can be called by every development system.
Run component designer
Import the generated devices. pmq file and select file/impot... , The import dialog box is displayed.
Press the "Start" button to start the pmq File Import process, which takes about 10 minutes. After completion, a 'devices. sld' component, renamed it 'demo platform component'
Expand the directory structure in component designer
Windows XP embedded Client
Select devices and change the component name attribute from 'devices' to 'demo platform component'
You can set this component to 'selector prototype component'. After becoming a component of this type, you can separately select the devices associated with this component in target designer:
In the prototype column, press browse ..., The Select prototype component dialog box is displayed.
Select the database option in the prototype component source column.
Open to software/Test & developnent in the component tree list, and select the selector prototype component.
Press OK to confirm.
Select File/Save As to save the configuration as "C: // xpe_demo // demoplatform. the SLD file contains the demo platform component developed earlier, and the component designer is disabled.
. To use this component in target designer, you must first save this component to the component database:
Open component Database Manager and Start Menu // All Programs // Microsoft Windows Embedded studio // component Database Manager
Click 'import', click the Browse button in the SLD file: column, find "C: // xpe_demo // demoplatform. SLD", and click Import.
After successful import, disable component Database Manager.
Confirm work results:
Open target designer, select the file/new menu, create a new configuration, and check whether the demo platform component is in the component browser on the left of target designer. If this component is found, it indicates that the hardware analysis has been completed successfully.
Create Initialization Configuration
To construct a complete xpe system, you must first create a configuration in target designer. This configuration is just an empty development framework, then, add all hardware support components, system kernel components, and software functional components to the configuration. After adding the component, use target designer to automatically detect the association between the components and add the missing components to the configuration.
First run target designer
Select File menu
Select New to create a new Windows XP embedded configuration.
Change the configuration name to demoplatform.
In the following choose platform, select Windows XP embedded client (x86)
Click OK to create and save the configuration.
In the components list in the middle of target designer, select demoplatform. slx: modify the configuration attributes in the attribute bar on the right, and add your personal information (name, owner, author, description, etc)
Set advanced Parameters
The following are some parameters required for running the entire system:
At the top of the configuration browser, expand demoplatform. Slx and select Settings. The property settings panel on the right displays the configurable options.
Under target devices settings, Click Show to display detailed options.
Set the following configuration information:
Boot drive = C:
Windows Folder = D: // windows
Program Files Folder = D: // Program Files
Documents and Settings folder = D: // Documents and Settings
Boot arc Path = multi (0) disk (0) RDISK (0) Partition (2)
Boot partition size (MB) = 700
After the configuration is complete, save the configuration information to the C: // xpe_demo directory.
Create xpe component
Generally, each embedded device runs one or more applications of the user. In addition, if a non-generic hardware device is used, the corresponding driver needs to be added; how can we integrate these relatively independent parts of the operating system into the operating system to make it a whole? The recommended method is to make each independent part into an xpe component and integrate it in the development stage. Generally, this work can be divided into five stages:
Determine the resources and settings used by the component
Configure component resources and settings in component designer
Create a repository and add the files used by this component to this repository
Save the configuration information of this component
Import the component to component Database Manager.
The following is an example of the tweakui control panel.
Program to create an xpe component.
Open component designer.
Select the file // import menu and set the file type to setup information files (*. inf)
Select "C: // program files // tweakui. inf" and import it. Component designer can automatically generate a component based on the information in tweakui. INF.
You need to add a repository for this component. This repository is actually a system directory that contains the files required by the component. Each component with files corresponds to one or more repository, open the repositories folder in component designer.
Right-click and select "add repository" in the pop-up menu to create a repository.
Enter Tweak UI files in the name attribute of the Repository
Click the Browse button in the Source Path column and find C: // program files // tweakui.
Select the tweakui. inf component in component designer.
In the Property bar of this component, click repository.
In the select repository dialog box that appears, select the Tweak UI files project and click OK.
Finally, select the tweakui. inf component and change the component name to the Tweak UI Control Panel applet in the property settings panel on the right.
Select File/Save As and save it as "C: // xpe_demo // tweakui. SLD" to disable component designer.
At this point, the tweakui component has been created. Like the hardware information component created earlier, to use this component in the targert designer, you must first import it to the component database.
Open component database manager,
Import this tweakui component: Find "C: // xpe_demo // tweakui. SLD" and import
After the import is complete, disable component Database Manager.
Open target designer
Open the created demoplatform configuration.
Make sure that both the demo platform component and the Tweak UI Control Panel applet component are in the target designer component browser.
Unlike other components, the output file devices of target analyzer is used. the component generated by pmq is a macro component. The macro component itself does not have any function. It only has a relationship with other components; we have developed a macro component named "demo platform component", which allows you to conveniently add hardware support for Initialization Configuration.
Construct xpe system image files
By now, we have analyzed the hardware information and developed a hardware information component, developed an application component, and set up Initialization Configuration. In this section, we will complete the development of a complete configuration.
Open target designer
The first component to be added is composed of devices. the macro component demo platform component generated by the pmq file is added to the configuration; you only need to double-click the component in the left-side component browser panel of target designer to add the component to the configuration.
In the component browser, find the demo platform component and add it to the configuration.
If this component is not found, you can enter its name in the search bar for search.
Target desinger contains more than eleven thousand components. How can we find the required components? Next we will discuss the filters in the component browser.
You can find a component or a group of related components by filtering. A large number of components contained in the Windows XP embedded development kit can be easily searched through the filter.
Click the Filter button on the component browser to create a new filter.
In the filter Manager dialog box, click New.
Enter tweakui in the name column.
In the filter rule description bar, double-click the filter rule "component display name contains [sybstring]". In the Filter Editor dialog box that appears, enter tweakk
Press OK to close the Filter Editor.
In filter manager, tweak should be displayed in the avalable Filter list.
Select the tweak filter and press the apply Filter button.
In the component browser, only the Tweak UI Control Panel applet component is displayed.
Add this component to configuration
Restores the filter to the All conponents display status and displays all components.
Next, we will add the design template component to the configuration. This design template component is also a macro component and is very similar to the demo platform component; A macro component is a component that only contains the information associated with the component, and has no other functions. For example, you can associate 20 components related to the TCP/IP protocol with a macro component named TCP/IP by adding this TCP/IP macro component, you can add the 20 components at a time.
There are many ways to add components to the configuration. You can add a single component one by one. You can add macro components. You can also automatically add components through the target designer's relevance check function.
Windows XP embedded provides several template components, from a single software function, such as TCP/IP, derictx8.0 to the entire system template, such as a set-top box template, POS template, you can use one of them based on your actual application.
Add the Windows-based terminal Professional component, which can be found in the design Templates folder. In the configuration panel, expand the component and select Settings. The property panel on the right displays the main component modules of the macro component.
The next step is to add other necessary core components to the configuration. In this example, your file system is in the fat format, so you need to add the fat component.
1. You can find the fat component in the software/system/storage and file systems // infrastructure/file systems path.
2. Add the fat format component in the path of software/system // storage and file systems/applications.
3. Add the javase shell component in the software/system // User Interface // shells path.
4. Add the NT loader component in the path SOFTWARE | system // system services // base.
Finally, perform a correlation check to ensure that all necessary components have been added to the configuration.
In the configuration menu, select Check dependencies to check the component associativity. All associated components and missing components of macro components are automatically added to the configuration.
After the association check is completed, an error is prompted:
Component: "regional and language options [version 5.1.2600, r620]" requires at least one additional enabled component not in the configuration.
Target designer cannot solve this problem by automatically adding components. Because multiple components can be selected, target designer lists the components that can be selected, and developers can decide which component to add.
Select the tasks column at the bottom of target designer
Double-click the preceding entry. The target designer displays a prompt asking the developer to select the required component from multiple optional components.
In this example, select the English language support component and press the Add button. Although it is listed in other languages, it is not required.
Start Menu Options
In the Association check phase, the user interface core component is automatically added to the configuration, because the components selected by other developers require the support of this component; if you need to include the required menu in the image Start Menu, you need to set options for this component.
Select Start Menu Options:
Show control panel on Start Menu
Show my computer on Start Menu
Do not select the Start menu item:
Prohibit Access to hot keys
Prohibit Access to control panel
Finally, perform a correlation check.
Construct and test the image
In the configuration menu, select build target image... Menu item. The build dialog box appears.
Add an empty directory for saving the image to the destination column. For example, create a new empty directory test configuration under the C: // Windows Embedded images directory.
The log file must be stored in another directory. Do not store the log file in the same directory as the image file.
Press the build button to build the image. After the image is built, the following files and directories are generated under the specified directory:
If the configuration is changed after the association check is run, the target designer prompts the developer to perform another association check when building the image.
After the component is completed, the following prompt box is displayed:
In the preceding example, note that no errors is displayed, but there are two warnings. The first warning is displayed because no PID Number is entered in the configuration, the image constructed without the PID Number is a time-limited evaluation version. The second warning occurs because the Tweak UI component is included in the configuration, but this component is not a released version component, of course, this does not affect the image itself.
Close the dialog box after the structure is complete.
Copy the directories and files in the above image file directory to the root directory of drive D, because the file directory must match the settings in the previous Configuration Attribute. After the copy is complete, the directory shown in the following figure is obtained:
Save configuration information and select the Save menu item in the File menu.
Disable target designer
Restart the machine
Test xpe System
During the restart process, two startup options will be displayed, run Windows XP Professional, or run Windows XP embedded. Choose Windows XP embedded.
Boot options are controlled by C: // boot. ini. We have added the following section in Boot. ini:
Timeout = 30
Default = multi (0) disk (0) RDISK (0) Partition (1) // winnt
Multi (0) disk (0) RDISK (0) Partition (1) // windows = "Microsoft Windows XP Professional"/fastdetect
Multi (0) disk (0) RDISK (0) Partition (2) // windows = "Microsoft Windows XP embedded"/fastdetect
When xpe runs properly, you can check whether the system contains the functions we need to verify our work.
Open the Control Panel to check whether the Tweak UI control applet option is included.
Run the Tweak UI control panel program. The following dialog box is displayed:
At this point, we have completed the entire development process.
Develop XP embedded bootable CD
First, make some hardware preparations: at least one recorder and two hard disks are required. The first hard disk is the hard disk of the operating system. There is no special requirement for partitioning, but the operating system must be Windows 2000/XP/Server 2003. The second hard disk is the key to making a CD. The number of partitions on this disk cannot exceed 4, and at least 8 MB of unpartitioned space must be retained. The first partition is the primary partition, with the partition format fat16, the capacity must be smaller than the capacity of a single disc (MB or 700 mb). Based on the content in this tutorial, we can divide it into MB. All partition operations can be completed in windows. Do not go into details here. Do not forget to activate the primary partition of the second hard disk (this primary partition is called "target partition" in the following article ", the second hard disk is the "target disk" and the first hard disk is the "System Disk ").
After partitioning, copy "program bootprep.exe in C:/program files/Windows Embedded/utilities/Program" to the target area. Because this is a 16-bit program, it must be run in DOS. Restart the computer and enter the BIOS (generally press the "Del" key or "CTRL + ALT + ESC" key combination) to set the system disk to "NONE" (of course, you can also turn off the computer, remove the system disk), set the first disk to start from the floppy disk or CD (depending on the method you want to start), save and exit. Use a Win98 disc or boot a floppy disk to boot to the DOS interface, enter "C:", Press enter to enter disk C, that is, the target area, and then enter "bootprep" and press Enter, after you press "Y" twice, the target disk is set.
2. Create the "enableautolayout" component and import it.
① Open "component designer" in the Start menu, and select "file"> "new" in the open program interface to create a new "SLD" file.
② Expand the "Windows XP embedded client (x86)" directory on the left side of the window, right-click the "components" directory, and select "add component ".
③ Enter a name in the "name" area of the new window on the right, for example, "enableautolayout_settings" (Figure 3 ).
④ Right-click "registry data" in the left-side window, select "add"> "registry data", and fill in the following values in the "add component registry resources" dialog box (Figure 4):
Key name: Software/Microsoft/Windows/CurrentVersion/optimallayout
Value Name: enableautolayout
⑤ Select "default" single region, press "OK" to return to the main window, select "flie" → "save" and save it as "enableautolayout. SLD". Next, import the file to the database.
⑥ Select "component Database Manager" in the Start menu and select "import" in the "Database" tab window (figure 5 ). In the "SLD file" dialog box, find the saved "enableautolayout. SLD" file.
7. Select "import" to import the component (Figure 6). After the import, close all the dialog boxes.
3. Create the "target hardware device drivers" component and import it
① Go to the directory c:/program files/Windows Embedded/utilities/and execute “tap.exe. Soon a "devices. pmq" file will be generated in the same directory.
② Select "component designer" in the Start menu, select "flie"> "import" in the pop-up window, and import "devices. pmq file (long import time, figure 7 ).
③ After the import is complete, select "components"> "devices" on the left of the window, and fill in "My devices-Hardware" in the "name" text box in the right window (figure 8 ).
④ Click the "Browse" button next to the "prototype" column in the right window. In the displayed window, select "software"> "Test & Development"> "selector prototype component" (figure 9 ). Press "OK" to return to the main window and choose "flie"> "save" to save the file as "mydevices. SLD ".
⑤ Import "mydevices. SLD" to the database in steps 6 and 7 in step 2.
4. Create an El torito real-time running image (El torito run-time image)
① Select "target designer" in the Start menu, and select "file"> "new" in the pop-up window ", name "My XP embedded" and press "OK" (Figure 10 ).
② The Window of "target designer" is divided into four parts. The window on the left above shows a list of all components, the previously imported "enable autolayout_settings" and "my devices-Hardware" components are placed in the root directory. The "My XP embedded" system component list is displayed in the middle window. The window on the right is used to display the properties and settings window of the "My XP embedded" system component. The following large window shows the production information, including "Tasks", "messages", and "debug" labels (figure 11 ).
③ Double-click the "enableautolayout" and "my devices-Hardware" components in the left-side window and add them to the "My XP embedded" window in the middle.
④ Expand "design templates" in the left-side window and double-click the "Windows-based terminal customized Sinal" component. This component contains a basic component required to minimize XP embedded.
⑤ Expand "software" → "system" → "Storage & flie System" → "Infrastructure" → "flie systems" in the left-side window, and double-click "fat" component. Expand "software"> "system"> "Storage & flie System"> "Applications" in the left-side window, and double-click "Fat format. This step sets up a file system for running images in real time.
⑥ Expand "software" → "system" → "system services" → "base" in the left-side window ", double-click "El torito cd", "EWF ntldr", and "enhanced write filter. Expand the "enhanced write filter" component in the middle window, select "Settings", and clear the check box of "Start EWF enabled" in the right window (figure 12 ).
7. Expand "software"> "system"> "User Interface"> "shells" in the left-side window and double-click "Explorer Shell. Expand the "Windows shells" subdirectory, double-click the "user interface core" component, and select "show run on Start Menu" in the "Settings" window (figure 13 ).
Expand "software"> "system"> "management"> "Applications" in the left-side window, and double-click "EWF Manager Console Application. Expand "software"> "system"> "international"> "Infrastructure" and double-click "Chinese-simplified language support ".
After adding the component, check the result and select "configuration"> "Check dependencies" from the menu (For A Long Time ), if there is no problem, "no errors or warnings" will be reported (figure 14 ). Now you can create a real-time running image: Select "configuration"> "build target image", and set the image storage location in the pop-up window, create an image based on "build" (the image takes about MB of hard disk space, figure 15 ).
Export Open the image storage folder (default: D:/Windows Embedded images/), copy all the files and directories under it to the target area.
5. Create a pre-FBA CD
Now we can use a file in the target area to create a CD image. The CD burned with this image is called pre-fba cd, which is not the final required CD, therefore, it is recommended to burn with a CD-RW disk.
① Go to the directory c:/program files/Windows Embedded/utilities/and execute “hd2iso.exe. This is a 32-bit command line program with a text menu similar to "fdisk" (figure 16 ).
② Press the "1" key and select "create an ISO-9660/eltorito bootable image file." To enter the ISO image creation menu (figure 17 ).
③ Press the "2" key and select "set physical drive.". All hard disks on the computer are displayed, starting with "0. The target area is located in the second hard disk, so the hard disk number should be "1". Press "1" and select "//./physicaldrive1" to go back to the upper menu (Figure 18 ).
④ Press the "3" key and select "select partition (s)" to go to the partition selection menu. Press the "1" key and select "bootable, bigdos, 322 MB [not selected]". The "not selected" in the brackets is changed to "selected" (figure 19 ), then press "p" to return to the upper menu.
⑤ Press the "4" key and select "set image file path ". That is, the location where the CD image is stored. the partition of the image must have at least MB of space available. Enter the path and file name, for example, "G:/xpos. ISO (Figure 20), press enter to return to the upper menu.
6. Press "5" and select "advanced options ". Go to the Advanced Settings page (Figure 21). Only one item must be set: "specify disk signature ". Press the "2" key to enter this setting. here you need to enter a string of numbers, start "target designeras", and expand the "El torito cd" component, in its settings, there is the string of numbers we need (Figure 22 ). Enter a number and press enter to return to the upper menu. The value is automatically converted to a hexadecimal number. Press "p" to exit the Advanced Settings menu.
7. Press "6" and select "Create Image to package the ISO image" to create the CD image. This process takes a long time. After the creation, press "Q" to exit.
Mirror uses Nero burning Rom or other recording software to engrave the prepared image on the CD-RW disk, so far the "pre-FBA cd" has been completed. Because Windows cannot identify the file format in this image, the content on the optical disk is empty, but the 32-2 MB size can be displayed.
6. boot the El torito run-time image on the hard disk
After pre-fba cd is created, you can use it to guide the El torito run-time image on the target hard disk. Shutdown detach the system hard disk (or disable the system hard disk in the BIOS), set the Boot Mode to boot from the disc in the bios, and put the pre-fba cd into the CD-ROM drive. The system starts from pre-fba cd. After loading the relevant information, it transfers the "power" to the image on the hard disk to continue the boot, during this boot process, the system constantly reads information from the pre-fba cd to complete the XP embedded configuration. This process is called first boot agent (FBA ), it takes two reboots to complete. In addition, enhanced write filter (EWF) also starts to work in this phase and creates a temporary configuration partition (figure 23 ).
After entering the XP embedded interface, you need to determine the EWF status. The following operations are completed in the XP embedded system.
① Confirm the configuration of all EWF volume, Enter cmd in "start" → "run", and press enter to bring up the command prompt interface. Then click “ewfmgr.exe ". If the EWF volume configuration is correct, the EWF volume status is displayed.
② Check whether the C partition is a partition protected by EWF and enter "ewfmgr C:" in the "Command Prompt" interface. If the configuration is correct, information about protected volume is displayed.
④ Select Start> program> Windows Resource Manager ". Check whether your system includes the disk "El torito cd" (which is actually the pre-FBA cd in the optical drive, however, it is used as a disk named "El torito cd" in XP embedded) and a target area.
⑤ If the above checks are normal, you can customize more El torito run-time images, such as adding applications, the method for adding software is the same as that for installing software in WINXP. Is it very simple?
Make the final system optical disk and restore the program paietprep.exe. This tool executes the following tasks: Delete the EWF configuration partition created on the target disk during the FBA process; Switch the drive symbols of the "El torito cd" disk and target area. After this step, it cannot be started through the "El torito run-time" Image in the target area.
① Call up the "command prompt" interface, go to the "/Windows/system32" directory, and run the following command: etprep/All.
② If the operation is successful, the following text is displayed:
Deleted ewfpartitions = 1.
Swapped eltorito volume drive E: with boot volume C :.
The system automatically restarts after the “etprep.exe command is executed. Because the system cannot be booted in the target area, the computer is manually disabled after the restart. If the instance is not automatically restarted, manually shut down the instance.
8. Make the final XP embedded bootable CD
Now you can make the final system CD. This process is exactly the same as the pre-fba cd process. Follow the steps described in "5." to create the final CD image. Before burning the image to a CD, you 'd better test the image using the virtual PC software, but note that only the virtual PC software of VMware can correctly use the image, microsoft's "Virtual PC" does not work, isn't it a bit ironic (figure 24 )? After entering the system, check the system attributes, which are marked with "embedded" and the version is "2002"