Chinaunix首页 | 论坛 | 博客
  • 博客访问: 332903
  • 博文数量: 97
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 636
  • 用 户 组: 普通用户
  • 注册时间: 2014-10-12 22:41
文章分类

全部博文(97)

文章存档

2017年(8)

2015年(87)

2014年(2)

我的朋友

分类: 嵌入式

2015-06-13 13:47:19

本文介绍在i.mx6 wince7.0系统emmc上HIVE注册表的实现,emmc的路径为:MMCMemory

 

1、HIVE注册表的加载步骤

     a) NK.exe执行,启动Filesys.dll。Filesys.dll首先加载Boot Hive,此时Boot Hive位于NK.bin解压之后的文件中。然后,filesys.dll在启动device.dll后处于等待状态,等待device.dll将包含System Hive的文件系统的存储设备的驱动程序加载完毕,而这个文件系统的存储设备的驱动程序在Boot Hive中;

     b) Device.dll在上述驱动开始工作之后进入等待状态,然后filesys.dll被唤醒,加载并且安装System Hive,然后filesys.dll再次处于等待状态;

     c) NK.exe按照System Hive的信息开始执行初始化工作,包括加载驱动和启动一些应用程序。其中加载驱动一般由device.dll执行,而启动应用程序由filesys.dll执行,这时device.dll和filesys.dll都被唤醒

     d) 因为Boot Hive和System Hive可能都有重复的地方,所以可能重复加载了驱动或重复启动了应用程序。为此,windows CE允许在描述驱动程序的注册表信息中加入防止重复的标志

 

2、实践操作

    a) 添加Hive注册表所需要的组件如下:


    b) 添加全局变量

    SET PRJ_ENABLE_REGFLUSH_THREAD=1    ;该全局变量是自动保存注册表所需

    set PRJ_ENABLE_FSREGHIVE=1                 ;这个属于PRJ Environment Variables ,在MSDN上描述为:Controls whether the hive-based registry is enabled by default

相关msdn条词在:Windows Embedded Compact 7 > Reference > Environment Variables >

(ms-help://MS.VSCC.v90/MS.VSIPCC.v90/MS.WindowsCompact.v70.en/WECP_Ref_EnvVar/html/d497612e-796d-4d1b-a836-729c43ca6170.htm)

 

    c)添加注册表

    从HIVE注册表加载步骤中可以得知,HIVE注册表的加载首先需要由device.dll 初始化设备驱动,然后由filesys.dll加载文件系统并读取出System.hv,再交由device.dll按照注册表加载驱动

    因此我们在注册表中需要的信息有:设备驱动相关注册表、文件系统相关注册表、BootVars相关注册表。 这里将所有的注册表和需要注意事项通过注释写出来

