星期一, 10月 16, 2006

CE : about Shared Source Code ("PRIVATE" folder)

關於source code,誤會了CE,因為CE 也幾乎提供的所有的source code (只是build 的動作太不清楚)。

CE將Code分為兩部份 - Public and Private,Private的部份是需要另外的 license。Public 的地方可以任意修改。

Private 的部份又稱作"Shared Source Code" (因為要簽署Shared Source Code Agreement),放在"PRIVATE" folder李。

安裝時,安裝了所有source的人,private (shared) source code可以當作是public的部份一般,可以用IDE在code中設break point,觀察call stack,也就是說,可以作source debugging。
-- 參考 這裡 http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wceosdev5/html/wce50condebuggingsharedsourcecode.asp

MS允許你利用shared source了解和修改CE kernel,但是不允許你使用修改過的shared source 出貨。
所以在你修改shared source之前,要先將所有shared source 和library備份起來。
(? lib ? 所以並不是所有source都有release..)。
被分的方法是用 command line tool : CeBackup Tool.
-- 參考 這 http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wceosdev5/html/wce50concreatingabackupofthesourcecodefiles.asp

備份source code:
  1. 就是單純的把你要修改的code的folder整個copy到另外的folder中 (以後copy回來覆蓋就OK)。
備份 *.lib
  1. "Open Release Directory" 出現command console。
  2. 輸入
    cebackup backup
    將會backup public, private ... WINROOT下所有的*.lib。
Restor 呢?
  1. Source Code部份就是把folder copy回來就OK。
  2. *.lib部份,一樣,"open release directory"在console中輸入
    cebackup restore
  3. 確認IDE中"Copy Files to Release Directory After Build" 和 "Make Run-time Image" 都要check。
  4. "Build and Sysgen"
如果沒有備份到source code,可以..
  1. To differentiate between modified and original files, use Windows File Explorer to sort by date. Modified files have a more recent date than original files.

  2. Run the Windows CE Setup Wizard.
  3. From the Program Maintenance dialog box, choose Repair.

    This action reinstalls the files you deleted.

  4. From the Build OS menu, verify that Copy Files to Release Directory After Build and Make Run-Time Image After Build are selected.
  5. From the Build OS menu, choose Build and Sysgen.

    This action rebuilds your run-time image with the original files. Your run-time image will no longer contain your modified files.


--參考 這裡 http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wcepbguide5/html/wce50conCeBackupTool.asp
--參考 這裡 http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wceosdev5/html/wce50conrestoringtheoriginalbinaryfiles.asp


有列出一些command argument,可以備份某個folder,如果整個 WINROOT的 *.lib都要備份,會用掉20G (??) ,,, 所以要作之前最好先看一下這一份reference。


最重要的部份 : 用修改過的Shared Source Code build你的Image :
http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wceosdev5/html/wce50conbuildingaplatformusingmodifiedsharedsourcecode.asp

重點好像是 只能build "debug" version,所以Active Configuration 要設debug,否則build不出來。(大概又是沒有release 的library 用debug build的關係...)

還有說明不是所有的Private folder都可以build,在 這裡 可以一層一層的去check 哪一個folder 可以build。
( http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wcepbguide5/html/wce50conSharedSourceCodeDirectories.asp )

Build的步驟:
  • Open Workspace,Build OS - Set Active Configuration - 選 debug,這樣才會去build share 的source code。
  • 確認"Build OS" 中的 "Copy Files to Release Directory After Build" 和 "Make Run-Time Image After Build" 都有選。
  • 選 "Build OS - Sysgen",開始build image,這是未修改前的base line。可以用來backup用。
  • 備份:
    將整個"Private" folder copy下來備份。
    用CeBackup 備份所有library。
  • 可以修改private 下的code了。


build shared source code一定不會很順利,看 這篇 : build shared source 時當機怎麼辦 ?
http://support.microsoft.com/kb/887702

沒有留言:

網誌存檔