Windows Embedded CE 6.0 build process


When you build an OS image, there are a number of utilities that run in order to produce the final result: the process is quite complex and long (although you can save sometime, see  here). The following stuff is a raw list of which batches and applications are run when you build an OS image, somehow ordered by calling and with some notes about the tasks performed by the single batch/application

Throughout the paragraphs there are some environment variables; as an example to clarify where they are located on your PC, let’s imagine they are set as:

_PROJECTOAKROOT=D:\Work\ReleaseWorkspace\zypad\Wince600\WL1100_ARMV4I\oak
 _PROJECTROOT=D:\Work\ReleaseWorkspace\zypad\Wince600\WL1100_ARMV4I
 PBWORKSPACE=D:\Work\ReleaseWorkspace\zypad\zypad.pbxml

BLDDEMO.BAT

  • call %_WINCEROOT%\developr\%USERNAME%\pblddemo.bat if it exists
  • if %_BLDDEMO_NUKE% (nuke command line option) call %_PROJECTROOT%\BldNuke.bat
    and %_PRIVATEROOT%\bat\BldNuke.bat if they exist
  • if %_BLDDEMO_CLEAN% (clean/noclean command line option) clean
    %_PROJECTROOT%\cesysgen and %_PLATFORMROOT%\cesysgen
  • * if %_BLDDEMO_CLEANPLAT% (cleanplat/nocleanplat command line option) clean
    %_PLATFORMROOT%\target
  • if they exist, delete
    %_PROJECTOAKROOT%\PBPreSysgenCustomBuildActions.bat,
    %_PROJECTOAKROOT%\PBPreSysgenProjects.bat,
    %_PROJECTOAKROOT%\PBPostSysgenCustomBuildActions.bat
    %_PROJECTOAKROOT%\PBPostSysgenProjects.bat
  • if %PBWORKSPACE% (i.e. a .pbxml file for the workspace exists), create the
    PB project specific directories calling ‘pbxmlutils /createfolders’;
    create PB project specific build files calling
    ‘pbxmlutils /generatebuildfiles %_PROJECTOAKROOT%’.
    if they exist, call %_PROJECTOAKROOT%\PBPreSysgenCustomBuildActions.bat
    and %_PROJECTOAKROOT%\PBPreSysgenProjects.bat
  • call CEBUILD.BAT with all the relevant command line parameters
  • if %PBWORKSPACE% call, if they exist,
    %_PROJECTOAKROOT%\PBPostSysgenCustomBuildActions.bat and
    %_PROJECTOAKROOT%\PBPostSysgenProjects.bat
  • if not %_BLDDEMO_NOREL% (rel/norel command line option) call BUILDREL.BAT
  • if not %_BLDDEMO_NOMAKEIMG% (makeimg/nomakeimg command line option)
    invoke MAKEIMG saving the output to %_FLATRELEASEDIR%\makeimg.out
  • call %_PROJECTROOT%\oak\misc\CESYSGEN.BAT then save SYSGEN_ variables to
    %_FLATRELEASEDIR%\SysgenSettings.out

CEBUILD.BAT

  • for each entry in %_DEPTREES% call CEBLDTREE.BAT with preproc option (if ‘-q’ is not specified in BLDDEMO.BAT command line)
  • for each entry in %_DEPTREES% call CEBLDTREE.BAT with postproc option (if ‘-q’ is not specified in BLDDEMO.BAT command line)
  • call SYSGENPLATFORM.BAT %_TARGETPLATROOT% preproc
  • call ‘CEBUILD1.BAT platform’ %_PLATFORMROOT%\common
  • call ‘CEBUILD1.BAT platform’ %_PLATFORMROOT%\%_TGTPLAT%
  • call SYSGENPLATFORM.BAT %_TARGETPLATROOT% postproc
  • if exists %_WINCEROOT%\developr\%USERNAME%\Source invoke BUILD in this
    directory

CEBLDTREE.BAT

  • call ‘CEBUILD1.BAT public’ on the specified project
  • call SYSGEN.BAT on the specified project

SYSGENPLATFORM.BAT

  • call %_PROJECTROOT%\oak\misc\CESYSGEN.BAT. Default CESYSGEN.BAT file for
    project will invoke %_PUBLICROOT%\cebase\oak\misc\cesysgen.bat
  • invoke NMAKE preproc or postproc in the specified platform directory.
  • Default makefile for platform will include:
    $(_WINCEROOT)\public\common\cesysgen\CeSysgenPlatform.mak: this makefile
    will set ‘DUMMY’ for TARGETTYPE, etc and will call CEFILTER on
    %_TARGETPLATROOT%\FILES\platform.* . The output files will be put in
    %_TARGETPLATROOT%\CESYSGEN directory

