There isn’t any magic that occurs when you set a SYSGEN variable, or drag a component from the catalog into your project. I know that sometimes it sure seems like it, but if I know anything about computers I know that there isn’t any magic involved. Instead, there are some batch files, makefiles, and few applications that work together to define the OS that you want to build and then to build it. During the sysgen of your project, a file in your project (OSDesign or PBWorkspace) is used to convert SYSGEN variables into other environment variables used to define the build of your system.
Cesysgen.bat is in your project’s Misc folder. Maybe you have never even looked at the cesysgen.bat file, probably because you didn’t need to. I will go out on a limb here and make a statement without any scientific data to back it up: most projects never make changes to cesysgen.bat. In fact, my team doesn’t even keep it in version control for Windows CE 5.0 or 6.0 projects, instead we allow the build system to create the default one when needed.
Why would I discuss cesysgen.bat if most projects don’t modify it? For two reasons; knowing about it can provide some valuable information and if you do need to modify it you will be glad that you know about it.
First a little history, prior to Windows CE 5.0, cesysgen.bat was a monolithic file that would be copied into your project when the project was created. This approach had some created some problems for those of us who did need to modify our cesysgen.bat files. QFEs were the primary source of the problem. Anytime that a QFE was installed, the default cesysgen.bat file would be updated to solve problems or add new features, but my modified cesysgen.bat file would not be updated. No problem if you have one or two projects, but my team manages a large number of projects.
The engineers at Microsoft took a new approach starting with Windows CE 6.0. The cesysgen.bat file became a set of batch files located in Public\CEBase\Oak\Misc and the project contains a small cesysgen.bat file that calls on the set of files to do the work. This change means that the base set of batch files will be updated with QFE installs, but you can still change cesysgen.bat in your project.
Enough history, what does cesysgen.bat and do? Cesysgen.bat checks the SYSGEN variables that your project has set and verifies that dependent SYSGEN variables are set and sets other environment variables that will be used during the sysgen process. That sounds a lot like something that Microsoft would need to set up and that you should never need to change, but Windows CE is highly configurable. To make a very small OS image, you may need to modify environment variables to override the settings that Microsoft has determined are “correct."
I also find it useful to look at the cesysgen batch files to reverse engineer the process to figure out which SYSGEN variable I need to set. This is especially true when one of my customers knows which file they need in the OS image, but don’t know what I need to do to get the file into the OS image.    I can then search the bib files for the file to determine which environment variable needs to be set to include the file. Then searching the batch files I can find the SYSGEN variable that causes the environment variable to be set.                                                                                                                                                                 
Tags: Build.exe
Copyright © 2008 – Bruce Eitman
All Rights Reserved