It has been another one of those days. Several months ago we discovered that one of our systems wouldn’t boot if we did a clean build, but if we built the kernel separately and then ran makeimg the system would boot. What a mystery, that just didn’t make any sense. 
So, the engineer on the project modified PreMakeimg.bat to rebuild the kernel when we run makeimg.   All was good, but this increases build time. If you have followed this blog, you know that I don’t like long build times but we all tolerated this because there were more important issues for us to address.
Then a second platform had the same problem. I made it a priority to figure out what was wrong this time though because now we were losing time in trouble shooting and in building.
Since the first build is a full build of the system, there is a build.log file in %_WINCEROOT% that I could look at for clues. And the second build was just in the kernel folder, so there was a build.log there as well. I diffed the two files.  At first didn’t seem too interesting. That is until I scrolled to the right and could see the command line calls to compile and assemble. At that point it became clear that during the full build of the system that the RAM size was being defined twice, once setting the RAM size to 64MB and the other to 128MB. Our boards have 128MB of RAM so clearly the setting of 64MB was wrong, and of course having both sizes set was a problem.
Now to figure out why this was happening only when we did the full build. I will leave out the details of my search other than that I ruled out sources.cmn, sources, platform.bat and the project’s PBXML file as the cause. Then I noticed that in the root of the platform there was a CEBaseCESysgen.bat file. I had previously ignored it, but now it was beginning to make me curious.
When I opened CEBaseCESysgen.bat, what I found was that it set the RAM size to 64 MB if it is not set to 16, 64 or 256MB, but these platforms are 128MB. Apparently, someone had added support for 128MB, but not noticed this file.
So, what is happening with this CEBaseCESysgen.bat? During the sysgen of the project the platform is built with CEBuild.bat, which runs CESysgen.bat during the build of the platform. CESysgen.bat in turn runs CEBaseCESysgen.bat during the different phases of the build process. But, when we build the kernel separately we just run build.exe which doesn’t run CEBaseCESysgen.bat.
Copyright © 2008 – Bruce Eitman
All Rights Reserved