The source code is built, the files needed for the OS have been collected in the _FLATRELEASEDIR, so now it is time to create the OS Image or nk.bin.  The tool for this is Makeimg.exe.  Makeimg uses some other tools to do this including fmerge.exe, res2res.exe and romimage.exe.

If I wanted to keep this very simple, I could just tell you to run makeimg from the command line.  There are no command line arguments, so this would be done.  After running makeimg, you will have the nk.bin that you need for testing your OS.

I would stop there, but when things go wrong or you need to solve some certain problems you will need to know more about what happens when makeimg runs.  Of course Platform Builder Help will tell you some of what makeimg does, but it is brief.  One of the best ways to study makeimg is to look at the output that makeimg produces.  Makeimg can produce a few thousand lines of output.

but if you scan through them you will can get a general idea about what it does.

This is what makeimg does:

  1. It handles national language support (NLS) if included in the OS.
  2. Merges some important files using fmerge.  The file types are bib, reg, dat, db and nls.  This step is important for supporting the configurable nature of building Windows CE.  This step allows us to have files spread across many folders and in the end merge them together to create one file of each type used in creating the OS.

    Fmerge does handle each file type in a different way depending on the needs of the file type.  It also processes the conditional expressions in the files and substitutes environment variables.

    Looking at the command line for reg files we see that it has this:

    makeimg: run command: fmerge -reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\reginit.ini
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\common.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\dcom.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\gdiex.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\ie.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\script.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\servers.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\shell.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\wceshellfe.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\wceappsfe.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\viewers.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\directx.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\datasync.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\netcf.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\SQLCE.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\NETCFV2.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\SQLMOBILE.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\project.reg
    C:\WINCE500\PBWorkspaces\MyProject\RelDir\MyBSP_ARMV4I_Release\postproc\platform.reg

    It is a long command line which includes: file type to merge and output file name followed by the files to merge.  The order of the files to merge is important, especially for reg files. For reg files it is important becuase when the registry is loaded on your device, is it loaded in order from top to bottom. So the entries in last file in the list can override the earlier files.  For more on registry files see Platform Builder: Managing the Registry

    We can see from the command lines for each type what the output files are:

                                - bib files - ce.bib
                                - reg files - reginit.ini
                                - dat files - initobj.dat
                                - db files  - initobj.db
                                - nls files - nlscfg.out

    Knowing what the output files are can be useful when trying to figure out why changes you have made aren't in the OS.|
  3. Create the binary registry files by running regcomp.exe.  The binary files could be either Default.fdf if you are using RAM registry, or Defualt.hv, System.hv and Boot.hv if you are using hive registry.

    It is rare, but occasionally an error in the registry will be accepted by fmerge, but rejected by regcomp.  when this occurs you may get an error later on that one of the binary files could not be found.  When that happens, it is time to closely review your most recent changes.
  4. Resource files are replaced in the binaries by res2exe.exe.  This step can be used to customize the user interface of dialogs.
  5. Finally, makeimg runs "romimage ce.bib" to create the nk.bin based on the settings in your bib files.

Go to Summary of Building Windows CE

Copyright © 2008 – Bruce Eitman
All Rights Reserved