点击(此处)折叠或打开

  1. ; HIVE BOOT SECTION
  2. ; BootVars
  3. ;
  4. ; We want start both storage and device manager. Flags value is combination of
  5. ; 0x0001 Start storage manager in boot phases 0 and 1 to load the boot
  6. ; file system.
  7. ; 0x0002 Start device manager in boot phase 1 to load the boot file system.
  8. ;
  9. [HKEY_LOCAL_MACHINE\Init\BootVars]
  10.     "Flags"=dword:3
  11.  ; "SystemHive"="\\Documents and Settings\\system.hv" 这里需要删除,添加后USB同步无法使用,且一旦添加同步后,系统死机 ,分析原因:CE7默认路径不是这儿
  12.  ; "ProfileDir"="\\Documents and Settings"
  13.  ; "DefaultUser"="default"
  14.  ; "RegistryFlags"=dword:0    ;这里设置为0,设置为1的话系统起不来,不知为何,且网贴有介绍称设置为1会影响系统效率,因为每次读写均在flash中
  15. ; RegistryFlags: 0:Lazy Flush 1:auto save when modify 2:;Disable background registry flushing to improve performance.
  16. ; END HIVE BOOT SECTION


  17. ; HIVE BOOT SECTION
  18. ; SD Drivers 这里添加SD卡加载所需的驱动注册表
  19. [HKEY_LOCAL_MACHINE\Drivers\Builtin\SDBusDriver]
  20.    "Order"=dword:15
  21.    "Dll"="SDBus.dll"
  22.    "Prefix"="SDC"
  23.    "ThreadPriority"=dword:64 ; default thread priority for dispatch thread
  24.    "RequestListDepth"=dword:30 ; pre-allocated requests
  25.    "IClass"=multi_sz:"{20FA98A8-B298-4b32-8D72-C716AEE2FA84}=%b","{6F40791D-300E-44E4-BC38-E0E63CA8375C}=%b"
  26.    "BootPhase"=dword:1            ; change to 1
  27.     "Flags"=dword:1000            ; 设置Flags信息,该注册表信息在系统阶段不会被加载
  28.    
  29. [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\USDHC4]
  30.     "Order"=dword:20
  31.     "Dll"="usdhc.dll"
  32.     "Prefix"="SHC"
  33.     "Index"=dword:4
  34.     ;"DisableDMA"=dword:1 ; Use this ;reg setting to disable both internal and external DMA
  35.     "MaximumClockFrequency"=dword:3197500 ; 52 MHz max clock speed
  36.     ;"WakeupSource"=dword:1 ; this will enable system wakeup when card is inserted or removed during suspend state
  37. ; "CardDetectOpt"=dword:0
  38.     "Flags"=dword:1000
  39.     
  40. ; MMC Drivers
  41. ; MMC Storage Class Driver 这一部分的驱动,在后续加载SD卡时还会被用到,因此不应该添加Flags = 1000
  42. [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory]
  43.     "Name"="SD Memory Card"
  44.     "Folder"="SDMemory"
  45. ;    "Flags"=dword:1000
  46.  ;"PartitionDriver"="" ; removable storage cannot have partitions

  47. [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory\FATFS]
  48.     "FormatFatVersion"=dword:10 ; standard sd cards require fat12 or fat16, and cannot use fat32
  49. ;    "Flags"=dword:1000
  50. [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDHCMemory]
  51.     "Name"="SD Memory Card"
  52.     "Folder"="SDHCMemory"
  53.     ;"PartitionDriver"="" ; removable storage cannot have partitions
  54. ;    "Flags"=dword:1000
  55. [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDHCMemory\FATFS]
  56.     "FormatFatVersion"=dword:20 ; high capacity SD cards need to use fat32 and cannot use fat16
  57. ;    "Flags"=dword:1000

  58. [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MMC]
  59.     "Name"="MMC Card"
  60.     "Folder"="MMCMemory"
  61.     "FormatTfat"=dword:1
  62.     "MountAsBootable"=dword:1
  63.     "MountPermanent"=dword:0
  64. ;    "Flags"=dword:1000    
  65. [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MMC\FATFS]
  66.    "FormatTfat"=dword:1
  67.    "AutoMount"=dword:1
  68.    "AutoPart"=dword:1
  69.    "AutoFormat"=dword:1
  70.    "DisableAutoFormat"=dword:0
  71.     "FormatTfat"=dword:1
  72.     "MountAsBootable"=dword:1
  73.     "MountPermanent"=dword:0
  74. ;     "Flags"=dword:1000
  75. [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MMC\EXFAT]
  76.    "FormatTfat"=dword:1
  77.    "AutoMount"=dword:1
  78.    "AutoPart"=dword:1
  79.    "AutoFormat"=dword:1
  80.    "DisableAutoFormat"=dword:0    
  81. ;    "Flags"=dword:1000    
  82. ; SD Memory Storage class driver
  83. [HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\SDMemory_Class]
  84.    "Dll"="SDMemory.dll"
  85.    "Prefix"="DSK"
  86.    "BlockTransferSize"=dword:40 ; send no more than 64 blocks of data per bus transfer
  87.    ;"SingleBlockWrites"=dword:1 ; alternatively force the driver to use single block access
  88.    ;"IdleTimeout"=dword:7D0 ; 2000 milliseconds
  89.    ;"IdlePowerState"=dword:2 ; 0 == D0, 1 == D1, etc.
  90.    ;"DisablePowerManagement"="" ; if value present, then disable (remove value to enable)
  91. ;    "Flags"=dword:1000
  92.    "Profile"="SDMemory"
  93.    "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}",
  94.                      "{8DD679CE-8AB4-43c8-A14A-EA4963FAA715}"

  95. ; SDHC Memory Storage class driver
  96. [HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\SDMemory_Class\High_Capacity]
  97.    "Dll"="SDMemory.dll"
  98.    "Prefix"="DSK"
  99.    "BlockTransferSize"=dword:40 ; send no more than 64 blocks of data per bus transfer
  100.    ;"SingleBlockWrites"=dword:1 ; alternatively force the driver to use single block access
  101.    ;"IdleTimeout"=dword:7D0 ; 2000 milliseconds
  102.    ;"IdlePowerState"=dword:2 ; 0 == D0, 1 == D1, etc.
  103.    ;"DisablePowerManagement"="" ; if value present, then disable (remove value to enable)
  104. ;    "Flags"=dword:1000
  105.    "Profile"="SDHCMemory"
  106.    "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}",
  107.                      "{8DD679CE-8AB4-43c8-A14A-EA4963FAA715}"

  108. ; MMC Storage Class Driver
  109. [HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\MMC_Class]
  110.    "Dll"="SDMemory.dll"
  111.    "Prefix"="DSK"
  112.    "BlockTransferSize"=dword:40 ; send no more than 64 blocks of data per bus transfer
  113.    ;"SingleBlockWrites"=dword:1 ; alternatively force the driver to use single block access
  114.    ;"IdleTimeout"=dword:7D0 ; milliseconds
  115.    ;"IdlePowerState"=dword:2 ; 0 == D0, 1 == D1, etc.
  116.    ;"DisablePowerManagement"="" ; if value present, then disable (remove value to enable)
  117. ;    "Flags"=dword:1000
  118.    "Profile"="MMC"
  119.    "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}",
  120.                      "{8DD679CE-8AB4-43c8-A14A-EA4963FAA715}"

  121. [HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\MMC_Class\High_Capacity]
  122.    "Dll"="SDMemory.dll"
  123.    "Prefix"="DSK"
  124.    "BlockTransferSize"=dword:40 ; send no more than 64 blocks of data per bus transfer
  125.    ;"SingleBlockWrites"=dword:1 ; alternatively force the driver to use single block access
  126.    ;"IdleTimeout"=dword:7D0 ; milliseconds
  127.    ;"IdlePowerState"=dword:2 ; 0 == D0, 1 == D1, etc.
  128.    ;"DisablePowerManagement"="" ; if value present, then disable (remove value to enable)
  129. ;    "Flags"=dword:1000
  130.    "Profile"="MMC"
  131.    "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}",
  132.                      "{8DD679CE-8AB4-43c8-A14A-EA4963FAA715}"


  133. ; END HIVE BOOT SECTION

  134. ;*********************************************************************************************************
  135. ;
  136. ; 注册表自动保存注意事项:
  137. ;
  138. ; 下面每间隔1秒(FlushPeriod的值)就会检查注册表是否有改变, 有则保存注册表,
  139. ;
  140. ; 使能时, 必须设置环境变量: SET PRJ_ENABLE_REGFLUSH_THREAD=1
  141. ;
  142. ; 同时, 还要"RegistryFlags"=dword:1改成dword:0,不用每次注册表修改就自动去flush注册表。
  143. ;
  144. ;*********************************************************************************************************

  145. IF PRJ_ENABLE_REGFLUSH_THREAD
  146. [HKEY_LOCAL_MACHINE\System\ObjectStore\RegFlush]
  147. ; To monitor the flushing from an external process add "ActivityName" registry value.
  148. ; The activity name is a global named event that filesystem will signal on Registry Activity.
  149. ; "ActivityName"=""
  150. ; Create an thread in filesys to perform flushing
  151.     "SpawnThread"=dword:1
  152. ; Make the thread IDLE priority
  153.     "FlushPriority256"=dword:FF
  154. ; ActivityThreshold specifies the # of reg activity before we force a flush
  155.     "ActivityThreshold"=dword:100
  156. ; Timeout period for a flush (flush occurs if there have been some changes during this period)
  157.     "FlushPeriod"=dword:3E8
  158. ENDIF

阅读(2446) | 评论(0) | 转发(0) |
0

上一篇:imx6 设置为sd卡启动

下一篇:wince格式化nand

给主人留下些什么吧!~~