olivier bloch technical evangelist microsoft …download.microsoft.com › download › b › 7 ›...

48
OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT CORPORATION

Upload: others

Post on 27-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

OLIVIER BLOCH

TECHNICAL EVANGELIST

MICROSOFT CORPORATION

Page 2: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

To gain a high-level understanding of the CE OS Build System, enabling you to leverage its features to build what you

want in the most efficient manner possible

Page 3: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers
Page 4: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Definition:A repository of build tools, build scripts, source code and pre-built binaries that enable customers to build Windows CE OS images

Page 5: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Platform BuilderPlatform Builder implements thin UI over Build SystemBuilding from Platform Builder and Build System directly are identical

Microsoft Visual Studio 2005 for Smart Devices (VSD)

Share compiler technologySmart Device apps are CE-compatible

Platform Builder & VSD share common shell

Page 6: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

VCBuildMSBuild

CE OS Build

Platform BuilderVisual Studiofor Devices

Page 7: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

What you need to build an OS image:Microsoft Source Code (Core OS & BSPs)Build toolsThird-party BSP/appsA set of build environment variablesOutput: an image file that can run on a device CE OS images

Page 8: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

The environment defines what gets built:Sysgen variables: the set of OS featuresImage variables: Kernel Dbg Support, Profiling, etc.Release directory: location of final imageProject directory: location of generated OS bitsBoard Support Platform (BSP): the hardware platformCPUDebug level: Debug, Release, ShipCoreOS: CE, PPC, SmartfonDefaults for all values except CoreOS, BSP and CPUSet of dependency trees (deptree)

Page 9: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

ManuallySet Sysgen variablesSet Image variablesSet release directoryCall build environment initialization script (Wince.bat)

From Platform BuilderChose starting configuration and BSP(s) from New Project WizardChoose features (Sysgens) from catalogChoose Image settings

