阅读:6823回复:10
开贴探讨WINCE6.0 XIP模式的实现
WINCE5.0的XIP模式,很早就实现了,最近在想WINCE6.0上实现XIP,但是结果失败.不知道有没有前辈大虾已经实现的.
WINCE6.0架构和WINCE5.0有很大区别,原来的5.0的NK.EXE已经被分成几个小块了,OAL.EXE,KERBEL.DLL等等,另外用户模式下一些对底层硬件操作也有所限制,例如VirtualAlloc等函数就不能支持操作,另外在5.0下经常应用的KernelIoControl,自定义IOCTL操作也不好用了,IOCTL已经成为一个单独的OALIOCTL.DLL并且只支持 switch (dwIoControlCode) { case IOCTL_HAL_GET_CACHE_INFO: case IOCTL_HAL_GET_DEVICE_INFO: case IOCTL_HAL_GET_DEVICEID: case IOCTL_HAL_GET_UUID: case IOCTL_PROCESSOR_INFORMATION: // request is to service the ioctl - forward the call to OAL code // OAL code will set the last error if there is a failure fRet = (*g_pfnExtOALIoctl)(dwIoControlCode, pInBuf, nInBufSize, pOutBuf, nOutBufSize, pBytesReturned); break; default: SetLastError(ERROR_NOT_SUPPORTED); break; } 不管那些,按照原来5.0的经验支持修改让它支持XIP 1: config.bib #define CHAIN_ADDRESS 804FF000 #define CHAIN_LENGTH 00001000 ;----------------------------------------------------- ; NAME ADDRESS SIZE TYPE ;----------------------------------------------------- XIPKERNEL 80200000 002FF000 RAMIMAGE CHAIN $(CHAIN_ADDRESS) $(CHAIN_LENGTH) RESERVED NK 80500000 01800000 NANDIMAGE RAM 80500000 3618000 RAM FLASH 92000000 00100000 RESERVED nk.exe:pdwXIPLoc 00000000 $(CHAIN_ADDRESS) FIXUPVAR ENDIF ; Common RAM areas PTS 80000000 00020000 RESERVED ARGS 80020000 00000800 RESERVED SLEEP 80020800 00002000 RESERVED EFSBUF 80070000 00010000 RESERVED SMART_CARD 800A1000 00002000 RESERVED nk.exe:dwOEMDrWatsonSize 00000000 0x4B000 FIXUPVAR ;#define PAGINGPOOLSIZE 00500000 ; nk.exe:cbNKPagingPoolSize 00000000 $(PAGINGPOOLSIZE) FIXUPVAR CONFIG FSRAMPERCENT=0x0A0A0A0A COMPRESSION=ON KERNELFIXUPS=ON AUTOSIZE=ON RAM_AUTOSIZE=OFF ROM_AUTOSIZE=OFF DLLADDR_AUTOSIZE=ON XIPSCHAIN=$(CHAIN_ADDRESS) AUTOSIZE_ROMGAP=10000 AUTOSIZE_DLLADDRGAP=0 AUTOSIZE_DLLDATAADDRGAP=0 AUTOSIZE_DLLCODEADDRGAP=0 ROMFLAGS=0 IF IMGPROFILER PROFILE=ON ELSE PROFILE=OFF ENDIF 2: 修改注册表 ; @CESYSGEN ENDIF CE_MODULES_DEVICE ; @CESYSGEN IF FILESYS_FSREGHIVE ; HIVE BOOT SECTION [HKEY_LOCAL_MACHINE\init\BootVars] "SYSTEMHIVE"="system.hv" "PROFILEDIR"="Documents and Settings" "RegistryFlags"=dword:1 "Flags"=dword:3 "DefaultUser"="default" "Start DevMgr"=dword:1 ; END HIVE BOOT SECTION ; @CESYSGEN ENDIF FILESYS_FSREGHIVE ; HIVE BOOT SECTION IF BSP_NONANDFS ! [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\NANDFLASH] "Prefix"="DSK" "Dll"="nandflash.dll" "Index"=dword:1 "Order"=dword:0 "Profile"="NANDFLASH" "BootPhase"=dword:0 "MountFlags"=dword:11 "Flags"=dword:1000 ;for Hive-based registry "IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}" [HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\NANDFLASH] "DriverPath"="Drivers\\BuiltIn\\NANDFLASH" ; LoadFlags 0x01 == load synchronously "LoadFlags"=dword:1 "BootPhase"=dword:0 "MountFlags"=dword:11 "Flags"=dword:1000 "MountAsBootable"=dword:1 ; for Hive-based registry [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\NANDFLASH] "DefaultFileSystem"="BINFS" "AutoPart"=dword:1 "AutoMount"=dword:1 "PartitionDriver"="mspart.dll" "Name"="Microsoft Flash Disk" "Folder"="ResidentFlash" "BootPhase"=dword:0 "MountFlags"=dword:11 "Flags"=dword:1000 [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\NANDFLASH\BINFS] "MountHidden"=dword:1 "MountAsROM"=dword:1 ; Keep FATFS from trying to shadow \Windows [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\NANDFLASH\FATFS] "FormatExfat"=dword:1 "Flags"=dword:14 ; deprecated in CE6.0 (0x4 : FATFS_DISABLE_AUTOSCAN, 0x10 : FATFS_ENABLE_BACKUP_FAT) "DisableAutoScan"=dword:1 "CheckForFormat"=dword:1 "EnableWriteBack"=dword:1 "Folder"="NandFlash" "MountAsRoot"=dword:1 ; for ROM-only file system "MountAsBootable"=dword:1 ; for Hive-based registry [HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\NANDFLASH\Filters\CacheFilt] "Dll"="cachefilt.dll" "LockIOBuffers"=dword:1 [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\NANDFLASH\FATFS\Filters\CacheFilt] "Dll"="cachefilt.dll" "LockIOBuffers"=dword:1 ENDIF ; BSP_NONANDFS ; END HIVE BOOT SECTION 在6.0下有cachefilt.dll但是还没有具体研究这个有撒用处 3: 修改WINCE特性,加入BINFS TFAT STOAREMANAGER 等,使用HIVE注册表,使用ROM ONLY文件系统 4: 修改CE.BIB让下面为XIPKERNEL包含 nk.exe kernel.dll hd.dll kd.dll osaxsto.dll osaxstl.dll coredll.dll oalioctl.dll k.coredll.dll filesys.dll romfsd.dll exfat.dll diskcache.dll cachefilt.dll fatutil.dll relfsd.dll binfs.dll imgfs.dll rawfs.dll romfilter.dll fsdmgr.dll fsdacl.dll mspart.dll ceddk.dll boot.hv initdb.ini 5:编译正常,正确生存XIPKERNEL.BIB NK.BIN CHAIN.BIN XIP.BIN 和 CHAIN.LST文件 支持将XIPKERNEL.NB0下载到XIPKERNEL区域,运行,下面为结果: FSDMGR!DllMain: DLL_PROCESS_ATTACH FSDMGR!STOREMGR_Initialize FSDMGR!InitializeStoreAPI FSDMGR!MountTable_t::RegisterVolumeName: Registered "StoreMgr" at index 2FSDMGR!MountTable_t::RegisterVolume: Registered volume at index 2 (Name="StoreMgr", MountFlags=0x1)FSDMGR!InitializeROMFileSystem: File System=ROM FSDMGR!MountTable_t::RegisterVolumeName: Registered "ROM" at index 3FSDMGR!MountTable_t::RegisterVolume: Registered volume at index 3 (Name="ROM", MountFlags=0x71)FSDMGR!STOREMGR_StartBootPhase BootPhase=0 (PrevBootPhase=-1) FSDMGR: File security disabled. FSDMGR!AutoLoadFileSystems: CurrentBootPhase=0, LoadFlags=1 FSDMGR!AutoLoadFileSystem: CurrentBootPhase=0, RootKey=System\StorageManager\AutoLoad, FileSystem_t=NANDFLASH FSDMGR!AutoLoadBlockDevice: Auto-loading block driver from "Drivers\BuiltIn\NANDFLASH"FSDMGR!MountStore: Failed opening new store "NANDFLASH"; error=4319 FSDMGR!StoreDisk_t::~StoreDisk_t: deleting store (D00251C0)FSDMGR!AutoLoadFileSystems: UnabFSDMGR!PNPThread: Using PNPUnloadDelay of 4096 FSDMGR!PNPThread: PNPThread starting! le to auto-load HKLM\System\StorageManager\AutoLoad\NANDFLASH; error=4319Exception 'Data Abort' (4): Thread-Id=005c0002(pth=83b0e264), Proc-Id=00400002(pprc=80508308) 'NK.EXE', VM-active=00400002(pprc=80508308) 'NK.EXE' PC=c004bc90(k.coredll.dll+0x0002bc90) RA=c0060668(k.coredll.dll+0x00040668) SP=d009f620, BVA=00000000 OEM: Not cleaning user profiles Exception 'Data Abort' (4): Thread-Id=005c0002(pth=83b0e264), Proc-Id=00400002(pprc=80508308) 'NK.EXE', VM-active=00400002(pprc=80508308) 'NK.EXE' PC=c004bc90(k.coredll.dll+0x0002bc90) RA=c0060668(k.coredll.dll+0x00040668) SP=d009fb04, BVA=00000000 不能正常初始化NANDFLASH..... 6: 修改CE.BIB 加入WINCE.NLS到XIPKERNEL,这个文件在5.0下我是没有包含进去的,后不出现'Data Abort 结果: FSDMGR!DllMain: DLL_PROCESS_ATTACH FSDMGR!STOREMGR_Initialize FSDMGR!InitializeStoreAPI FSDMGR!MountTable_t::RegisterVolumeName: Registered "StoreMgr" at index 2FSDMGR!MountTable_t::RegisterVolume: Registered volume at index 2 (Name="StoreMgr", MountFlags=0x1)FSDMGR!InitializeROMFileSystem: File System=ROM FSDMGR!MountTable_t::RegisterVolumeName: Registered "ROM" at index 3FSDMGR!MountTable_t::RegisterVolume: Registered volume at index 3 (Name="ROM", MountFlags=0x71)FSDMGR!STOREMGR_StartBootPhase BootPhase=0 (PrevBootPhase=-1) FSDMGR: File security disabled. FSDMGR!AutoLoadFileSystems: CurrentBootPhase=0, LoadFlags=1 FSDMGR!AutoLoadFileSystem: CurrentBootPhase=0, RootKey=System\StorageManager\AutoLoad, FileSystem_t=NANDFLASH FSDMGR!AutoLoadBlockDevice: Auto-loading block driver from "Drivers\BuiltIn\NANDFLASH"FSDMGR!MountStore: Failed opening new store "NANDFLASH"; error=4319 FSDMGR!StoreDisk_t::~StoreDisk_t: deleting store (D00251C0)FSDMGR!AutoLoadFileSystems: Unable to auto-load HKLM\System\StorageManager\AutoLoad\NANDFLFSDMGR!PNPThread: Using PNPUnloadDelay of 4096 FSDMGR!PNPThread: PNPThread starting! ASH; error=4319FSDMGR!STOREMGR_StartBootPhase BootPhase=1 (PrevBootPhase=0) FSDMGR!AutoLoadFileSystems: CurrentBootPhase=1, LoadFlags=1 OEM: Not cleaning user profiles FSDMGR!STOREMGR_StartBootPhase BootPhase=2 (PrevBootPhase=1) FSDMGR!AutoLoadFileSystems: CurrentBootPhase=2, LoadFlags=1 FSDMGR!AutoLoadFileSystems: CurrentBootPhase=2, LoadFlags=2 NANDFLASH还是不能正常初始化. |
|