天天看点

Hive-based Registry

我通过以下几个步骤在nk.bin中添加hive-based   registry功能  

  1.在   "File   Systems   and   Data   Store"   --   "Registry   Storage"內,選擇   "Hive-based   Registry"    

  2.在   "File   Systems   and   Data   Store"   --   "Storage   Manager"內,選擇   "FAT   File   System"    

  在   "HARWARE   SUPPORT"   --   "ATAPI"    

  3.   加环境变量BSP_ENABLE_FSREGHIVE   =   1    

  4.接下来就是修改注册表项。    

  修改platform.reg如下    

  [HKEY_LOCAL_MACHINE/init/BootVars]    

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

  "PROFILEDIR"="Documents   and   Settings"    

  "Start   DevMgr"=dword:0  

  IF   BSP_ENABLE_FSREGHIVE        

        "Start   DevMgr"=dword:1  

  ENDIF        

  [HKEY_LOCAL_MACHINE/init/BootVars]    

  "DefaultUser"="default"    

  [HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/HDProfile]    

  "MountFlags"=dword:2    

使用这样的注册表需要下面这些步骤(都是帮助上的),但是感觉除了第一步,好像都不需要动吧,除了   要加入自己的键值  

  Using   the   Hive-based   Registry  

  Once   you   have   chosen   to   use   the   hive-based   registry   as   the   registry   for   your   device,   you   can   then   implement   the   hive-based   registry.   After   you   have   implemented   the   hive-based   registry   you   can   then   persist   registry   data   during   a   cold   boot   of   the   OS.  

  To   use   the   hive-based   registry    

  1   Add   the   Hive-based   Registry   Catalog   entry   to   your   device   configuration.    

  2   Verify   the   following   registry   settings   in   the   Platform.reg   file.    

  [HKEY_LOCAL_MACHINE/init/BootVars]  

          "SystemHive"="<your   system   hive   location>"  

          "Start   DevMgr"=dword:<your   value>  

  For   more   information   on   configuring   the   registry   to   support   the   hive-based   registry,   see   Hive-based   Registry   Setup.    

  3   Set   the   following   registry   value   in   the   Platform.reg   file   to   determine   the   default   user   hive   to   load.    

  [HKEY_LOCAL_MACHINE/init/BootVars]  

          "DefaultUser"="<username>"  

  4   Verify   that   all   registry   entries   necessary   for   starting   drivers   in   the   first   boot   phase   are   wrapped   in   the   comments.   These   drivers   are   used   to   access   the   persistent   file   system   where   the   hives   are   stored.    

  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.    

  5   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.    

  6   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  

  7   Decide   whether   a   registry   flushing   mechanism   is   necessary.    

  Outstanding   registry   data   will   be   flushed   on   a   suspend   or   resume   cycle   and   any   time   the   OS   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.   You   can   call   RegFlushKey   when   no   data   has   changed;   in   that   case,   the   file   will   not   be   touched.   RegFlushKey   should   be   called   on   both   the   OS   hive   HKEY_LOCAL_MACHINE   and   the   user   hive   HKEY_CURRENT_USER.     

    1。首先确保硬盘能访问到(添加fatfs,atapi组件),就是首先要把硬盘驱动起来。    

  2。在   "File   Systems   and   Data   Store"   --   "Registry   Storage"內,選擇   "Hive-based   Registry"    

  3。接下来就是修改注册表项。    

  修改platform.reg如下    

  [HKEY_LOCAL_MACHINE/init/BootVars]    

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

  "PROFILEDIR"="Documents   and   Settings"    

  "Start   DevMgr"=dword:1    

  [HKEY_LOCAL_MACHINE/init/BootVars]    

  "DefaultUser"="default"    

  [HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/HDProfile]    

  "MountFlags"=dword:2