Postmakeimg.bat Premakeimg.bat

For Wince的BSP包里都会有个FILES的文件夹,这个里面放了些exe, dll, lib,config等等文件,这些文件最终都会打包到image里,这是微软标准做法,如果不想把我的exe,dll,config放到FILE下,而且我的这些exe,dll只是针对个别project用的,如果也放在FILES里,对于不同的Project,我都要修改BSP下面的这个FILES里的bib, reg等,有没有针对特殊project的办法呢?

办法肯定有的,我们可以在对应project的workspace下放一个Custom的文件夹,把特别的exe, dll, config等放在里面,同时类似FILES,定义custom.bib, custom.reg,截个图如下:

《-----注意这里的Custom就是新建的目录

WINCE为我们有提供相应的方法,在%_WINCEROOT%\public\COMMON\oak\misc\pbpostmakeimg.bat, 以及%_WINCEROOT%\public\COMMON\oak\misc\pbpremakeimg.bat

另外PB-> Solution Properties->Configuration Properties->Custom Build Actions->Post Make Image, 以及PB-> Solution Properties->Configuration Properties->Custom Build Actions->Pre Make Image

这时在FILES下面建一个Premakeimg.bat

Premakeimg.bat里的内容如下:

REM
REM
copy %_FLATRELEASEDIR%\MiscFile\* %_FLATRELEASEDIR%
copy %_FLATRELEASEDIR%\Network\* %_FLATRELEASEDIR%
cd %_FLATRELEASEDIR%
cd ..\..
IF EXIST "CUSTOM" goto :SHELL
MD Custom
echo ;> Custom\Custom.reg
echo ;> Custom\Custom.bib
:SHELL
xcopy Custom\*.* %_FLATRELEASEDIR%\*.* /s
IF "%BSP_BERRYSHELL%" == "1" copy %_FLATRELEASEDIR%\Shell\* %_FLATRELEASEDIR%
IF NOT "%BSP_BERRYSHELL%" == "1" goto :STANDARD_SHELL
copy %_FLATRELEASEDIR%\Network\XXXX.exe %_FLATRELEASEDIR%\YYYYY.exe
:STANDARD_SHELL

再在FILES下面的platform.bib和platform.reg里添加如下声明

#include "$(_FLATRELEASEDIR)\custom.bib"

#include "$(_FLATRELEASEDIR)\custom.reg"

至此,build下workspace,custom下的东东同样会被打包到image里去。通常BSP都不需要重新buld,直接run下make run-time image就自动把custom下的内容copy过去make打包到image里。

下面有些微软官方的BLOG,说得非常好

Q:

In CE6 doing some post/pre-something was as easy as creating a command file in %_TARGETPLATROOT%\FILES e.g. PostMakeImg.bat. This doesn't work with CE7 however.

 

I tried creating a command file and calling it by adding a custom build step under Solution Properties->Configuration Properties->Custom Build Actions->Post Make Image

e.g.

 

call  %_TARGETPLATROOT%\MyPostMakeImageActions.bat

 

This seems to not work either. I can see "PBPostMakeImg: BUILDMSG: Doing PostMakeImage Custom Build Actions" line in the log but can't see it calling my batch.

 

Is there a nice and clean replacement for PostMakeImg.bat in CE7?

A:

With a quick view in %_WINCEROOT%\public\COMMON\oak\misc, specifically

%_WINCEROOT%\public\COMMON\oak\misc\makeimg.bat
%_WINCEROOT%\public\COMMON\oak\misc\makeimg1.bat
%_WINCEROOT%\public\COMMON\oak\misc\makeimg.proj
%_WINCEROOT%\public\COMMON\oak\misc\pbpostmakeimg.bat

it looks to me that the build system will call %_WINCEROOT%\public\COMMON\oak\misc\pbpostmakeimg.bat after makeimg is completed.

looking in makeimg.proj it looks like the %_FLATRELEASEDIR%\PostMakeImg.bat file is called, as in the previous version

looking inside %_WINCEROOT%\public\COMMON\oak\misc\pbpostmakeimg.bat will call -if it exists- a batch called  PBPostMakeImageCustomBuildActions.bat which is created by PB in correspondance of the custom build step under Solution Properties->Configuration Properties->Custom Build Actions->Post Make Image.

Just to be sure: you set as a custom build step 'call  %_TARGETPLATROOT%\MyPostMakeImageActions.bat' but in the previous paragraph you talk about

%_TARGETPLATROOT%\FILES\*.bat. maybe there something wrong with the path?

http://social.msdn.microsoft.com/Forums/zh-CN/winembplatdev/thread/03cc950d-837e-4b69-a8cc-b50bd43ae147


也可参考下MSDN的资源库

http://technet.microsoft.com/zh-cn/library/ee479292



你可能感兴趣的:(Postmakeimg.bat Premakeimg.bat)