XP Embedded
New notes from 2007: xpembedded2.htm
|
Feature |
Status |
|
Purchase an embedded development kit. |
|
|
Create a Preinstallment Environment disk that allows partitioning disks, copying disks, copying flash, and contains target analyzer. |
|
|
Develop a flash method of development. This allows booting from CD-Rom and copying the OS image from the flash to the hard drive. |
|
|
Develop a dual boot network method of development. This allows booting from one partition, and copying the OS image from the network to the other partition. |
|
|
Create a list of devices on target PC by running target analyzer. |
|
|
Make components for missing drivers. |
|
|
Create a minimal target image by creating a target designer project with automatic logon and security. This does not allow network, usb, copying files, registry editing, device manager, control panel, etc. |
|
|
Create a development/service target image by creating a target designer project. |
|
|
Get CAN and DIO drivers working. |
|
|
Minimize Windows user interface
|
|
|
Make application components including all required files and registration to run. |
|
|
Decrease boot time
|
|
|
Allow booting from flash |
|
|
Design the application. Special consideration should be given to:
|
|
|
Manufacturing / Service
|
|
I currently have a Realtek ICPMB-8660 from IEI that has been used for some development. It contains an embedded compact flash socket.
The flash method of deployment that we use is:
The network method of deployment is:
Most likely there may be two different types of XP disk image, one for use during development, and one for the end product. The one for development or service that would allow copying using explorer, and the end product may boot directly to the final application.
A free trial version of the XP embedded development kit can be downloaded from Microsoft. This can be downloaded by going to http://msdn.microsoft.com/embedded/windowsxpembedded/default.aspx and going to the “How to Buy” page. The download file is XPEFFI.exe. The product code is JX4Q2-PHJ7Y-VMRG6-CR6FY-F973Y.
The first thing to do is to find what hardware is on the target embedded platform.
One option may be to use BartPE to make a bootable CD-Rom that includes the target hardware analyzer program, TAP. I found this method to be very easy.
The Microsoft way to make a bootable recovery disk is shown here.
Target analyzer can also be run by booting using the standard OS. Windows PE will result in a smaller device set, although it cannot copy to USB flash. It may be possible to manually remove devices if the standard OS was used.
Steps for running Tap and saving the target hardware configuration.
Importing the devices.pmq file may give, “Could not find a driver for …”.
For the RealTek I get this for:
Some examples are:
Could not find a driver for Multimedia Audio Controller (PCI\VEN_8086&DEV_24D5&SUBSYS_4740414C&REV_02).
Could not find a driver for Ramdisk [ QSoft ] (ramdriv).
Could not find a driver for Hardware Device: STORAGE\Volume (STORAGE\Volume).
For how to make components, see:
http://msdn.microsoft.com/embedded/community/community/tips/xp/thrdprty/default.aspx
http://msdn.microsoft.com/embedded/community/community/tips/xp/compo/default.aspx
Booting the created disk image os will also generate a setupapi.log:
dev 8169, 24d3, 24d5, 2572 reports:
#W157 Default installer failed. Error 0xe0000228: There are no compatible drivers for this device.
For Realtek I got the following missing drivers
|
Device Name |
Device ID |
Full Name |
How to find full
name |
|
Sys Mng Bus controller |
PCI\VEN_8086&DEV_24D3&SUBSYS_24D28086&REV_02\3&13C0B0C5&0&FB |
Intel(R) 82801EB SMBus Controller - 24D3 |
Found by searching internet for full device number |
|
Audio controller |
PCI\VEN_8086&DEV_24D5&SUBSYS_4740414C&REV_02\3&13C0B0C5&0&FD |
AC’97 Audio Codec ALC650 |
From Realtek ICPMB-8660 specs |
|
VGA controller |
PCI\VEN_8086&DEV_2572&SUBSYS_25728086&REV_02\3&13C0B0C5&0&10 |
Intel 865GV + ICH5 |
From Realtek ICPMB-8660 specs |
|
Ethernet controller |
PCI\VEN_10EC&DEV_8169&SUBSYS_816910EC&REV_10\4&1F7DBC9F&0&50F0 |
Intel 82540 ethernet controller, realtek rtl8110S |
From Realtek ICPMB-8660 specs |
|
Ramdisk |
|
|
|
|
Storage |
|
|
|
VEN_8086 = Intel
VEN_10EC = Surecomm?
To find SLD files for drivers, search:
Searched the internet for rtl8110S and Intel 865 GV and downloaded drivers:
|
Device |
File name |
Download Location |
|
internet controller |
xp-rtlnic(621)(0516).zip |
http://www.realtek.com.tw/downloads/downloads1-3.aspx?lineid=1&famid=4&series=2003072&Software=True |
|
video |
win2k_xp1413.zip or intel_82xxx_graphic_controllers_182.zip |
|
|
audio |
Wdm_a374.exe |
http://www.realtek.com.tw/downloads/dlac97-2.aspx?lineid=5&famid=12&series=8&Software=True
|
|
bus |
Infinst_autol.exe or infinst_autol.zip or Infupdate5_299.zip |
An example of making a “Realtek AC97 Audio driver” sld is at:
http://www.xpefiles.com/viewtopic.php?p=1932&sid=59a83daf43b325cdd460cc24f307548c
A Microsoft MSDN article “Creating a Component from an INF File” is at:
http://msdn2.microsoft.com/en-US/library/aa940231.aspx
Use target designer for these steps. Some of these steps should only be used for a service deployment.
Minimal Deployment
1. Component Designer steps
1. Create a RealTek component for the missing drivers and add to the component database.
2. Create a custom shell component and add to the component database.
2. Target Designer steps
1. Do the steps in Running Target Designer at least to import the devices.pmq.
2. Add standard windows components: NT Loader, FAT, English Language Support components. Optionally add NTFS, NTFS Format, & FAT Format components.
3. Add Windows Logon or minlogon. Use minlogon instead of winlogon if security is not needed. Set Winlogon properties to remove welcome screen.
4. Add the application Shell and application components
5. Disable keyboard shortcuts like Ctl-Alt-Del?
6. Add USB UI? This is only useful if some app can copy to/from.
7. Add OpenGL.
8. Select the video driver (Intel 82865) Settings, and change the screen resolution. Add PNP (user-mode) to allow setting a screen resolution.
3. Adding User Account Security
1. Add “User Account”. Select it for details, and press the Advanced button. cmiUserGroup: 1=administrator, 2=power user, 3=user, 4=guest. Do this once for each pre-defined user.
2. Add Automatic Logon and select settings. Set user to startup user.
4. Set drive location and disable startup screen
1. Click on the top level item in target designer to display the details. Click the advanced button, and set the drive and ArcPath settings if booting from drive D. Disable Windows startup screen by adding /NOGUIBOOT to arcpath of boot.ini. Modify the boot.ini for dual boot systems.
Full Deployment
See “Security Considerations for Windows XP Embedded Developers” to decide between minlogon, etc.
The first boot agent will run once during the first install of the os on the target machine. I have read that it is best to do this on the hard drive first to prolong the life of the flash. This is because FBA does a lot of registry updating.
Have to use ETPREP?
\Windows\ Setup Api.log?
Many times the Realtek PC will not boot from CD-Rom unless
all other boot devices are disabled. The other way is to cause a delay by
entering setup (press
If the network drivers are loaded, use the following to map a network domain drive.
Map network drive, folder = “\\machine\dir”. Change user to group \username or username@group. After logging in to the machine, then it is possible to map a drive to a PC in the network domain.
It would be nice to have a program that would copy only changed files to flash. It would prolong flash lifetime and increase the speed to copy. Alternately we may be able to use the network to copy the boot image.
To copy from the flash to the target machine:
To see which drive is the flash, and which is the hard drive, simply do a dir command and look at the disk size. The following shows how to delete the old os on the C drive, and copy the flash to the C drive.
1. rd \ /s /q
2. xcopy d: c: /e /h /v
Start the Component Designer. In Component Designer, use File New to create a new sld project.
Create an Application
Component
Create a AppRepository directory and copy the application files into this directory. Create an App repository that points to this directory.
Create an application component. Right click on Files and add the application files.
For Application
Components
For the Destination (destination path), use %16422%\company\app\bin. Right click on Group Memberships and add to the Software/Applications/OEM group.
Updating a Component
into the Database
Select Tools and run Component Database Manager. Push the import button to import the SLD file. Make sure to start the Component Database Manager while no other tools are running. If an error happens during reimporting, then delete the repository in the Windows Embedded Data directory.
Using Components in
Target Designer
Then use Target Designer to add the application component.
To find dependencies
Many modules need to be "registered" on a computer before they will work. This includes most ActiveX controls, OCXs, COM components, ATL components, Visual Basic components, and many others. These types of modules are usually registered with REGSVR32.EXE or something similar. For the most part, REGSVR32.EXE loads your DLL, calls GetProcAddress for the DLL's DllRegisterServer function, then calls that function. A common failure is when your DLL relies on another DLL that is missing or not registered. If you just open your DLL in Dependency Walker (depends.exe), you may or may not see a problem, depending on the type of registration failure.
The best way to debug a module that fails to register is by opening REGSVR32.EXE in Dependency Walker rather than your DLL. Then choose to start profiling (F7). In the profiling dialog, enter the full path to your DLL in the "Program arguments" field. For "Starting directory", you may wish to enter the directory that the DLL resides in. Check the options you wish to use and press Ok. This will run REGSVR32.EXE and attempt to register your DLL. By actually running REGSVR32.EXE, you can see more types of runtime errors.
If REGSVR32 returns an error of 80070005, then the access rights to the registry are most likely not set correctly. The administrator account may need to be used in some way to set up the registry.
If the target system is dual bootable, it is possible to boot on one OS on disk, and upgrade the other. It is also possible to load a service OS that can be used to diagnose the other OS.
· BartPE with WinXP/Sp2 requires enabling the dcomlaunch plugin "RpcSS needs to launch DComLaunch Service first - SP2 only".
· Use DiskPart on BartPE to delete an existing partition, and repartition the disk with a 20GB partition and a second partition with all remaining space. The extended partition will contain one logical partition.
· Reboot, then format the disks as FAT32 or NTFS
· Edit the boot.ini file
[boot loader]
timeout=10
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Embedded" /fastdetect
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP Embedded" /fastdetect
Target Designer
FBA will crash during the install on drive D:, unless the following is used.
1.. In Target Designer, choose your configuration.
2.. Choose Advanced.
3.. In the Advanced Configuration Settings dialog box, change the values
for the following settings to reflect the drive where your run-time image
will be installed:
a.. cmiTargetWinDrive
b.. cmiTargetProgramFiles
c.. cmiTargetDocsAndSettings
4.. Leave the cmiTargetBootDrive value set to drive C.
For example, if you want your run-time image installed on drive D but
you
want to boot your run-time image on drive C, you would make the following
changes:
a.. Set cmiTargetBootDrive to drive C
b.. Set cmiTargetWinDrive to D:\Windows
c.. Set cmiTargetProgramFiles to D:\ProgramFiles
d.. Set cmiTargetDocsAndSettings to
D:\DocumentsAndSettings
Some tasks done here.
1. Remove Start Bar, start without shell application. (Shell customization) Follow the shell customization guidelines for XPE.
2. Replace the boot splash screen.
3. Disable Windows startup/shutdown screens (Windows is starting up/Windows is shutting down).
Replacing the Boot
Splash Screen
Use the /bootlogo switch to have Windows XP or Windows Server 2003 display an installable splash screen instead of the standard splash screen. First, create a 16-color (any 16 colors) 640x480 bitmap and save it in the Windows directory with the name Boot.bmp. Then add "/bootlogo /noguiboot" to the boot.ini selection.
Limiting Startup and
Shutdown Messages
I found that one way to completely eliminate Windows messages is to use the AutoLogon component, and to disable the friendly logon switch in the “Windows Logon” component.
In addition, the following may have to be done: Add the following registry key to Target Designer to limit startup and shutdown messages. Use View/Resources and view Extra Registry Data to display registry entries.
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system], "DisableStatusMessages". Set this dword value to "1" and reboot.
Also add:
[HKEY_USERS\.DEFAULT\Control Panel\Colors\], “Background”. Set this to “0 0 0” or something else.
For more info, see http://www.mp3car.com/vbulletin/archive/index.php/t-51635.html.
HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon
Changing Desktop Wallpaper
This isn’t needed if the background color is set as above. In Target Designer, use View/Resources to add extra registry data.
If you want to put the registry data into a component, open your component in Component Designer, add a Component Build Order Dependency on "Windows API - User". This will ensure that your component is built after the default wallpaper registry entries are set.
http://www.mcse.ms/archive230-2005-1-1355717.html
HKEY_USERS\.DEFAULT\Control Panel\Desktop\Wallpaper = path to bmp
HKEY_USERS\.DEFAULT\Control Panel\Desktop\TileWallpaper = 2 (2=stretch)
Hiding Build Version
I found that if a white background (wallpaper) is used, that the build version isn’t visible.
If it really must not be displayed, search for “hide build number xp”.
Run TWEAKUI.EXE > General > Show Windows version on
desktop.
You can download this tool with the Windows XP Powertoys at
http://www.microsoft.com/windowsxp/pro/downloads/powertoys.asp.
If you run a Preview edition you may not be able to remove this
information.
Debugging Registry
Keys on Other Partition
To debug registry keys on the other partition, use:
Run REGEDT32. Select
HKEY_LOCAL_MACHINE. Choose
File\LoadHive ... guide it to any of the registry files on the old
system (they are: all of the NTUSER.DATs and, in system32\config, DEFAULT,
SECURITY, SYSTEM, SOFTWARE, and SAM)
Preventing Password
Expiration
There is a file on xpefiles.com that can be loaded as a component. Then simply include the component into target designer.
Available debug logs are:
Setupapi.log
Ntbtlog.txt
Fbalog.txt
Event log
Userenv.log
I had multiple major time delays during the boot process with a minimal build. I did not have much success with logs to find the problems.
· The missing PNP component caused a 60 second delay.
· The missing Event Log component caused a 30 second delay. With Service Pack 2, this now shows up when the “Administration Support Tools” component is missing.
· There was a hang when using a custom shell in wlnotify.dll. The screen displayed “Loading your personal settings”. This was resolved by triggering the “msgina: ShellReadyEvent” event.
This can show different information while booting, but may still not narrow down the problem.
Go to the key:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System
Create a new DWORD value called "verbosestatus" and set it to
"1".
Make sure that if there is a value with the name "DisableStatusMessages", that it is not present or contains 0.
The FBA log in the windows/fba directory will display some boot errors.
Originally the boot logo screen was displayed for more than 60 seconds. An error “Settings not found!” was in the fba log file. Once PNP (user-mode) was installed, then the error was removed, and the logo screen was displayed for just a few seconds.
In setupapi.log, there is still errors 0x80040154 for activeds.dll (in Active Directory Service) and userenv.dll (in Primitive:userenv). This means that there are missing dependencies, but they have not been found yet, and may not be needed. To find which component contains a file, create a filter under Tools/Filter Manager. You may have to lower the visibility in Tools/Options/Advanced to find the component. You can also download xpetools. It contains a dependency manager tool that can loaded into the database, and then can be inserted into target designer. It will filter for files listed with certain dependencies. This will not find components that were designed without proper dependencies.
The event log viewer can be used to open an event log on another partition. Use Action/Open Log File to do so. The event files have an extension of .evt. The registry keys for the event log are under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog.
To debug the boot, press F8 while the ROM BIOS is starting. Then select the item to enable boot logging. This will create a file called %SystemRoot%\Ntbtlog.txt.
By default, if your XPe device has a NIC installed and networking has been added to the target image, DHCP will be enabled. If your device is not connected to a DHCP server, then your target device may be stalling at boot due to a DHCP timeout. Either connect your target to a DHCP server or assign your target a static IP address to resolve this problem.
You may also use /SOS switch in boot.ini to see what
drivers get loaded
and what slows down the boot. Also, sometimes /BOOTLOG switch is also
helpful. Add “/noguiboot /sos /bootlog” to boot.ini and remove /bootlogo.
You can modify the boot.ini on your target to send
out debug messages via serial -- add the following flags to your XPe boot
option:
/debugport=COM1 /baudrate=115200
Download bootvis from any location, and run on target machine by specifying “bootvis -on boot”. This can be done by booting the system into cmd, and then running bootvis. To view the created file on some system, use bootvis filename. This requires that DbgHelp.dll is in Windows\System32.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon = path to cmd.exe
BootVis is not supported by Microsoft anymore. I imagine this is because too many unknowledgeable customers tried to use it on their home systems, and Microsoft didn’t want to support them.
http://www.microsoft.com/whdc/system/sysperf/fastboot/default.mspx
Currently on the minimal system, I get the error:
Failed to create a link to bootvis.exe in the windows startup group.
I tried adding regedit, and this did not solve the problem.
"Safe Mode" crashes. It is not supported in the current version of XPE. It is supposed to be in later.
Change the log level in:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup\LogLevel
This can be set to:
0x00006060 timestamped messages
0x0000FFFF very verbose
This key can be set in the target designer under View/Resources.
For a doc that describes this key:
A file called setupapi.doc that describes the log can be downloaded from Microsoft.
http://www.neowin.net/forum/lofiversion/index.php/t316422.html
From “How to enable user environment debug logging in retail builds of Windows”.
Use Registry Editor to
add or to modify the following registry entry:
Subkey:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
Entry: UserEnvDebugLevel
Type: REG_DWORD
Value data: 10002 (Hexadecimal)
Set UserEnvDebugLevel to 0x00030002 for most verbose logging.
Note that the file will not be written unless a directory is created. The directory is
“%Systemroot%\Debug\UserMode\”
There are two disk formats that we would probably use.
The following works for the Realtek board.
Using Compact Flash (CF) with the Enhanced Write Filter (EWF)
It is possible to use the OS security and support user logon by using the LogonUser function and ImpersonateLoggedOnUser functions.
When a crash occurs, the application could automatically restart like Explorer.
It is possible and usually desirable to write the application without going through XP logon screens.
Low Security
Some applications may not require a user to log on. But network access may be restricted.
High Security
High security may require using NTFS and may require logging into a domain.
Quick Boot
Use two power buttons using sleep mode. See “Finding and Eradicating Big Footprint” at the Microsoft web site. See Boot Speed.
Use ExitWindowsEx to exit Windows.
It seems like xcacls can be used to set NTFS directory rights, but it is limited in what privileges it supports.
To only allow admin or users:
"%ProgramFiles%\resource kit\xcacls" data /P Administrators:F;F Users:F;F /Y
"%ProgramFiles%\resource kit\xcacls" logs /P Administrators:F;F Users:WE;WE /Y
Or to only change users:
"%ProgramFiles%\resource kit\xcacls" data /X /P Users:F;F /Y
"%ProgramFiles%\resource kit\xcacls" logs /X /P Users:WE;WE /Y