Sunday, April 7, 2013

Tweak my runtime image Build [3/4]

Hi Folks

In the two previous post of that serie, we identified the batch files used in the make image, and created one that modifies the registry to include time stamp information. In this post we are going to perform some clean up of the nk.bin file in order to remove files that are automatically integrated inside the run-time image, like the audio files used by explorer.exe.
Note : it is not suggested to include the standard graphical shell in a shipped product. You own shell must be the shell used by the end user, that's the purpose of an embedded system.

The files included inside the run-time image are defined in the bib files, and all those files are merged together into a file named ce.bib and located in the Release Directory (%_FLATRELEASEDIR%). The appropriate batch file to use to manipulate the ce.bib file is the PostFmergeBib.bat file.

To simplify this development we are going to store that batch file in the FILES folder of the BSP : %_TARGETPLATROOT%\FILES (c:\WINCE700\Platform\<platform name>\FILES).
  • PostFmergeBib.bat content :
@echo off
REM
REM Clean the ce.bib file content
REM

call %_TARGETPLATROOT%\FILES\BIBCleaner.bat %_FLATRELEASEDIR%\ce.bib

It calls the BIBCleaner.bat, located in the BSP folder, with the path to the ce.bib file in parameters. The ce.bib file should contains instructions that list the files to be remove. This information must follow a format that will be used by the script in order to identify that list of file.
In your OSDesign add the list of files to remove using the instruction ; @BIBREMOVE witht the semicolon. If you want to remove the foo file from the NK.bin, then type :
; @BIBREMOVE foo

  • BIBCleaner.bat content
@echo off
rem -- Remove items from a .bib file
rem -- Use "; @BIBREMOVE " to remove an item
rem -- make sure to keep semicolon and spaces
rem -- The filtering is case-insensitive and a list of 
rem -- removed items is appended to the resulting file
rem -- USAGE: BIBCleaner.bat <bibfile.bib> 

if not exist %1 goto :EOF

rem -- extract files marked by tag 
findstr "@BIBREMOVE" %1 > ~bibremove~.0
for /f "tokens=3 eol=§" %%I in (~bibremove~.0) do (
echo Removing %%I from %1
echo %%I>> ~bibremove~.1
)
rem -- filter marked files 
if exist ~bibremove~.1 (
findstr /i /v /g:~bibremove~.1 %1 > ~bibremove~.2
echo ; ** Files removed by BIBCleaner.bat ** >> ~bibremove~.2
type ~bibremove~.0 >> ~bibremove~.2
copy ~bibremove~.2 %1 > NUL:
)
rem -- cleanup temporary files 
del ~bibremove~.*

Here we are the ce.bib has been cleaned up, but make sure that the files removed are not used by the system !
If you would like to remove the wav files used by explorer.exe, you might add the following line to the OSDesign.bib file :
; @BIBREMOVE asterisk.wav  
; @BIBREMOVE close.wav
; @BIBREMOVE critical.wav  
; @BIBREMOVE default.wav   
; @BIBREMOVE empty.wav
; @BIBREMOVE exclam.wav
; @BIBREMOVE infbeg.wav
; @BIBREMOVE infend.wav
; @BIBREMOVE infintr.wav   
; @BIBREMOVE menupop.wav   
; @BIBREMOVE menusel.wav   
; @BIBREMOVE openprog.wav  
; @BIBREMOVE question.wav  
; @BIBREMOVE startup.wav   
; @BIBREMOVE windmax.wav   
; @BIBREMOVE windmin.wav   
; @BIBREMOVE recstart.wav  
; @BIBREMOVE recend.wav

But you also have tune the WinCE registry, to unregister the wav file as system audio file defined in the control panel applet. For this follow the instructions of previous post on registry tweaking scripts.
[HKEY_LOCAL_MACHINE\Snd\Scheme]
    ".DefaultSounds"=-
    ".AllSounds"=-
    ".NoSounds"=mui_sz:"cplmain.cpl,#33127"


[HKEY_LOCAL_MACHINE\Snd\Event]
    ".Scheme"=-
    ".Scheme"=".NoSounds"        ; Current scheme
    ".DefaultSounds"=-
    ".AllSounds"=-
- Nicolas

No comments:

Post a Comment