in

www.xpefiles.com

Brad Combs

Windows XP Embedded tips, tricks, news, and events.
  • HowTo: Use a component script to enable boot.ini flags

    Goal: The goal of this HowTo is to use component scripting available in XP Embedded to generate a custom boot.ini with every build.

    Challenge: If the /bootlogo boot.ini flag is desired the boot.ini file must be modified after each build in Target Designer. You could also run a script during FBA to accomplish this same thing.

    Prerequisites:

    • Windows Embedded Studio Tools installed.

    Script: Much of the CMI scripting interface in the Windows Embedded Studio toolkit is undocumented. This tip is actually pulled from an update to RTM from many years ago. The update was shipped as a component and the script was still accessible (whoops! Wink). I noticed that there were a few lines in the Base Component script that created the default boot.ini. So I modified them to add our custom boot.ini flags. Copy the script below into a new file named boot.vbs

    <script>

    '////////////////////////////////////////////////////////////////////////////
    ' $Header:$
    ' Windows Embedded Boot.ini Script
    ' Version: 1.00
    ' Author: bcombs
    '////////////////////////////////////////////////////////////////////////////

    Option Explicit

    '//event fired as part of the processing of method calls on CMI objects
    Sub cmiOnEndBuild(dwFlags)

        '//Trace Enter
        Dim sProcName : sProcName = "BootLogo ::cmiOnEndBuild"
        oPL.TraceEnter sProcName '                 //oPL - global object present in Platform Script
        oPL.BootSwitches.Add "bootlogo", Empty

        '//Trace Exit
        oPL.TraceLeave sProcName

    End Sub

    </script>

    Next, open Component Designer and create a new component called MyBootLogo. Add this script under the Component Script option in Component Designer. Add a file resource to your component that points to the bitmap to be displayed at runtime. Remember, the file must be:

    1. A bitmap
    2. 16 colors (not 16 bit color!)
    3. 640x480
    4. Named boot.bmp and stored in \Windows

    Create a repository for your boot logo. Save and import the MyBootLogo component and add it to your configuration. Build the image and check in the resulting boot.ini that your flags are there.

     

  • Tip: Preparing a UFD to boot WinPE 2.0 on Windows XP

    Goal: To prepare a UFD to boot WinPE 2.0 using a Windows XP workstation.

    Challenge: Windows XP Diskpart utility does not allow UFD devices to be marked as active

    Prerequisites:

    Workround:

    1.       Insert the key into the Windows XP / 2003 system.

    2.       Note the drive letter assigned to the device.

    3.       Open a command prompt (Start -> Run -> cmd). Change directories to c:\program files\windows embedded\utilities.

    4.       Run ufdprep.exe to mark the disk as active. Type: ufdprep.exe x: /y
    Where x: is the drive letter noted in step 2.

    5.       If the disk is not already formatted NTFS (UFD disks are usually shipped as FAT32) from the command prompt type: convert x: /fs:ntfs
    Where x: is the drive letter noted in step 2.

    6.       From the Windows PE Tools Command Prompt type: .\x86\bootsect.exe /nt60 x: /force
    Where x: is the drive letter noted in step 2

    7.       The last step is to copy the Windows PE files to the device. Copy the contents of c:\winpe_x86\ISO to the USB Flash device.

    8.       Eject the USB Flash device, insert the drive into the target device and boot. Make sure the BIOS is configured to boot from USB HDD. Boot the device to Windows PE.

     

  • HowTo: Using Windows Deployment Server to deploy XP Embedded runtime images.

    Installing and configuring Windows Deployment Server for distributing XP Embedded runtime images.

    Goal:
    The goal is to provide a step by step process for installing and configuring Windows Deployment Services on a new Windows Server 2003 AS system.

    Assumptions

    ·         The Windows Server 2003 Advanced Server system meets the minimum hardware and software requirements.

    Preparing the Windows Server 2003 Advanced Server System to run Windows Deployment Services
    After installing Windows Server 2003 AS onto the target server hardware run Windows Update to ensure that all available operating system updates have been applied to the system. Next, to configure Windows Deployment Services:

    1.       Configure the server to be a domain controller in a new (or existing) Active Directory domain. A Windows Deployment Services server must be either a member of an Active Directory domain or a domain controller for an Active Directory domain. The Active Directory domain and forest versions are irrelevant; all domain and forest configurations support Windows Deployment Services.

    2.       Configure the server to run as a DHCP server.

    3.       Configure the server to run as a DNS server. This is installed by default when the server is configured as a domain controller.

    4.       Install Windows Server 2003 SP1 if necessary.

    5.       Install Remote Installation Services. Remote Installation Services (RIS) can be installed by going to Control Panel -> Add / Remove Programs -> Add /Remove Windows Components. You may be prompted for the Windows Server 2003 installation media.

    6.       Download and install the Windows Automated Installation Kit. Install using the defaults. http://go.microsoft.com/fwlink/?LinkId=81030

    7.       On the Windows Automated Installation Kit CD, run windows-deployment-services-update-amd64.exe or windows-deployment-services-update-x86.exe based on your servers’ CPU architecture.  The installer is located in the WDS folder of the CD-Rom.

    8.       Reboot the system

    9.       Open the “Windows PE Tools Command Prompt” by navigating to Start -> All Programs -> Microsoft Windows AIK -> Windows PE Tools Command Prompt. From the command prompt type: “WDSUTIL /initialize-server” to initialize the server in Native mode.

    Creating the initial Windows PE 2.0 boot image for use with Windows Deployment Server.
    After configuring the server you can add a boot image that clients will download when they connect to the server. To configure the boot image:

    1.       Open the “Windows PE Tools Command Prompt” by navigating to Start -> All Programs -> Microsoft Windows AIK -> Windows PE Tools Command Prompt.

    2.       From the command prompt type “copype.cmd  <arch> <path>” where <arch> is the architecture to support (likely x86) and <path> is the location to store the new Windows PE image. For example: “copype.cmd x86 c:\winpe_x86”

    3.       Mount the newly created Windows PE image using the imagex utility. For example: “imagex /mountrw c:\winpe_x86\winpe.wim 1 c:\winpe_x86\mount”

    4.       Add any additional packages or files to the PE image while it is mounted. For example to copy the imagex utility to the WinPE image type: “copy  c:\program files\Windows AIK\Tools\x86\imagex.exe  c:\winpe_x86\mount\Windows\System32”

    5.       Use the PEIMG utility to prepare the WindowsPE image for deployment. Type: “peimg /prep c:\winpe_x86\mount”

    6.       Use imagex to unmount the Windows PE wim image. Be sure to use the commit parameter to save the changes to the wim file. Type: “imagex /unmount c:\winpe_x86\mount /commit”

    Add the boot image to the Windows Deployment Services server machine.
    The Windows PE boot image can be added to the Deployment Server environment using the Windows Deployment Services MMC snap-in. To open the snap-in navigate to Start -> All Programs -> Administrative Tools -> Windows Deployment Services.

    To add a boot image

    1.       In the left pane of the Windows Deployment Services MMC snap-in, expand the server list, and locate the server for which you want to add the boot image.

    2.       Right-click the Boot Image node and then click Add Boot Image.

    3.       Browse to select the boot image (for example c:\winpe_x86\winpe.wim), and then click Open.

    4.       On the Image File page, click Next.

    5.       On the Image Description page, click Next to select the default name and description.

    6.       On the Summary page, click Next.

    7.       Click Finish.

    8.       Next, modify the PXE response settings on the server. Right click the server under the “Servers” node and click “Properties”.

    9.       Click the “PXE Response Settings” tab. Click the “Respond to all client computers” radio button.

    10.   Click OK to save the settings.

    11.   Optional: Remove the need to hit F12 to boot to PXE by opening the server properties dialog again as in step 8.

    12.   Click the “Boot” tab.

    13.   Under “x86 Architecture” click Browse and choose “pxeboot.n12”.

    Configuring Windows Firewall to work with Windows Deployment Services.
    Several exceptions need to be added to the Windows Internet Connection Sharing firewall on the server computer in order to allow requesting clients to connect to the server. Open the ports in the following list as exceptions in Windows Firewall.

    Service name UDP TCP
    DHCP and TFTP 67,69,4011 Not applicable
    BINL 4011 Not applicable
    NetBIOS Not applicable 139
    SMB Not applicable 445
    LDAP Not applicable 389
     

    Modifying the boot image used by Windows Deployment Server
    You can modify the boot image used by Windows Deployment Server by mounting the Windows PE WIM image file, making any necessary modifications, and unmounting the file being sure to commit the changes. This does not however automatically refresh the boot image used by Windows Deployment Services. To refresh the image used by Windows Deployment Server:

    1.       Open the Windows Deployment Services MMC snap-in. To open the snap-in navigate to Start -> All Programs -> Administrative Tools -> Windows Deployment Services.

    2.       Expand your target server node and click the “Boot Images” node.

    3.       IN the right pane right click the installed boot image that you want to refresh and choose “Replace Image”.

    4.       Browse to the updates WIM image and follow the prompts to update the boot image.

     

  • Tip: Using ImageX on Windows XP SP2

    When using ImageX on XP Professional SP2 to work with WIM files it may be necessary to install an XP QFE to enable full functionality (specifically the /MOUNT and /MOUNTRW) commands. To workaround this issue install KB914882 from here: http://support.microsoft.com/kb/914882 Also, its available on the Windows Automated Installation Kit ISO under the \Hofix directory.

  • Tip: Managing multiple XPe databases on one development machine

    Having many different customers with different databases can be tough to manage. For each database you have the entire repository folder, the database MDF, LDF and any custom components you have created for their devices. To make this job easier I keep a USB hard drive that has instances of all the databases I work with on a regular basis. Using the script below you can easily mount different databases based on which customer you are working with. This works with both MSDE and SQL Server Express 2005. Note that the script uses the current drive variable (%~d0) in the path to the databases. I did this since the USB drive letter can change from time to time. If you are using C:\ for example just replace %~d0\XPe with your path to the MDF/LDF.

     ----Begin script----

     @ECHO OFF
    Title XP Embedded Database switcher
    Color 1F
    cls
    echo *****************************************************
    echo *    Please choose an option from the list:
    echo *
    echo *    Use XPe SP1 Database = 1
    echo *
    echo *    Use XPe SP2 Database = 2
    echo *
    echo *    Exit to Command prompt = 3
    echo *
    echo ******************************************************
    set /p Input=Type in the number and hit enter  :

    if %Input% EQU 1 goto :SP1
    if %Input% EQU 2 goto :SP2
    if %Input% EQU 3 goto :CMD

    goto END

    :SP1
    REM Detach the current XPe Database
    osql -E -Q "sp_detach_db 'MantisSQLDB'"

    REM Close net share on Repositories.
    net share repositories /DELETE

    REM Attach the database
    set DBMDF=%~d0\XPe\SP1\MantisSQLDB_Data.mdf
    set DBLDF=%~d0\XPe\SP1\MantisSQLDB_Log.ldf
    osql -E -Q "sp_attach_db 'MantisSQLDB', '%DBMDF%', '%DBLDF%'"

    REM Create the share
    net share repositories=%~d0\XPe\SP1\Repositories

    Goto End

    :SP2
    REM Detach the current XPe Database
    osql -E -Q "sp_detach_db 'MantisSQLDB'"

    REM Close net share on Repositories.
    net share repositories /DELETE

    REM Attach the databases
    set DBMDF=%~d0\XPe\SP2\MantisSQLDB_Data.mdf
    set DBLDF=%~d0\XPe\SP2\MantisSQLDB_Log.ldf
    osql -E -Q "sp_attach_db 'MantisSQLDB', '%DBMDF%', '%DBLDF%'"

    REM Create the share
    net share repositories=%~d0\XPe\SP2\Repositories

    goto End

    :CMD
    goto End

    :End

    ----End Script----

    __________________________________________________________________________

  • HowTo: Using Windows PE 2.0 and Image X to deploy Windows XP Embedded

    Using Windows PE 2.0 and Image X to deploy Windows XP Embedded

    Goals

    • Create a customized Windows PE 2.0 (Vista PE) environment.
    • Create a WIM file of pre-FBA files create by Target Designer.
    • Boot to Windows PE 2.0 to deploy a new runtime image using ImageX.
    Create a customized Windows PE 2.0 environment.

    Install and configure the Windows Automated Installation Kit

     

    1.      Install the Windows Automated Installation Kit using the defaults for all setup options.

    2.      Create the default Windows PE environment using the Windows Automated Installation Kit. On the development workstation run copype.cmd to create a new PE environment (first time setup). Copype.cmd is located in c:\Program Files\Windows AIK\Tools\PETools. You need to specify the CPU architecture for the target device and the destination folder that will contain the PE files. From a command prompt type: “c:\ Program Files\Windows AIK\Tools\PETools\copype.cmd x86 c:\winpe_x86” to create the Windows PE output for any x86 platforms in the directory c:\winpe_x86.

    3.      Copy any additional support files that may be necessary to use into the Windows PE build directory. Since we will use ImageX to deploy the runtime image we need to include the necessary files in the configuration.  Copy the imagex.exe utility to the ISO. Using Explorer copy c:\Program Files\Windows AIK\Tools\x86\imagex.exe to c:\winpe_x86\iso. 


    Create the initial runtime image to deploy

    Using Target Designer, create a runtime image that includes the necessary components to support the target device. Resolve dependencies and build the runtime image. Choose Release as the Build type.  Specify c:\winpe_x86\image as the Destination for the runtime image. Leave the Log file location as the default. The image will be copied to the staging location. In a later step we will use ImageX to create a WIM image file of the contents of this directory. 

    Create the WIM image to be included with the ISO
    Using ImageX create a WIM image file that contains the pre-FBA contents generated by Target Designer. From a command prompt type: “c:\Program Files\Windows AIK\Tools\x86\imagex.exe /compress fast /capture c:\winpe_x86\image  c:\winpe_x86\iso\xpe.wim “XPe” /verify”


    Create the bootable ISO image
    1.      To create the bootable ISO, use the oscdimg.exe utility located in c:\Program Files\Windows AIK\Tools\PETools. From a command prompt type:  “c:\Program Files\Windows AIK\Tools\PETools oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c: \winpe_x86\winpe.iso” The new ISO named winpe.iso is saved in c:\winpe_x86. Create a CD or DVD from the ISO using your installed CD/DVD burning utility.

    2.      Insert the CD / DVD into the target system. Make sure the boot order in the BIOS of the system is set to boot from CD/DVD first. 

    Image the local disk on the device with the XP Embedded runtime image
    1.      From Windows PE use diskpart and format to prepare the local hard disk for the runtime image.  From the command prompt in Windows PE type:
    diskpart
    select disk 0
    clean
    create partition primary size=1024

    select partition 1
    active
    exit
    format c: /fs:ntfs  /y /v:XPe
    2.     

    Use ImageX to image the hard drive.
    D:\imagex.exe /apply d:\xpe.wim 1 c:

    Note: The partition size can be any size (in MB) within the limits of the physical hardware. If the size parameter is not specified diskpart will use the entire disk.
     

    Note: When formatting the partition after creating it with diskpart, execute a full format. ImageX errors have been reported when imaging partitions that were quick formatted.

  • HowTo: Using the Image Difference Engine to deploy XPe updates

    Using the Image Difference Engine and Image Difference Applier tools (collectively, Image Diff), you can identify and package only the changed or added files and registry keys and upgrade in the field without having to redeploy a complete Windows XP Embedded with SP2 image. Image Diff also helps to determine and package smaller upgrades, including operating system security updates and hotfixes, configuration changes, third-party application updates, and line of business data.

    First download th Image Difference Engine from the Mobile & Embedded Communication Extranet or the OEM System Builder website. For more information visit: http://msdn2.microsoft.com/en-us/embedded/aa731258.aspx 

     Create an update package using the Image Difference Engine 

    Load the source and destination operating system image on the development workstation. 
    For the purposes of this excercise we will use SDI image files that contain the source and destination runtime images. ImageDiff can perform all the necessary operations while the runtime image is offline. The “old_image” did not include the Notepad utility and the OEM Runtime Revision is 1.0. The “new_image” has the Notepad utility and the OEM Runtime Revision value is updated to 1.1. On the development workstation load the SDI files for the lab using SDILoader.1.      Click Start -> All Programs -> Windows Embedded Studio -> SDILoader. If this is the first time that SDILoader has run you will be prompted to install the image device driver. Click OK to continue.

    2.      In SDILoader Click “Add Disk” and create a new SDI file named old_image.sdi. Click Yes to create the file. Make the SDI file the size of your target runtime image (or slightly larger).

    3.      In SDILoader Click “Add Disk” and create a new SDI file named new_image.sdi. Click Yes to create the file. Make the SDI file slightly larger than the target runtime image.

    4. Use Diskmanager to partition and format the new disks. Format the disks with either NTFS or FAT32.

    *Take note of the drive letters assigned to the SDI images. We will use x: to represent the old_image and y: to represent the new_image.

    5. Copy the old runtime image files to X: and the new runtime image files (which are updated with Notepad.exe and an updated OEM Runtime Revision) to Y:  Create the update package using IDIFF.exe. 
    On the development workstation open a command prompt, change directories to the location of IDIFF.exe and type: ·         IDIFF.exe /source:x: /dest:y: /output: C:\output The output files are saved in a directory named C:\output. Inspect the idiffout.xml file to verify the changes being made to the system. 
    On the development workstation open C:\output\idiffout.xml in Internet Explorer.

    Some of the important information contained in the XML file:

    <IDIFF-Registry> contains the new RunTimeOEMRev that will be applied to the device
    <IDIFF-Files> contains the file notepad.exe that will be copied to c:\Windows\System32 on the device.

    Use the Image Difference Applier (IDA.exe) to deploy the update package 
    On the development workstation open a command prompt change directories to the location of IDA.exe and type: IDA.EXE C:\output\idiffout.xml /dest:x: /noreboot The update should be successfully applied to the runtime image on x:\. Verifying the update was successfully applied 
    To verify the update was applied to the runtime image on x: first we verify that notepad.exe exists in x:\windows\system32, and then we check the SYSTEM registry hive offline to ensure the RunTimeOEMRev was updated to 1.1. 1.      Verify the files were successfully updated. On the development workstation open X:\Windows\System32 and verify that notepad.exe is in the folder.2.      Verify the registry was successfully updated. On the development workstation open regedit. You can open regedit by clicking Start -> Run and typing regedit in the run dialog box. In regedit:
    -
    Click to highlight HKEY_LOCAL_MACHINE
    -Click File -> Load Hive
    -Browse to x:\Windows\System32\Config. Click SYSTEM then click Open.
    -In the Load Hive dialog box type temp and click ok. A new subkey below HKEY_LOCAL_MACHINE appears and is named temp.
    -Expand HKEY_LOCAL_MACHINE\temp\ControlSet001\Control\WindowsEmbedded. Click to highlight the RunTimeID subkey.
    -In the right hand pane verify that the string value RunTimeOEMRev is 1.1.
    -Important: Scroll up to the lab key again and click to highlight it. Click File -> Unload Hive. Choose yes to confirm the unload. 

     

  • The new XPeFiles.com is live

    The new Community Server driven version of the site went live last night. Email me with an questions or problems.

  • Tip: Windows Automated Installation Kit

    So, I've been writing several tutorials for an XPe training gig I'm working on with MS. Many of the tutorials have to do with installing XPe using WinPE 2.0 (Vista PE). Before now I've never really used the Windows Automated Installation Kit (WAIK) since the XP OPK already did everything I needed to do. However, after working with the WAIK for a few week I can confidently say its the way to go. Using ImageX and WinPE 2.0 I can deploy a pre-FBA image in record time. Also, ImageX works on XP (as does the WAIK toolkit) so I can still have an XP development machine but take advantage of all the Vista deployment niceties.

     Download the WAIK from MS here:
    http://www.microsoft.com/downloads/details.aspx?familyid=C7D4BC6D-15F3-4284-9123-679830D629F2&displaylang=en

     

    Posted Jul 24 2007, 10:41 PM by bcombs with no comments
    Filed under:
© 2007 www.XPeFiles.com
Powered by Community Server (Commercial Edition), by Telligent Systems