23
Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc.

Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Embed Size (px)

Citation preview

Page 1: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Dissecting the Windows CE Build Process

Dissecting the Windows CE Build Process

James Y. WilsonPrincipal Engineer, Windows Embedded MVPCalAmp, Inc.

James Y. WilsonPrincipal Engineer, Windows Embedded MVPCalAmp, Inc.

Page 2: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

AgendaAgenda

Build ArchitectureCommand Line ToolsExtending the BuildControlling the BuildBuild StrategiesBuild Scenarios (Labs)Complete Session Evaluations

Build ArchitectureCommand Line ToolsExtending the BuildControlling the BuildBuild StrategiesBuild Scenarios (Labs)Complete Session Evaluations

Page 3: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Build ArchitectureBuild Architecture

Batch FilesEnviro

nm

ent V

aria

ble

s

Sysgen Make File

Defines initial build environmentExecutes build for PUBLIC and PRIVATE treeSelects build targets through SYSGEN_ variables and knowledge of intermodule dependencies.Builds PLATFORM COMMON and BSP trees.Constructs content of release directoryCalls user defined batch files at various points in the Build and Sysgen stage.

Defines initial build environmentExecutes build for PUBLIC and PRIVATE treeSelects build targets through SYSGEN_ variables and knowledge of intermodule dependencies.Builds PLATFORM COMMON and BSP trees.Constructs content of release directoryCalls user defined batch files at various points in the Build and Sysgen stage.

Build Make Files

Page 4: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Build ArchitectureBuild Architecture

“Common Build” aka “Build”Builds Private and Public source trees (generates mostly LIB files)

“Sysgen” Assigns SYSGEN_, results in _MODULES, and _COMPONENTS variables assignment

Combines selected (_MODULES and _COMPONENTS) component LIB files into DLL and EXE modules

Filters header files, .BIB files, .REG files, etc.

Builds BSP and Platform Common trees

Builds Workspace tree

Populates RELDIR

Creates OS Image file

Essentially, everything else in the build

“Common Build” aka “Build”Builds Private and Public source trees (generates mostly LIB files)

“Sysgen” Assigns SYSGEN_, results in _MODULES, and _COMPONENTS variables assignment

Combines selected (_MODULES and _COMPONENTS) component LIB files into DLL and EXE modules

Filters header files, .BIB files, .REG files, etc.

Builds BSP and Platform Common trees

Builds Workspace tree

Populates RELDIR

Creates OS Image file

Essentially, everything else in the build

Page 5: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Build ArchitectureBuild Architecture

BldDemo.bat

CeBuild.bat

Initiates build from within command shell initialized by WinCE.bat

WinCE.bat

Establishes environment variables used globally, generates DEPTREE, loads developer and project specific environment

Enumerates DEPTREE entries, and calls CeBldTree.bat for each entry

CeBldTree.bat

If enabled builds (compiles) source tree (DEPTREE entry) in Private and Public (Common Build). Initiates Sysgen.

CeBuild1.bat

Called to build (compile) specified source tree using Build.exe

Sysgen.batCeSysgen.bat

Enumerates DEPTREE entries, and calls project specific batch file and CeSysgen.bat for each entry, in four passes (preproc, pass1, pass2, and report). Finally calls “make” to generate EXE and DLL targets.

Page 6: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Build ArchitectureBuild Architecture

SysgenPlatform.bat

Runs CeSysgen.bat (same as above), then builds Platform source tree.

BuildRel.batEnumerates DEPTREE entries, and calls BuildRel1.bat for each.

Page 7: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Make FilesMake Files

MAKEFILE: Rules referenced in Makefile.defSOURCES: Assigns variables defining source files, target type, and build optionsSOURCES.CMN: Contains common SOURCES file entries (in parent directory)._OBJECTS.MAC: List of .obj targets produced during dependency scan.DIRS: Used by Build.exe when performing dependency scan

MAKEFILE: Rules referenced in Makefile.defSOURCES: Assigns variables defining source files, target type, and build optionsSOURCES.CMN: Contains common SOURCES file entries (in parent directory)._OBJECTS.MAC: List of .obj targets produced during dependency scan.DIRS: Used by Build.exe when performing dependency scan

