星期四, 10月 26, 2006

CE : MISC Work Record : Tiny Kernel Mode ,, Test Program

在build log 中會出現:

CE_MODULES=coredll nk shell relfsd loaddbg shellcelog fsdmgr filesys toolhelp rt_tests
COREDLL_COMPONENTS=coremain lmem showerr thunks corecrt corestrw snotify coregwestub coreimmstub coresiow serdev locmini multiui full_crt crypthash rsa32
NK_COMPONENTS= nkcompr nkmapfile
FILESYS_COMPONENTS=fsheap fsmain fsreg fsysram msgqueue
可以看出NK.EXE, COREDLL.DLL, 各由哪一些 lib 組合而成,但是不知道決定dependency 的地方在哪裡。

New Platform : build 出來的platform在OS design View中會自動依照Platform-Setting - Build Option 的項目加入需要的item,所以刪除該item時,會出現一個dialog,說明同時要將 ENABLE_XXX 的item 關閉。

但是雖然OS Design View 中有該item,實際看workspace.pbxml 卻還是只有基本的item (就是有選的item),也就是說... 實際的和OS Design View 不符。

將 platform-Setting-build option 中的item 都不勾選,TinyKernel 就只有標準的nk, coredll 兩個。


  1. uncheck all "Platform - Settings - Build Options" except "FullKernelMode".
  2. uncheck "Clean befor build" and "make run-time image after build".
  3. build and sysgen
  4. modify platform.bib
    1. comment out FlashDrv.dll
    2. comment sdmmc ...
    3. comment pnashell.bib
  5. modify *.reg <- seems not need to do this


TinyKernel Test Program的位置在
PUBLIC\COMMON\OAK\tktest

在common.bib中有描述,當指定使用MODULE_TKTEST時,會將tktest.exe copy到 image中,rename成filesys.exe。

這是因為 CE 的 kernel : 寫死了 起動後 run ...
  • schedule.c : SchedInit( ) : CreateThread( ... SystemStartupFunc ...)
  • schedule.c : SystemStartupFunc : CreateKerelThread( ... RunApps ... )
  • kmisc.c : RunApps( ) : CreateProcess( ..filesys.exe... )
所以...第一個啟動的是filesys.exe (?)。
跟Linux一樣,kerel boot後,指定root filesystem, kernel 用內建node id找到後,找到裡面的init.. load, run。
所以makeimg完,用viewbin -top nk.bin 看 MODULE 只有看到filesys.exe,沒看到tktest.exe。
dir 出來看,tktest.exe 和 filesys.exe 的size一樣大。

download and Run ...
In TKTest
Page size=4096, 13426 total pages, 13402 free pages. 13401 MinFree pages (102400 MaxUsed bytes)
Event created successfully, About to set event
Look, a message from a thread
In thread, loop cnt = 0
In thread, loop cnt = 1
In thread, loop cnt = 2
In thread, loop cnt = 3
...
.成功。

很愚蠢的是 沒有單純build tktest.exe 的方法,tktest\source 中指定target是sharelib,所以build 出來會是 tktest.lib (!!)。
好像是到該folder build -c 後 sysgen ,修改platform.bib後再makeimg就可以..

這樣啟動的kernel,因為filesystem 沒有啟動,所以registry 都沒有用。

沒有留言:

網誌存檔