Platform Builder Help does a good job of documenting the Binary Image Builder (BIB) files, but finding the documentation can be a challenge and it is filled with a lot of technical detail, but not much how to information. I will try to make that better.
Help tells you that there are FILES and MODULES and that your file needs to be added to one of them. The only real guidance that it gives is that a dll in the FILES section will be loaded into Slot 0 taking address space from all processes, and that managed code must go into the FILES section. This is interesting but, there aren’t any slots in Windows CE 6.0.
So how do you decide which section to put your file into, and why?
1.       If the file is built from managed code, it goes into the FILES section; that much we can clearly understand from Help.
2.       If the file is not an executable, it goes in FILES section.
3.       If the file is an executable, then it might go in the MODUES section. You might also want to put it in the FILES section.
If that doesn’t leave you a little confused, maybe we should look at what romimage does with the two sections when it creates the OS image.
FILES Section – the files in the FILES section are put into the OS image without modification. That certainly is a good thing for text files, bitmaps and data.
MODULES Section – file files in the MODULES section are “fixed up” when put into the OS image. That means that the file is modified by romimage so that the executable can be run eXecute In Place (XIP) from the ROM image.   There may be times when you don’t want it to be run XIP, like if you want to reduce the image size, but want the same DLL to be run from both Kernel space and User space.
The section of the bib file is defined by putting the section name on a line by itself. I can’t find clear documentation of the syntax, but there is a standard set by example in bib files delivered by Microsoft.
List of files
List of files
The order of sections is not important, and sections can be listed more than once. A section ends when a new section starts.
Let’s look at an example of adding MyDriver.dll to the OS image so that it runs XIP. That means that it will go in the MODULES section, it also means that it will go in the NK memory block as specified in the CONFIG section. This could be different if you are building something other than the OS, like a bootloader. The memory block name ‘NK’ is standardized by the bib files in the Public folders.
Then we need to decide which of the flags to set for this module.  Since it is a driver, typical flags include:
                S for system file
                H for hidden file
                K for load into Kernel space for Windows CE 6.0, but this can be used in previous versions for other modules like an Installable Interrupt Service Routine (IISR.)
Once those harder decisions are out of the way, we need to decide what the file will be named in the OS Image and where the file is located on the development workstation.
The bib entry looks like for Windows CE 6.0:
Driver.dll      $(_FLATRELEASEDIR)\MyDriver.dll     NK SHK
But for previous versions of Windows CE:
Driver.dll      $(_FLATRELEASEDIR)\MyDriver.dll     NK SH
Both of these do the following:
1.       Set the section to MODULES
2.       Name the file Driver.dll in the OS image, although it is not necessary to change the name of the file. This just shows that it can be done.
3.       Tells romimage to look for MyDriver.dll in the _FLATRELEASEDIR, which is common, but not necessary. The path can be set to another path as well.
4.       Puts Driver.dll in the NK memory section
5.       Sets the flags so that Driver.dll will be a system file and hidden
6.       For Windows CE 6.0 tells romimage to fix up the driver to run in the kernel address space.
Next, let’s review an example of putting a font into the OS image.   For this example the font name will be MyFont.ttf which should go in the FILES section. Files in the FILES section are compressed by default, which is probably not such a good thing for a font file that will be opened for reading quite often, so we should use the U flag to tell romimage not to compress the font.
MyFont.ttf      $(_PROJECTROOT)\Fonts\MyFont.ttf        NK SHU
This does the following:
1.       Set the section to FILES
2.       Name the file MyFont.ttf in the OS image.
3.       Tells romimage to look for MyDriver.dll in the _PROJECTROOT\Fonts, which is not a standard location for fonts, but is where I put this font in my project.
4.       Puts MyFont.ttf in the NK memory section.
5.       Sets the flags so that Driver.dll will be a system file, hidden and uncompressed.
There are other flags available for both the MODULES and the FILES section, but I will leave that for you to review in Platform Builder Help. I usually search for “bib files” to find the documentation for bib files.
Tags: BIB File,  Makeimg,  FMerge
Copyright © 2008 – Bruce Eitman
All Rights Reserved