Post on 20-Mar-2020
Optimizing Platform Builder inWindows Embedded Compact 7
Douglas Boling
Boling Consulting Inc.
About Douglas Boling
• Independent consultant specializing in Windows Mobile and Windows Embedded Compact (Windows CE)
– On-Site Instruction
– Consulting and Development
• Author
– Programming Embedded Windows CE
• Fourth Edition
Agenda
• Configuring a build machine
• Understanding Virtual Machines
• Quick overview of the build process
Building the Operating System
Basic Concepts
• Windows Embedded Compact build is “disk bound”
– Speed of compilation is limited by the speed of the storage device
– Super fast CPU isn’t much help
– Huge amounts of RAM not much help
• PB 6 and PB 7 are incompatible
– Never install them on the same machine
– Yes, I know this is very frustrating
• Know how things work
– Knowing Sysgen process allows developer to skip steps
Development Machines
• Choose Win32/Win64 depending on machine
– Win32 for PB 6, 4 GB RAM PCs
– Win64 for high RAM PCs
• When you want to use Virtual Machines
• Two physical disks
– OS disk
– Big build tree disk
• Never throw away old builds that work
– Also need lots of space when using Virtual Machines
Build Setup
• Use at least 2 physical disks
– Primary drive: OS and apps
– Data drive: Big disk with build tree (d:\wincexxx)
• Keep paths 8.3, AK build tree drive letters c: or d:
– Make data drive BIG
• Keep old builds around
• Keep old release directories
Win32 vs Win64
• Windows Embedded CE 6 Platform Builder
– Doesn’t support Win64
• Generally works but subtle breaks in some tools
• These may have been fixed over the years but still unsupported.
• Windows Embedded Compact 7 Platform Builder
– Supports Win32 and Win64
• In both versions
– Old CEPC “Bldr” bootloader won’t build under Win64
• Requires DEBUG.EXE script that won’t run under Win64
Build Speed Tweaks
• Builds take lots of time
– Best if you can avoid building
– But when you do, here are some things that help…
Build Setup (Hard Disk)
• Faster disk == faster builds
– Good:
• At least 7200 RPM
– Better:
• RAID disk (RAID 0 with backup)
– Best:
• Solid State Disk (SSD)
• Enable multi-processor builds
– Set BUILD_MULTIPROCESSOR=0
• Counter intuitive environment variable
Build Setup: Temp Directory
• Reassign TEMP and TMP directory defaults
– Default TEMP and TMP assignments slow
– Good: Reassign to c:\temp
Temp Dir to RAM Disk
• If Win32 system, use a RAM Disk
– Find a good RAM disk on Web
• Gavotte Ramdisk with GUI
– www.mydigitallife.info/2007/05/27/free-ramdisk-for-windows-vista-xp-2000-and-2003-server/
– Supports large disk sizes, any FAT and NTFS
– No need to reboot after install or disk resize
– Installs as R:\
Build Setup (Virus Software)
• Turn off virus checking for build tree
– X:\wincexxx
– %temp% directory or %temp% drive
• Turn off virus checking for build tools
– Build.exe
– cl.exe
– link.exe
– nmake.exe
– Others, if you notice them…
Using Virtual Machines
• Enables multiple Platform Builder installations
– Different instance in each VM
• Need a PC with lots of RAM
– Each VM requires as much RAM free as is set in the VM
– PB needs around 1.5 MB
• Enable Ethernet controllers for KITL
• Enable integration features
– Allows access to host machine hard disks
Virtual Hard Disk Setup
• Use a differencing virtual hard disk
– Bases new hard disk images off previously created core disk
• On Base disk, install
– OS
• Activate OS in base image
– Visual Studio 2005 (for CE 6)
– Visual Studio 2008 (for WEC 7)
– Other standard apps you prefer
• Create differencing disk and install PB on top of base disk
Setting up Base Virtual Machine
• Windows 7
– Open Virtual PC folder from Start Menu
– Select Create Virtual Machine
– Select name of the Virtual PC
– Set RAM to 1.5 MB or greater
– Select Create a dynamically sized virtual hard disk
– Install the base OS
– Start the image, enable auto-update and update OS
– Once complete, shut down VM and mark base disk read only
• Never open the base VM again
Checklist for Base Disk
• Install all your generic apps
– Activate any software necessary
• Be sure to turn on Windows Update to add all fixes
• Configure the shell the way you like it
• Shut down the VPC (not hibernate/suspend)
• Mark the disk as read only
Differencing Virtual Hard Disk
• Create new Virtual Machine
– Open Virtual PC folder from Start Menu
– Select Create Virtual Machine
– Select name of the Virtual PC
– Set RAM to 1.5 MB or greater
– Select “Differencing Disk”
– Point to base disk image
The Build Process
• Operating system built before BSP (Platform)
• Builds are fairly independent of each other
• Only rebuild entire system if catalog changes
• BSP changes can be done
– “Build current BSP and subprojects”
• Makeimg only necessary if changing low level files
– Otherwise, new files can be pulled down via KITL
• If modules listed in “Release Directory Modules” list
Command Line Builds
• Building from the Command Line is the most flexible
• Command line configured via environment variables
– IMGNOKITL, BSP_NOxxx, etc.
• Only way to know the environment variables is to examine the BSP
– Platform.reg/bib and various SOURCES files
– Learning these is the key to understanding the build
3 Ways to Open a Build Window
• IDE method:
– Use Build | Open Build Release Directory in Build Window
• In the Explorer Shell
– Navigate to \wince600\OSDesigns\<design>\<design>
– Right click on <design>.pbxml file
– Select “Open Build Window” menu item
• Command line method
– Change directory to \wince600\OSDesigns\<design>\<design>
– Type: PBOpenBuildWindow.exe <design.pbxml>
• Platform Builder bin directory must be in path
Environment variable use
• Build environment tracks many environment variables by their existence, not their value
• Example
– IMGNOKITL=1 Asserted condition
– IMGNOKITL= Non-asserted condition
• Don’t do this
– IMGNOKITL=0 This is the asserted condition
• As always, there are exceptions
– WINCEDEBUG=debug, WINCEDEBUG=retail, WINCEDEBUG=checked
Summary
• A tuned build machine can save time
• Understand how to create differencing virtual hard disks
• Understand the build process
Questions…
Doug Boling
Boling Consulting Inc.
www.bolingconsulting.com
dboling @ bolingconsulting.com