06/11/2009
飞思卡尔MX27+andflsh+wince5.0上的HIVE注册表实现(上)
今天整了一天的HIVE注册表的实现,发现这个和Flash的分区联系非常紧密。和官方中的说明比起来就显得非常的复杂了,下面来说下如何建立HIVE的具体操作:
官方的操作说明十分简单,总共分六步:
- Add the Hive-based Registry Catalog item to your OS design.
-
Verify the following registry settings in the Platform.reg file for your OS design.
[HKEY_LOCAL_MACHINE\init\BootVars]
"SystemHive"="<your system hive location>"
"Start DevMgr"=dword:<your value>
For more information about configuring the registry to support the hive-based registry, see Hive-based Registry Setup.
-
Set the following registry value in the Platform.reg file for your OS design to determine the default hive to load. [HKEY_LOCAL_MACHINE\init\BootVars]
"DefaultUser"="<username>"
-
Verify that all registry entries necessary for starting drivers in the first boot phase are wrapped in the comments.
The following code example shows typical comments.
; HIVE BOOT SECTION
<your registry settings>
; END HIVE BOOT SECTION
These tags are commands that tell the ROM registry builder to add the entries to the boot hive.
-
Set the following flag bit on each driver that is loaded during the first boot phase.
[HKEY_LOCAL_MACHINE\Drivers\...]
"Flags"=dword:1000
The flags are a bitmask to OR with any existing settings. This flag tells the Device Manager to load your driver in the first boot phase with the boot registry, and not to load it a second time in the second boot phase with the system registry. It prevents the driver from being started twice.
-
Set the MountFlags registry value equal to DWORD:2.
Set this value on the Storage Manager profile of the file system driver for the medium that contains the registry.This indicates that the file system contains the following registry key. [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<ProfileName>\<FileSystemName>] "MountFlags"=dword:2
-
Decide whether a registry flushing mechanism is necessary.
Outstanding registry data will be flushed on a suspend or resume cycle and any time the system goes through a software shutdown.However, data may be lost if power is suddenly removed. If a software shutdown is not an option, you may need to create a thread that periodically flushes data. To ensure that data is not lost, call RegFlushKey. This will flush any unsaved changes in the hive to the persistent file. It will not damage anything to call RegFlushKey when no data has changed; in that case, the file will not be touched. RegFlushKey should be called on both the system hive HKEY_LOCAL_MACHINE and the user hive HKEY_CURRENT_USER.
以上就是官方建立HIVE注册表的步骤了,可是实际操作远远没有这么简单。
2009-11-06 10:35 在自己项目的平台上折腾了两天了,今天才恍然大悟,改动了eboot却没有将eboot烧到板子上,真是失策。现在板子又出问题了,真是祸不单行。
2009-11-06 15:38 问题终于解决,是串口板的问题,换了块串口板就可以烧eboot了。可是又有新的问题出现了,eboot烧了进去之后跑不起来。我的天啊!
现在问题找到了,浪费了大把的时间。具体问题记录下来:
- 通过Advanced ToolKit V1.60串口工具将nandloard和eboot烧入flash上电之后系统无反应。但是烧以前的eboot却可以。
- 这样只有烧入以前的eboot之后再通过eboot的选项来更新eboot,PB打开eboot.bin通过usb口下载更新然后出错,错误为:eboot的大小超出了保留的大小,崩溃!回头一查298k,确实是超过了256k的大小,可是为什么会变这么大,仔细一想,自己更新过开机启动的画面,加了一幅图进取,所以整个eboot变大了。
- 删除开机启动画面的图片,重新编译,更新eboot失败。再次崩溃!
- 重新回到串口更新eboot的程序,重新来一遍,终于ok了,唉!
通过更改eboot目前可以将整个flash分为三个分区了:part00(binfs),part001(fatfs),part03(boot)但是可惜的是fat分区还是没有挂起,明天来搞挂起吧,希望不要这么曲折了。