Page 10: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Where Build System files physically reside:Tree root (%WINCEROOT%)Release Directory (%_FLATRELEASEDIR%) –The final location of the generated image fileProject Directory (%_PROJECTROOT%) – The location of OS-generated files. Includes SDK files.Public Folder (%_WINCEROOT%\Public) –Microsoft Public CodeDependency Definition Files ((%_WINCEROOT%\Public\CEBASE\OAK\Misc) –Define the feature granularity and dependencies

Page 11: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Build Binaries (%WINCEROOT%\Public\Common\OAK\Bin\I386 ) – The tools to build the treeBuild Scripts (%WINCEROOT%\Public\Common\OAK\Misc) - Scripts that drive buildOEM Output (%_PROJECTROOT%\Cesysgen\OAK) -The OEM binary, libraries and header filesSDK Output (%_PROJECTROOT%\Cesysgen\OAK)-The SDK binary, libraries and header filesBSP Directory (%_WINCEROOT%\Platform)

Page 12: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Common Platform Code (%_WINCEROOT%\Platform\common) Microsoft Private Code (%_WINCEROOT%\Private)

Page 13: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Build – compile and link Sysgen – link the OS DLLs, generate headersBuildrel – Copy all files needed to generate the final image to release directoryMakeimg – Generate OS image from binaries, non-binary files, BIB and REG files

Page 14: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

For each deptreeCompile PrivateCompile Public

For each deptreeSysgen

Compile and Sysgen BSP

Build Apps (PB Subprojects)

Build Release Directory Build OS Image

Page 15: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Source Code

BUILD

Static Libs & Resource

files

Build.exe compiles a tree

Page 16: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Compiled Deptree Sysgen Variables

Sysgen Phase

Custom Run-times SDK

Defined in Public\<Deptree>\Cesysgen\makefile

Page 17: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

.BIB, .REG and .DAT Files Binaries and Files

Image Flags

Makeimg Phase

Run-Time Image (e.g., .BIN)

Makeimg.exe generates final OS image

Page 18: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Blddemo.bat

Cebuild.bat

BuildRel.bat

Makeimg.exe

Cebuild.bat

Build.exe

Sysgen.bat

Sysgen.bat

Cesysgen.bat

The key batch files that are called

Page 19: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Application developerDriver developerBSP developerPublic Microsoft code-based derivatives developer

Page 20: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Compile OS

Generate Run-

times & SDK

Build BSP Build Apps

Build Image

What gets built and how to invoke

Blddemo Blddemo -q Blddemo -qbsp

Page 21: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Compile OS

Generate Run-

times & SDK

Build BSP Build Apps

Build Image

What gets built and where personas start

PublicDerivatives

All: if sysgenschanged

BSP/DriversDeveloper

ApplicationDeveloper

Page 22: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Persona CommandPublic Derivatives Blddemo

BSP Author Blddemo -qbsp

BSP Driver Blddemo –qbsp

Apps / OS Driver Blddemo –qbspOR Targeted Build & Makeimg

All: On Sysgen Change Blddemo -q

Page 23: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Blddemo Compile each deptree, sysgen OS, compile and sysgen BSP, build PB Subprojects, buildrel & makeimgUse only if doing Microsoft derivativesPersona: Microsoft derivatives developer

Blddemo clean –qClean sysgen of OS, compile and sysgen BSP, build PB Subprojects, buildrel & makeimgUse if not doing MS derivatives or public code has not changed.Persona: All

Page 24: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Blddemo –qbspCompile and sysgen BSP, build PB Subprojects, buildrel &

makeimg. Personas: All. Minimal build for BSP, Drive and App developers. Use if feature set (SYSGENs) has not changed.

Blddemo –qbsp NOMAKEIMGCompile and sysgen BSP, build PB Subprojects, buildrelPersonas: All

Blddemo –qbsp NORELCompile and sysgen BSP, build PB Subprojects

Personas: All, use to quickly build BSP and apps

Page 25: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Using callouts to extend the build system:Setting Release DirectorySetting Project DirectoryBuild System Callouts

Developer environment calloutProject environment calloutDeveloper post-buildrel calloutProject post-buildrel calloutPre-makeimg calloutPost-makeimg callout

Page 26: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers
Page 27: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Build.exeSources/Dirs-based build systemProject author defines minimal makefilesnippet to drive buildMulti-passed based build driven by XML fileNMAKE-based

Page 28: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Makefile – Includes makefile.defMakefile.def – Master makefile for all generalized build rulesSources – User-defined macros to drive compilationSources.cmn – User-defined file for common settingsSources.default – Microsoft-defined file with defaultsSources.ce – Microsoft-defined file with defaults for CE

Page 29: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Sources.%ReleaseType% - Microsoft-defined file with release directory macrosMakefile.inc – User-defined file for custom build rules

Automatically included if user defines target file macros

Page 30: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Makefile Makefile.def

Common\oak\misc\Sources.default

$(BUILDROOT)\Sources.cmn

Sources

Common\oak\misc\Sources.ce

$(_PROJECTROOT)\oak\misc\makefile.inc

Common\oak\misc\Sources.$(_ReleaseType)

Makefile.inc

Page 31: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Scans files to create DB of file-level dependencies

Stored in %BuildRoot%\build.datTraverse dirs/sources build order structureCalls NMAKE for each target file(s) for each build pass

Page 32: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

XML-driven build engine:Buildtable.xml – drives the build phaseOne set of passes per buildrootBuildroot is defined as the top level directory containing a dirs file

Page 33: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Scan CPP Files For Each Phase

Delete out of date targets

Call NMAKE to build target

Walks Dir order and builds each sources project

Page 34: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Can be auto-generated by PB wizardsMacros

SOURCESTARGETTYPETARGETNAME

Can use makefile.inc for custom build rules

Page 35: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Adding additional targets to your projectWINCETARGETFILE0

Build target that gets built firstUse pseudotargets

WINCETARGETFILES Build targets that get built lastDon’t use pseudotargets

PRELINK_PASS_CMDCallout before linkage

POSTLINK_PASS_CMD Callout after linkage

Page 36: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

#In your sources file

#Pass 0 ruleWINCETARGETFILE0=AddCopyrights

#Additional Files to buildWINCETARGETFILES=.\DropDir\myheader.h

#Pre and post link callouts.#Callouts must return zero on successPOSTLINK_PASS_CMD=mypostlink.batPRELINK_PASS_CMD=myprelink.bat

Page 37: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

#In your makefile.inc

#Make foo.idl if source or CR have changedAddCopyrights: foo.idl

Foo.idl : Raw.idl CopyrightHeader.txtcopy CopyrightHeader.txt Raw.idl Foo.idl

#Make myheader.h from source.hDropDir\myheader.h : source.h

SomeProcess source.h DropDir\myheader.h

#It a good practice to add a clean ruleCleanAll::

delete foo.idldelete DropDir\myheader.h

Page 38: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers
Page 39: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Dependency Tree (deptree)PB Subproject as a dirs directoryPB Subproject as a sources directoryBSP directory Platform/CommonMicrosoft Public directory

Page 40: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

In some case entire debug OS is too largeEnable kernel debugger in retail builds (IMGNODEBUGGER not set)Set COMPILE_DEBUG=1 in sources project

This turns off Optimizations, defines DEBUG compiler flag but builds against Retail OSCan be wrapped in WINCESHIP macro

Page 41: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

#In your sources file

#Use a ship flag to run off all Debug builds

!if “$(WINCESHIP)”==“”COMPILE_DEBUG=1!endif

Page 42: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers
Page 43: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Author and edit Smart Device Project in Visual StudioAdd VSD to OS design’s SolutionReference in sources fileAdd BIB and REG dataBuild CE OS design

Page 44: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Best practices for speeding up builds:Build on a separate drive (don’t build in system drive)Defragment drive periodicallyTurn off virus checking on build rootWindows Vista: turn off file indexing

Page 45: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

What to check in if using source controlCheck in all public Microsoft code unless doing derivativesIf doing derivatives, don’t check in \lib\* and \target\* directories under deptrees

Page 46: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

By its nature, the build is very automatable:Call Wince.bat and Blddemo.bat from scriptsBuild sources projects by calling Build.exe directlyPB OS Designs can also be built via automation

Page 47: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

Time invested in understanding the Build System will pay dividendsPut code in the proper locationsDon’t modify public code unless you have toUse the shortest build command possibleDon’t build anything you don’t have to

Page 48: OLIVIER BLOCH TECHNICAL EVANGELIST MICROSOFT …download.microsoft.com › download › B › 7 › A › B7AB2704-CF6... · Personas: All. Minimal build for BSP, Drive and App developers

© 2006 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.