S3c2440A平台HIVE注册表+binfs的实现
2014-11-10
标签: S3C2410

推荐:英文版

The binfs filesystem based WinCE image is divided into two part. Part I: XIPKERNEL region ; Part II: NK region. Part I hold the files that need to be copied to the RAM and excute in XIP mode in boot phase 0 , Part II hold the others system modules or files are needed but not nessessary and frenqencely invoked.

And while the HIVE based Registry is make up with boot.hv , user.hv and default.hv, these three files can also be divided into two part. Part I: boot.hv , Part II:user.hv and default.hv. Part I must be saved into the image part I which is XIPKERNEL region and Part II can saved in both XIPKERNEL or NK region.

UT will copy all the files in the XIPKERNEL include the boot.hv to the RAM at every cold boot time, at this time,the RAM region take up by the XIPKERNEL is action as ROM. The WinCE OS will start up from the special address in the RAM region after the UT finished the moving job and then the WinCE will init the CPU , MMC , interrupt and some other things are nessessary , include init the filesys.exe and Registry API. Because kernel is Registry dependent, boot.hv must be readed and parsed now.

Are there somethings else must be added into the XIPKERNEL?

Because the WinCE need the files such as device.exe which is save in the NK region default, so we must enable binfs and then the files in NK region can be available. These Registry entries descript how to configurate the binfs must be hold by boot.hv and the relatived DLL file must be saved in the XIPKERNEL region.

Some other module and files needed in this boot phase will be add automatically by the platform builder 5.0 thought the common.bib setting.

Are all the DLL files descripted in the boot.hv must be saved into the XIPKERNEL region?

The answer is no! Because binfs will waked in very early time and all the files in the NK region will be available after binfs is loaded normally, so the DLL files such as the flash stream driver ONDISK.DLL can also be saved in NK region and it will be available for WinCE when the time it is needed.

After finished the boot.hv boot phase and binfs is available, the WinCE OS will read the system hv Registry from XIPKERNEL or NK region, but before continue, you must load the FAT partition that will hold the system.hv first. So we must mention which disk partion will hold the system hive file and add all the relatived Registry entries into the boot.hv. The WinCE OS will parse the system hv and continue its boot up progress after the relatived FAT parttiion is available.

The boot sequence is like this:

BootLoader --> OEMinit --> Load boot.hv --> Init binfs --> Load default.hv from binfs --> Load device.exe from binfs --> device.exe load other drivers in default.hv --> Load user.hv --> Load explorer.exe

Implementation:

1. Change to the Hive-based Registry Component in PB5.0

To enable Hive-based Registry on WinCE, firstly you need add the Hive-based Registry Catalog item(SYSGEN_FSREGHIVE) to your OS design. Once you add it, The Hive-based Registry component will replace RAM-based Registry automatically.

2. Add the following registry setting in the platform.reg

[HKEY_LOCAL_MACHINE\init\BootVars]

"SYSTEMHIVE"="Documents and Settings\\system.hv"

"PROFILEDIR"="Documents and Settings"

"Start DevMgr"=dword:1;这个说是启动device.exe,但是wince 5.0好像不用这个

"DefaultUser"="default";咱们只有一个用户default,基本上就是决定user.hv的路径了

"Flags"=dword:3 ;这个应该是wince 5.0下决定在哪个阶段启动device.exe的表项

"RegistryFlags"=dword:1;这个就是设置注册表每次改动后自动flush到system.hv

3. Add binfs driver into the boot phase 0

You should let binfs is variable before the OS need the Registry entries saved in the default.hv and user.hv, so you need add all the binfs relatived Registry entries into boot.hv and add the binfs driver DLL file into XIPKERNEL region.

Verify the binfs Registry entries is sandwich between the labels:

;HIVE BOOT SECTION

;END HIVE BOOT SECTION

1)Add the following registry setting in the platform.reg:

;HIVE BOOT SECTION

;###########################################################################

;这个部分是binfs的注册表项,如果你不是用的binfs那么不用将它们拉到boot.hv中

[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\SMFlash]

"DriverPath"="Drivers\\BlockDevice\\SMFlash"

"LoadFlags"=dword:1

"MountFlags"=dword:11

"BootPhase"=dword:0

"Flags"=dword:1000 ; 这个flag标签让你的驱动不会重复加载,下面类似