CEBUILD1.BAT

  • invoke BUILD on the specified project

 SYSGEN.BAT

  • call %_PROJECTROOT%\oak\misc\CESYSGEN.BAT. Default CESYSGEN.BAT file for
    project will invoke %_PUBLICROOT%\cebase\oak\misc\cesysgen.bat
  • for each subdirectory in %_WINCEROOT%\public\common\oak\lib\%_CPUINDPATH% (i.e.
    localized resources files) call BLDLIST.BAT which will simply add the locale
    to %{{{__LANGIDLIST}}}%
  • if invoked with ‘preproc’ options:
    set COREDLL_COMPONENTS=%COREDLL_COMPONENTS% %COREDLL_REPLACE_COMPONENTS%
    set COREDLL_COMPONENTS=%COREDLL_COMPONENTS% %COREDLL_REPLACE%
    set COREDLL_REPLACE_COMPONENTS=
    set COREDLL_REPLACE=
  • invoke nmake with the makefile of the specified project

CESYSGEN.BAT

  • calls each %_DEPTREES% batch with the ‘preproc’ command line option to clear
    project specific environment variables
  • calls each %_DEPTREES% batch with the ‘pass1’ command line option to add
    project specific modules according to SYSGEN variables
  • calls each %_DEPTREES% batch with the ‘pass2’ command line option to perform
    actions on the project which can depend on other project settings (rarely
    used: see wceshellfe.bat for an example)

BUILDREL.BAT

  • check if %_TGTPROJ%.bif %_TGTPLAT%.bif %_TGTCPU%.bif exist in %_FLATRELEASEDIR%
    if they do not exist, it means that the configuration changed from the
    latest build.
  • if requested, clean %_FLATRELEASEDIR%
  • create the ‘flag files’ %_TGTPROJ%.bif %_TGTPLAT%.bif %_TGTCPU%.bif
  • delete %_PROJECTOAKROOT%\files\PBUserProjects.* if they exist
  • generate PBWorkspace localization and project files calling
    ‘pbxmlutils /generatebuildrelfiles’
  • for each entry in %_DEPTREES% call BLDREL1.BAT
  • call BLDREL1.BAT platform
  • call BLDREL1.BAT platformcommon
  • call project specific buildrel if it exists (%_PROJECTOAKROOT%\pbuildrel.bat).
  • call platform builder specific buildrel if it exists
    (%_PROJECTOAKROOT%\pbpostbuildrel.bat).
  • call developer specific buildrel if it exists
    (%_WINCEROOT%\developr\%USERNAME%\pbuildrel.bat)

BLDREL1.BAT

  • copy various files from project directory to %_FLATRELEASEDIR%

MAKEIMG

  • call %_WINCEROOT%\public\common\oak\misc\pbpremakeimg.bat which
    deletes %_PROJECTOAKROOT%\PBPreMakeImageCustomBuildActions.bat and
    %_PROJECTOAKROOT%\PBPostMakeImageCustomBuildActions.bat.
  • calls pbxmlutils /generatemakeimgfiles %_PROJECTOAKROOT%
  • calls %_PROJECTOAKROOT%\PBPreMakeImageCustomBuildActions.bat
  • call %_FLATRELEASEDIR%\PreMakeImg.bat if it exists
  • run fmerge * nls
  • run fmerge * txt
  • run cenlscmp to create wince.inf
  • call %_FLATRELEASEDIR%\PreFmergeBib.bat if it exists
  • run fmerge * bib to create ce.bib
  • call %_FLATRELEASEDIR%\PostFmergeBib.bat if it exists
  • call %_FLATRELEASEDIR%\PreFmergeReg.bat if it exists
  • run fmerge * reg to create reginit.ini
  • call %_FLATRELEASEDIR%\PostFmergeReg.bat if it exists
  • run regcompr on reginit.ini to create the image registry files
  • call %_FLATRELEASEDIR%\PreFmergeDb.bat if it exists
  • run fmerge * db to create initdb.ini
  • call %_FLATRELEASEDIR%\PostFmergeDb.bat if it exists
  • call %_FLATRELEASEDIR%\PreFmergeObj.bat if it exists
  • run fmerge * obj to create initobj.tmp from .dat files
  • call %_FLATRELEASEDIR%\PostFmergeObj.bat if it exists
  • run txt2ucde on initobj.tmp to create the UNICODE file initobj.dat
  • run res2exe on the localizable executable modules
  • call %_FLATRELEASEDIR\preromimage.bat. This file is copied from
    %_WINCEROOT%\PUBLIC\CEBASE\OAK\FILES and it performs the following
    actions:

    • for each entry %f in %_DEPTREES% call %f-preri.bat if it exists;
    • if it exists, call %_TGTPLAT%-preri.bat
  • run romimage on ce.bib to create the binary image

 

