The Make Binary Image tool (Makeimg.exe) calls a number of programs and batch files in the process of making the run-time image (check http://msdn.microsoft.com/en-us/library/aa908853.aspx for details).
What you may not know is that makeimg checks for the existance of several batch files in %_FLATRELEASEDIR% at almost every step of its execution: this allow the developer who creates these files to perform custom build actions. The files that makeimg will call if it finds them are the following (note that %_FLATRELEASEDIR% is omitted):
- PreMakeImg.bat: this file is called before makeimg runs other commands
- PreFmergeBib.bat / PostFmergeBib.bat: these files are called immediatly before and after fmerge merges .bib files in ce.bib.
- PreFmergeReg.bat / PostFmergeReg.bat: these files are called immediatly before and after fmerge merges .reg files in reginit.ini.
- PreFmergeDb.bat / PostFmergeDb.bat: these files are called immediatly before and after fmerge merges .db files in initdb.ini.
- PreFmergeObj.bat / PreFmergeObj.bat: these files are called immediatly before and after fmerge merges .dat files in initobj.tmp
- PreRomImage.bat / PostRomImage.bat: these files are called immediatly before and after romimage is called (see below).
- PostMakeImg.bat: this file is called after makeimg has run all the other commands.
There is a predefined PreRomImage.bat which is copied in the flat release directory from %_WINCEROOT%\PUBLIC\CEBASE\OAK\FILES. This file will call a batch file for each entry in the %_DEPTREES% variable – if a file named <depttree entry>-preri.bat exists – and the batch file %_TGTPLAT%-preri.bat which will get called last; the %_DEPTREES% environment variable lists the public projects under %_WINCEROOT%\PUBLIC (i.e. RDP, DCOM, IE,…) plus %_TGTPROJ%. This mean that you can perform pre-romimage steps on a public project, workspace or BSP base.
Note that if you put the batch files in the FILES folder in your OS design folder or in your BSP folder, they will be automatically copied in in the flat release directory.