[HKEY_LOCAL_MACHINE\Drivers\BlockDevice\SMFlash]

"Prefix"="DSK"

"Dll"="BIBDrv.dll"

"Order"=dword:0

"Ioctl"=dword:4

"Profile"="SMFlash"

"FriendlyName"="Samsung Flash Driver"

"MountFlags"=dword:11

"BootPhase"=dword:0

"Flags"=dword:1000

; Bind BINFS to the block driver

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SMFlash]

"DefaultFileSystem"="BINFS";binfs的路径为/BINFS

"PartitionDriver"="mspart.dll"

"AutoMount"=dword:1

"AutoPart"=dword:1

"MountFlags"=dword:11

"Folder"="ResidentFlash"

"Name"="Samsung Flash Disk"

"BootPhase"=dword:0

"Flags"=dword:1000

"MountHidden"=dword:0 ;有了这个你就可以在/BINFS目录下看到所有的NK.bin的东东了

;###########################################################################

;END HIVE BOOT SECTION

2) In platform.bib add binfs DLL file into XIPKERNEL(If it has be added in common.bib , you can skip this step):

BIBDrv.dll$(_FLATRELEASEDIR)\ BIBDrv.dll$(XIPKERNEL)SH

4. Start all drivers that control the media on which the system hive registry is stored in the first boot phase

We using PocketStoreII15 driver as the flash driver and we select the first FAT flash partitions to store the system hive Registry file. So we need add the following registry setting in the platform.reg:

;HIVE BOOT SECTION

;###########################################################################

;这个部分是设置保存system.hv的磁盘的驱动程序,每个人不一样了,但是大同小异

;这里用的是PoketStroeII15的Flash驱动,system.hv保存在第一个Flash分区上

IF BSP_POCKETSTORE

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\PocketStore]

"Prefix"="DSK"

"Dll"="ONDisk.dll"

"Order"=dword:1

"Profile"="PocketStore"

"IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"

"BmlVolumeId"=dword:0 ; BML volume ID = 0

"BmlPartitionId"=dword:8 ; BML parition ID = PARTITION_ID_FILESYSTEM

"Index"=dword:2

"Flags"=dword:1000;这个flag指定这个驱动只在boot.hv中加载一次

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\PocketStore]

"DefaultFileSystem"="FATFS"

"PartitionDriver"="mspart.dll"

"AutoMount"=dword:1

"AutoPart"=dword:1

"AutoFormat"=dword:1

"MountAsBootable"=dword:1;这个是wince 5.0下指定这个分区保存system.hv

"Folder"="HDD"

"Name"="NAND Drive"

"Ioctl"=dword:4

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\PocketStore\FATFS]

"EnableCacheWarm"=dword:0

ENDIF

;###########################################################################

;END HIVE BOOT SECTION

5. Add the boot hive registry file in XIPKERNEL region

When Hive based Registry feature is setted in the PB5.0 , default.fdf will not be generated, so we must delete it from platform.bib and while we must add the boot.hv into the XIPKERNEL region. Default.hv and user.hv can saved in either NK region or XIPKERNEL region.

1) In platform.bib, delete the entry:

; default.fdf$(_FLATRELEASEDIR)\default.fdf$(XIPKERNEL)SH

2) In platform.bib add boot.hv into XIPKERNEL:

boot.hv$(_FLATRELEASEDIR)\boot.hv$(XIPKERNEL)SH

What will cause the system can not boot up normally?

1.You didn’t add the binfs Registry entries into the boot.hv or relatived dll is not added into the XIPKERNEL.bin. I suggest you using a third-part tool named d_readvol.exe to convent the boot.hv from binary to understandable text format. You can find it by searching on google.

2.You didn’t add the Registry of the FAT partition which will hold the persist Registry files into the boot.hv.

3.You not mention which FAT partion to hold the persist Registry file. You should add "MountAsBootable"=dword:1 under the profile key entry of the disk partition.

4.You not write some other Registry entries in right way.

本文引用须注明来源:http://blog.csdn.net/fredzeng

共 2 页   上一页12
可能会用到的工具/仪表
本站简介 | 意见建议 | 免责声明 | 版权声明 | 联系我们
CopyRight@2024-2039 嵌入式资源网
蜀ICP备2021025729号