Page 8: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Command Line ToolsCommand Line Tools

Build.exeProcesses DIR file

Identifies dependencies, determines which files to build after scanning

Calls NMake.exe to perform compilation

CEFilter.exeProcesses @CEFILTER statements to filter out contents of build and header files for undefined SYSGEN_

PBXMLUtils.exeUsed to generate environment (variables and files) from existing PB workspace

Used during build to generate certain batch files just before execution

Build.exeProcesses DIR file

Identifies dependencies, determines which files to build after scanning

Calls NMake.exe to perform compilation

CEFilter.exeProcesses @CEFILTER statements to filter out contents of build and header files for undefined SYSGEN_

PBXMLUtils.exeUsed to generate environment (variables and files) from existing PB workspace

Used during build to generate certain batch files just before execution

Page 9: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Command Line ToolsCommand Line Tools

SysgenMake.exeUsed instead of NMake.exe when auto cloning enabled

Overrides .lib file dependencies using specially formatted environment variables

Appears to call NMake.exe after override

SysgenMake.exeUsed instead of NMake.exe when auto cloning enabled

Overrides .lib file dependencies using specially formatted environment variables

Appears to call NMake.exe after override

Page 10: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Inspecting Build ProgressInspecting Build Progress

Build.logProvides more detailed build output, including full error strings

SysgenSettings.outAllows inspection of final SYSGEN_ variables set

MakeImg.outContains output from image creation

Build.logProvides more detailed build output, including full error strings

SysgenSettings.outAllows inspection of final SYSGEN_ variables set

MakeImg.outContains output from image creation

Page 11: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Customization: Batch File HooksCustomization: Batch File Hooks

%_WINCEROOT%\developr\%USERNAME%\pblddemo.bat

Runs at the beginning of the BldDemo.bat. Could be used to retrieve files from version control

%_PROJECTROOT%\BldNuke.bat Called when “nuke” is parameter to BldDemo.bat

%_WINCEROOT%\developr\%USERNAME%\setenv.bat

Allows setting of developer specific build environment. Used for command line builds.

%_WINCEROOT%\developr\%USERNAME%\Source

Run at very end of build process to build developer specific project.

%_WINCEROOT%\developr\%USERNAME%\pbuildrel.bat

Allows release process (copying targets to RelDir) to be customized.

Page 12: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Customization: Batch File HooksCustomization: Batch File Hooks

%_PROJECTROOT%\postWinCE.bat Runs at end of WinCE.bat, project (not user) specific, another possible location for automated retrieval from version control

%_PROJECTROOT%\BldNuke.bat Called when “nuke” is parameter to BldDemo.bat

Page 13: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Directory StructureDirectory Structure

C:\WINCE500\PUBLIC\CEBASE\OAK\MISC:Contains SysGen batch files

C:\WINCE500\PUBLIC\COMMON\OAK\MISC:Contains build command batch files

C:\WINCE500\PLATFORM: Contains drivers and kernel code changes

C:\WINCE500\PBWorkspaces:Contains RELDIR, local Public tree, cloned projects

C:\WINCE500\PBWorkspaces\%_TGTPROJ%\WINCE500\%_TGTPLAT%\OAK\MISC:Contains parent CESysgen, and a CESysgen hook batch file

OAK/DDK/SDK build product folders:OAK contains platform specific modules and libs, DDK contains platform specific interface components, SDK contains Microsoft supplied platform independent, modules and components

C:\WINCE500\PUBLIC\CEBASE\OAK\MISC:Contains SysGen batch files

C:\WINCE500\PUBLIC\COMMON\OAK\MISC:Contains build command batch files

C:\WINCE500\PLATFORM: Contains drivers and kernel code changes

C:\WINCE500\PBWorkspaces:Contains RELDIR, local Public tree, cloned projects

C:\WINCE500\PBWorkspaces\%_TGTPROJ%\WINCE500\%_TGTPLAT%\OAK\MISC:Contains parent CESysgen, and a CESysgen hook batch file

