What to build when...

A question that keeps coming back on the newsgroups is "I changed some code, but it does not end up in my image", or "I changed some registry values in platform.reg, but if I look at the device registry, it's not there!".

The source of these problems is build-related. You've got to understand the build system in order to know exactly what to do. This blog post aims to give you a clear handle on "What to build when"!

The first and most important thing to do is to delete two options from the Platform Builder Build menu: Build and Sysgen and Rebuild and Clean Sysgen. These commands will build the entire tree (so including any source in PUBLIC and PRIVATE). For us normal developers these commands do not make any sense. If you're not in the CE development team working at Microsoft you simply don't have all the source code. Rebuilding the entire tree may work, but it will override any installed QFE (QFE's contain updated binaries and sometimes, but not always, updated source code). After rebuilding the entire tree you will sooner or later encounter strange errors that are either very hard to fix, or just impossible to fix. There is no way to revert back to a clean tree once you've done a (Re)Build and (Clean) Sysgen. The only way is to completely remove Windows CE and reinstall. Don't forget to reinstall all QFE's after that as well (download the QFEInstaller tool to help with that).

Now you know why you often see me shouting NEVER EVER DO A BUILD AND SYSGEN! in the newsgroups...

The original menu
The original Advanced Build Commands menu

Step 1.
Customize toolbar
Right click on the toolbar and click Customize...

 

Step 2.
Delete Build and Sysgen
Click on menu Build, submenu Advanced Build Commands, then right click on Build and Sysgen and click Delete

 

Step 3.
Delete Rebuild and Clean Sysgen
Do the same for Rebuild and Clean Sysgen

 

Step 4.
The original menu
Close the Customize window. The Advanced Build Commands menu should now have only 4 options: [ Sysgen], [ Clean Sysgen], [ Build Current BSP and Subprojects] and [ Rebuild Current BSP and Subprojects].

 

If you are still using Platform Builder for Windows CE 5.0 the instructions stay the same except the Build menu is Build OS and there's no submenu (everything is under the Build OS menu).

I know that some developers working with CE change code in the PUBLIC and PRIVATE trees. If you do that you need to do a build and sysgen to include your changes in your kernels BUT: You will end up with a corrupted CE installation. If you need to change PUBLIC or PRIVATE code you have to clone the code. Cloning code is in most cases not much more than a simple copy. Copy the sources you want to change to a folder in your BSP, change the sources file so that it builds a DLL instead of a lib and voila, you're done. I know I make it sound easier than it is, but taking a shortcut and modifying code in the PUBLIC or PRIVATE trees will prove to be a long way around in the long run.

Phew! Now that we got that out of the way let's see what build command we've got to use in what situation:

  • Change Platform Settings: Make image

    Platform Settings
    If you change any Platform Settings (like IMGNOKITL, IMGNODEBUGGER, IMGPROFILER) all you have to do is a Make Image.

  • Change driver source code in your BSP: Build the driver and Make Image

    If you change driver source code, all you have to do is just build the driver (WINCEREL must be set to 1 but it is set by default so unless you changed it there's no need to worry) and do a makeimg. If you only want to debug the driver you can also add the DLL to the Release Directory Modules list (menu Tools) and just restart the device (or reload the device driver on the device) without having to do a makeimg and download to device. Building just the driver is a simple right-click on the driver and Build in the IDE or "build" in the driver's folder on the command line.

  • Change multiple source code files in your BSP: Build the BSP and Make Image

    The safe option, this way you can't forget to rebuild anything. Building the BSP is a simple right-click on the PLATFORM/BSP folder and Build in the IDE or "build" in the BSP's root folder on the command line.

  • Change platform.reg, bib, dat or db files in your BSP: Sysgen BSP, Copy Files to Release Directory, Build All Projects and Make Image

    A lot of steps, but this will still not take longer than a couple of minutes. If you change any of the platform.* files we need to re-filter (Sysgen) those files and make sure the filtered files are copied into the FLATRELEASEDIR (Copy Files to Release Directory). That last action did however clear the project binaries from the FLATRELEASEDIR so we need to make sure those binaries and settings are getting copied into the FLATRELEASEDIR again (Build All Projects) and finally we are ready to Make Image. Now your registry changes will be in the image (check reginit.ini to make sure, last entry wins).

  • Change some source files and platform.reg, bib, dat or db files in your BSP: Build and Sysgen the BSP, Copy Files to Release Directory, Build All Projects and Make Image

    Only difference with previous situation is that you now have to build the BSP to include the source code changes.

  • Change the workspace configuration (add or delete a component): Sysgen the entire workspace

    For most components a simple Sysgen is enough. For some components (like when changing from RAM based registry to Hive based Registry) a Clean Sysgen is needed. This action takes the longest (anywhere from 5 minutes for a small workspace configuration on a very fast machine to a couple of hours for a really big configuration and a very slow machine). A Sysgen is a right-click on the workspace, Advanced Build Commands->Sysgen in the IDE or "blddemo -q" on the command line.

Sometimes it's easier to build from the command line. If you are unsure what command to type you can always perform the action in the IDE first and watch the 3rd line in the build output window starting with "Starting Build:". Behind the colon is the exact command line for that action, eg Sysgen on the BSP: "Starting Build: SysgenPlatform %_TARGETPLATROOT% preproc&&SysgenPlatform %_TARGETPLATROOT% postproc", so on the command line you would type "SysgenPlatform %_TARGETPLATROOT% preproc" followed by enter and the 2nd command "SysgenPlatform %_TARGETPLATROOT% postproc" followed by enter.

If you use the commandline, make sure you never forget "-q" when running "blddemo" as "blddemo" without "-q" is a Build and Sysgen!

I hope this blog post will help you speed up your builds and lower your frustration with the build system!

Good luck!

wince6 R3 rebuild and sysgen

thank you, it's very very useful. And i think it's a basic knowledge for developing wince but we always ignore it which caused the developers wasted too much time on the build system.
Now I've a question.
I've installed vs2005+sp1+pb6+sp1+r2+r3, and no QFE.
But I've already run "rebuild and sysgen".
As u said "it will override any installed QFE ". So I've not installed any QFE. Is it OK for me?(I'll never do it again,-_-). Or R3 is a QFE too? So maybe I'll reinstall vs2005+sp1+pb6+sp1+r2+r3.
thank you.

RE: wince6 R3 rebuild and sysgen

R3 is just another set of QFE's... Reinstall it all is your only safe option... Sorry!

thanks

thanks

blddemo -q building everything

This is a really useful article, thanks. I'm new to Platform Builder and have found building an image from my osdesign to be very painful (taking 45 minutes). I'm using Platform Builder 6.0 service pack 1. As I understood it blddemo -q which runs when selecting Build/Build Solution or Build Project from within the IDE should only build the changes. So first time can take a while, but next time can be quicker if the sysgen doesn't need to run again - is that right? Anyways, if I don't make any changes and then blddemo -q it's as though a full rebuild is happening. I've copied some output from the build window below. Is this what's expected? Am I running the wrong build command? What part of the build process is the longest part?

Thanks in advance, Steve

-----------------
Starting Build: blddemo -q
==============
BLDDEMO: Generating OS Design Folders
BLDDEMO: Done Generating OS Design Folders
BLDDEMO: Generating OS Design Files to C:/BIT_nj/code/nj2/Wince600/DEVNAME_BSP_ARMV4I/oak
BLDDEMO: Done Generating OS Design Files
CEBUILD: Deleting old build logs
CEBUILD: Skipping directly to SYSGEN phase
Building dep trees: winceos dcom gdiex ie script servers shellsdk shell rdp wceshellfe wceappsfe directx voip datasync netcfv2 netcfv35 sqlcompact SQLCE cellcore ostest mediaapps speech FP_VOIP nj2
CEBUILD: Running sysgen preproc (for COMMON)
Starting sysgen phase for project ( common )
......
Starting sysgen phase for project ( FP_VOIP )
CEBUILD: Running sysgen postproc (for COMMON)
Starting sysgen phase for project ( common )
......
----------------------

RE: blddemo -q building everything

Yes, a blddemo -q is a sysgen. The only thing taking longer is a clean sysgen. Please re-read the article, it's all there. Don't do a sysgen when you don't need to.

nice post

Thanks Michel. That helped a lot.

Build Question

Hi Michel,

When building a BSP, why all the SOC folders (OMAP2420,PXA270, etc..) as well as platform/common folder and some other common folders are building. This is taking lot of time.

When building a particular BSP, the particular SOC ( like OMAP2420_MS_V1 for H4sample BSP) alone can be built right. Any options are there to do that.

Regards,
Kumar

RE: Build Question

Hi Kumar,

NOTE: In the text below, when I talk about Build command BSP, I mean right-click on your BSP and choose that command from the dropdown menu (in other words: a Targeted Build). I'm NOT talking about commands from the Build Menu in Platform Builder!

The COMMON and SOC folders should only build if you changed something there. If I do a Rebuild BSP only my BSP rebuilds, not the common folders. Are you sure you don't change anything in the common folders?

Only if I do a Rebuild and Clean Sysgen BSP I can see that those common folders are rebuilding (as expected and wanted!). Now, if you'd want to change that behavior (but I don't think that is such a good idea) you can change the DIRS statement in the dirs file in /WINCE600/PLATFORM/COMMON/SRC/SOC to OPTIONAL_DIRS and add set BUILD_OPTIONS=OMAP2420_MS_V1 to your bsp batch file (in the root of your BSP). That will only build the OMAP2420_MS_V1 SOC folder instead of all. Of course the folders in COMMON should be build if you do a Rebuild and Clean Sysgen Build of the BSP since they could be used by your BSP.

Let me know if this works for you.

http://guruce.com/blogpost/whattobuildwhen

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值