Posted in Windows Embedded CE, Windows Embedded Compact | Leave a comment

It’s been so long…


…Since I wrote the latest post on this blog. The reason is quite simple: I’m no longer working so hard on Windows Embedded, I’m typically busy with system engineering, project management and other esoteric disciplines. Every now and then, anyway, it happens to get back in time and do something related to my old job. Guess what? Maybe I’m getting older but I realize that I do no longer remember all the things I knew when I was hands-on on a daily basis… Thus, I’m going to post something again, just to have a place where, at least, I can find some… annotations…

Posted in Personal | Leave a comment

Customizing Dialog Boxes and Message Boxes for Headless Systems 2/2


In the previous post we left the following question open: what if you want to link coredll to your own library with customized message and dialog boxes instead of the ‘standard’ messagedialogboxcustomize? Here’s the answer (or at least one of the possible ones):

  1. Create an empty subproject in your OS design using the ‘WCE static library’ template: we’ll call the project ‘mymessageboxcustomize’
  2. Modify the sources file changing RELEASETYPE to OAK
  3. Copy the _WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\MESSAGEDIALOGBOXCUSTOMIZE\messagedialogboxcustomize.cpp file to the subproject folder and add it to the subproject itself
  4. Build it and verify that you get mymessageboxcustomize.lib in $(_PROJECTROOT)\oak\lib
  5. Modify the %_PROJECTROOT%\oak\misc\cesysgen.bat file so it looks like
@echo off
call %_PUBLICROOT%\cebase\oak\misc\cesysgen.bat %*
REM Add our custom message box implementation
if not "%COREDLL_REPLACE_COMPONENTS%" == "" set COREDLL_REPLACE_COMPONENTS=mymessageboxcustomize %COREDLL_REPLACE_COMPONENTS%
if "%COREDLL_REPLACE_COMPONENTS%" == "" set COREDLL_REPLACE_COMPONENTS=mymessageboxcustomize
REM Remove "messagedialogboxthunk" from %COREDLL_COMPONENTS%
for %%f in (%COREDLL_COMPONENTS%) do call :RemoveMessagedialogboxthunk %%f
set COREDLL_COMPONENTS=%TEMP_COREDLL_COMPONENTS%
goto :EOF
:RemoveMessagedialogboxthunk
if /i "%1"=="messagedialogboxthunk" goto :EOF
if not "%TEMP_COREDLL_COMPONENTS%" == "" set TEMP_COREDLL_COMPONENTS=%1 %TEMP_COREDLL_COMPONENTS%
if "%TEMP_COREDLL_COMPONENTS%" == "" set TEMP_COREDLL_COMPONENTS=%1
goto :EOF

The second part of the file is the same as the previous post: it removes the standard messagedialogboxthunk library to avoid multiple definitions for MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam.

The first part takes advantage of the COREDLL_REPLACE_COMPONENTS environment variable which is handled in %_WINCEROOT%\PUBLIC\COMMON\CESYSGEN\makefile.

Now, ‘all’ you have to do is filling the stubs in messagedialogboxcustomize.cpp with your desired implementation of MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam.

Posted in Windows Embedded CE | Leave a comment

Customizing Dialog Boxes and Message Boxes for Headless Systems 1/2


The MSDN documentation explains how to customize dialog boxes and message boxes for headless systems here http://msdn.microsoft.com/en-us/library/ee504353(v=winembedded.60).aspx.

What they say there is that you can instruct the build system to create the coredll DLL linking to the messagedialogboxcustomize component library rather than to the messagedialogboxthunk one:

  • messagedialogboxthunk is what you get if you include some kind of GWES support in your OS and it is a small layer which will forward the call to the actual implementation of MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam in GWES. 
  • messagedialogboxcustomize is built from the code in %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\MESSAGEDIALOGBOXCUSTOMIZE. As you see the MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam functions are basically stubs.

Following the above link, the first thing I did is modifying  %_PROJECTROOT%\oak\misc\cesysgen.bat so it looks like:

@echo off
call %_PUBLICROOT%\cebase\oak\misc\cesysgen.bat %*
set COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT=messagedialogboxcustomize
goto :EOF

When you sysgen coredll you’ll see some warnings complaining about the fact that MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam are defined in both messagedialogboxthunk and messagedialogboxcustomize:

messagedialogboxthunk.lib(messagedialogboxthunk.obj) : warning LNK4006: MessageBoxW already defined in messagedialogboxcustomize.lib(messagedialogboxcustomize.obj); second definition ignored
messagedialogboxthunk.lib(messagedialogboxthunk.obj) : warning LNK4006: DialogBoxIndirectParamW already defined in messagedialogboxcustomize.lib(messagedialogboxcustomize.obj); second definition ignored
messagedialogboxthunk.lib(messagedialogboxthunk.obj) : warning LNK4006: CreateDialogIndirectParamW already defined in messagedialogboxcustomize.lib(messagedialogboxcustomize.obj); second definition ignored
messagedialogboxthunk.lib(messagedialogboxthunk.obj) : warning LNK4221: no public symbols found; archive member will be inaccessible

(Notice that we’re lucky enough that the we’re ignoring the definition we *want* to ignore)

Reading better the link I noticed the “Ensure that the Messagedialogboxthunk component is removed from the COREDLL_COMPONENTS environment variable” part. Of course we won’t modify the build .bat files so we do it in our %_PROJECTROOT%\oak\misc\cesysgen.bat which finally looks like:

@echo off
call %_PUBLICROOT%\cebase\oak\misc\cesysgen.bat %*
set COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT=messagedialogboxcustomize
REM Remove "messagedialogboxthunk" from %COREDLL_COMPONENTS%
for %%f in (%COREDLL_COMPONENTS%) do call :RemoveMessagedialogboxthunk %%f
set COREDLL_COMPONENTS=%TEMP_COREDLL_COMPONENTS%
goto :EOF
:RemoveMessagedialogboxthunk
if /i "%1"=="messagedialogboxthunk" goto :EOF
if not "%TEMP_COREDLL_COMPONENTS%" == "" set TEMP_COREDLL_COMPONENTS=%1 %TEMP_COREDLL_COMPONENTS%
if "%TEMP_COREDLL_COMPONENTS%" == "" set TEMP_COREDLL_COMPONENTS=%1
goto :EOF

Notice that if you create an OS based on the small footprint device template you already have messagedialogboxcustomize in place: since no GWES support is included you’re running the following lines in %_WINCEROOT%\PUBLIC\CEBASE\OAK\MISC\winceos.bat

   if "%GWES_COMPONENTS%"=="" set __SYSGEN_MSGDLGBOXCUSTOMIZE=1
    if "%__SYSGEN_MSGDLGBOXCUSTOMIZE%"=="1" set COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT=messagedialogboxcustomize

If you like how messagedialogboxcustomize works, you’re done, but what if you want to link coredll to your own customized messagedialogboxcustomizedbyme code without modifying %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\MESSAGEDIALOGBOXCUSTOMIZE?

To be continued…

Posted in Windows Embedded CE | Leave a comment

Windows Embedded Compact 7 Documentation


In a previous post I point out that  once you install Platform Builder, in %ProgramFiles%\Windows Embedded Compact 7\Documentation you have several PDF docs about miscellaneous development topics. If you want more (or the updated version) you can check the Windows Embedded Compact 7 White Papers page. On the same site you can find even virtual labs and videos. Enjoy!

Posted in Windows Embedded Compact | Leave a comment

Checked build: the history


In a previous post I wrote about the differencies of retail, checked and debug build. You can take a look at this post by Larry Osterman for some historical background. Since you’re there you may enjoy other posts about Windows hystory and development. I really enjoyed the ‘XY years ago today’ serie Larry wrote to cheers his 25th year at MSFT.

Posted in Windows Embedded - General | Tagged , | Leave a comment

Windows Embedded Compact 7 Documentation


I do not know if everyone is aware of this, so maybe it’s worth a note. Once you install Platform Builder, in %ProgramFiles%\Windows Embedded Compact 7\Documentation you get more than 30 PDF docs about miscellaneous topics like:

  • Build system
  • Silverlight for Windows Embedded
  • BSP bring up and porting from previous Windows CE version

If you have the opportunity to take a look you’ll surely find something interesting. Enjoy!

Posted in Windows Embedded Compact | Tagged | 1 Comment