OAK/DDK/SDK build product folders:OAK contains platform specific modules and libs, DDK contains platform specific interface components, SDK contains Microsoft supplied platform independent, modules and components

Page 14: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Platform Builder OptionsPlatform Builder OptionsBuild OS

“Sysgen”: Use when Public SYSGEN_ variable has changed

“Build and Sysgen”: Use when code in Public tree has changed

“Build and Sysgen Current BSP”: Use when Platform SYSGEN_ variable has changed or Platform code has changed

Build Project“Build and Sysgen Current Project”: Used when project consists of Public component or module

“Build Current Project”: Used for all Platform projects and anything else

Build OS“Sysgen”: Use when Public SYSGEN_ variable has changed

“Build and Sysgen”: Use when code in Public tree has changed

“Build and Sysgen Current BSP”: Use when Platform SYSGEN_ variable has changed or Platform code has changed

Build Project“Build and Sysgen Current Project”: Used when project consists of Public component or module

“Build Current Project”: Used for all Platform projects and anything else

Page 15: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Build StrategiesBuild Strategies

Create ALL source code in PBWorkspace and Platform (only if making BSP) treeClone (see Lab for manual cloning) to minimize changes to Platform treeTry hard to avoid changes to Public treeStrive for a Workspace only build (unless creating a BSP) to provide a greater degree of “Project Portability”

Create ALL source code in PBWorkspace and Platform (only if making BSP) treeClone (see Lab for manual cloning) to minimize changes to Platform treeTry hard to avoid changes to Public treeStrive for a Workspace only build (unless creating a BSP) to provide a greater degree of “Project Portability”

Page 16: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Build StrategiesBuild Strategies

Build without generating a new OS image and use RelDir mirroring to download changesReserve OS image generation for flashing image to targetBuild in background console window(s)Build using –M {n+2} even on uniprocessor systems for 30% to 40% enhancementBuild on XP x64, install using link in references

Build without generating a new OS image and use RelDir mirroring to download changesReserve OS image generation for flashing image to targetBuild in background console window(s)Build using –M {n+2} even on uniprocessor systems for 30% to 40% enhancementBuild on XP x64, install using link in references

Page 17: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Lab Exercise 1Lab Exercise 1

Creating a Command Line Build EnvironmentCreating a Command Line Build Environment

Page 18: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Lab Exercise 2Lab Exercise 2

Manual Cloning of a Platform Common ComponentManual Cloning of a Platform Common Component

Page 19: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Lab Exercise 3Lab Exercise 3

Manual Cloning of a Public DriverManual Cloning of a Public Driver

Page 20: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Lab Exercise 4Lab Exercise 4

Using External IDE’sUsing External IDE’s

Page 21: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

ConclusionConclusion

PBWorkspaces provides total flexibility to modify PUBLIC and PLATFORM componentsPossible to customize an OS design entirely from PBWorkspacesVarious options are provided to hook into buildAbility to maintain command line build configured from PB IDERunning multiprocessor builds saves time, more common as dual core processors proliferate

PBWorkspaces provides total flexibility to modify PUBLIC and PLATFORM componentsPossible to customize an OS design entirely from PBWorkspacesVarious options are provided to hook into buildAbility to maintain command line build configured from PB IDERunning multiprocessor builds saves time, more common as dual core processors proliferate

Page 22: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

ReferencesReferences

Visit http://www.LearningCE.com for more discussion on this topicFor a batch file debugging and command shell replacement see: http://www.jpsoft.com/

Provides single-step debugging

Compatible with default XP command shell

For information on PB install under XP x64 see: http://blogs.msdn.com/mikehall/archive/2006/04/24/582444.aspx

Visit http://www.LearningCE.com for more discussion on this topicFor a batch file debugging and command shell replacement see: http://www.jpsoft.com/

Provides single-step debugging

Compatible with default XP command shell

For information on PB install under XP x64 see: http://blogs.msdn.com/mikehall/archive/2006/04/24/582444.aspx

Page 23: Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows

Please Complete Session Evaluations

Please Complete Session Evaluations