none
Need help with persistent registry. RRS feed

  • Question

  • Hi everyone,

    I am using WinCE 6.0 R3 and BSQUARE BSP for my OMAP3530-based custom board.  It runs OK without persistent registry.  I have just created a debug build with persistent registry and during the image download, I see a lot of errors on the debug output.  I had the output saved in a file but it is too long to put here.  It contains a lot of the following messages:

    FATFS!FindNextFile: Invalid search name reg:'
    CACHEFILT:GetFileAttributesW, !! Failed, error=123

     After getting to the Explorer shell, I check "My Device" and no longer see the folder "Mounted Volume",  which contains all my files, as I had before enabling persistent registry.

    I appreciate your help looking at what I did below to see if I am missing anything or do anything wrong.

    Thanks,
    Luan

    In my batch build file, I added

    set IMGREGHIVE=1
    if /i "%IMGREGHIVE%"=="1" set PRJ_ENABLE_FSREGHIVE=1
    if /i "%IMGREGHIVE%"=="1" set PRJ_ENABLE_REGFLUSH_THREAD=1
    if /i "%IMGREGHIVE%"=="1" set PRJ_ENABLE_FSMOUNTASROOT=1
    if /i "%IMGREGHIVE%"=="1" set PRJ_BOOTDEVICE_MSFLASH=1

    In the Catalog, I have the followings included:

    RAM and ROM File System
    exFAT File System
    Hive-based Registry
    FAT File System
    Partition Driver

    In platform.reg,

    ; @CESYSGEN IF FILESYS_FSREGHIVE
    ; HIVE BOOT SECTION

    [HKEY_LOCAL_MACHINE\Init\BootVars]
        "Flags"=dword:3

    IF IMGREGHIVE
    [HKEY_LOCAL_MACHINE\init\BootVars]
        "SystemHive"="Documents and settings\\system.hv"      ; Set the location and name of the system hive file
        "ProfileDir"="Documents and settings"
        "Start DevMgr"=dword:1 ; Start storage manager in boot phase 1 for hive-based registry
    ENDIF IMGREGHIVE


    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\MSFlash]
        "Flags"=dword:00011000  ; load driver in boot phase 1; do not load again later

    ; END HIVE BOOT SECTION
    ; @CESYSGEN ELSE

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\MSFlash]
        "Flags"=dword:00010000

    ; @CESYSGEN ENDIF FILESYS_FSREGHIVE
    ;-------------------------------------------------------------------------------

    ;-- Storage Manager Configuration ----------------------------------------------
    ; @CESYSGEN IF CE_MODULES_FSDMGR
    ;
    ; HIVE BOOT SECTION

    [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash]
        "DriverPath"="Drivers\\BuiltIn\\MSFlash"
        "LoadFlags"=dword:1
    IF IMGREGHIVE
        "BootPhase"=dword:1          ; Make NAND available in BootPhase1, to load the persisted registry
    ELSE

        "BootPhase"=dword:0
    ENDIF
        "Order"=dword:0

    [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash\FATFS]
    IF IMGREGHIVE
        "MountAsRoot"=dword:1
        "MountAsBootable"=dword:1    
        "MountPermanent"=dword:1     ; Do not allow un-mounting (else we'd fail to flush the registry)
        "MountAsROM"=dword:0
        "MountHidden"=dword:0
     "CheckForFormat"=dword:1     ; Ask the OAL if we should format on boot (i.e. cold reset)
    ENDIF

        "Flags"=dword:00000014
        "FormatTFAT"=dword:1
        "EnableWriteBack"=dword:1

    ; END HIVE BOOT SECTION
    ; @CESYSGEN ENDIF CE_MODULES_FSDMGR

     


    Luan Le
    Friday, November 12, 2010 9:54 PM

Answers

  • Hi Bruce,

    I add a call RegFlushKey() after TouchCalibrate() in the touch driver and that does the job.

    Appreciate your help,

    Luan


    Luan Le
    • Marked as answer by LuanLe Tuesday, November 16, 2010 10:43 PM
    Tuesday, November 16, 2010 10:43 PM

All replies

  • I am not sure what the errors are, did you do a clean sysgen after adding the hive component?

    The disk doesn't show as Mounted Volume for one of two reasons; it didn't mount or it is mounted as the root folder.  I suspect that it is mounted as the root folder.  Try saving a file and see if the file is there after reboot, if it is then the disk is mounted as the root folder.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Saturday, November 13, 2010 1:40 PM
    Moderator
  • Hi Bruce,

    Youaare right.  It is mounted as the root folder. I created new folder at the root and copied files to it. Everything remains across power cycles. I just tried to see if could save the touch screen calibration data but calibration is still required after each power cycle. Would you please show me what I need to do next to persist the touch screen calibration data?

    Thanks,

    Luan


    Luan Le
    Tuesday, November 16, 2010 4:54 PM
  • That is going to depend.  If it is a Windows CE touch driver architecture, then the calibration data would be saved to the registry and should be persistent.  So the reasons that I can think of that it would not have been persisted are:

    1. You didn't flush the registry, to test you can suspend/resume or write a little app to call RegFlushKey()

    2. It is not a Windows CE touch driver architecture, and isn't saving the data to the registry.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Tuesday, November 16, 2010 5:29 PM
    Moderator
  • Hi Bruce,

    I add a call RegFlushKey() after TouchCalibrate() in the touch driver and that does the job.

    Appreciate your help,

    Luan


    Luan Le
    • Marked as answer by LuanLe Tuesday, November 16, 2010 10:43 PM
    Tuesday, November 16, 2010 10:43 PM
  • Hi Luan,

    Refering to the debug message listed below:

       "SystemHive"="Documents and settings\\system.hv"      ; Set the location and name of the system hive file

    I think the location for 'SystemHive' should be some persistent folder on NAND. I believe the folder "Documents and settings" is not a persistent location. The updates in this folder are lost after powering OFF the device.

    Hi Bruce,

    Please correct me if I am wrong. I am not very sure, but this is what we did in our device to implement HIVE based registry.

    Mansukh 

    Wednesday, November 17, 2010 7:29 AM
  • SystemHive sets the location on the disk that is used for hive registry.  As the documentation states "Do not include the name of the file system on which the file will be stored".

    So because Luan is mounting the disk as root, this puts the system hive in \Documents and Settings. 

    If you are using a disk named NAND and not mounting as root, then yours would be in \NAND\Documents and Settings.  But if you don't actually have hive set up correctly, including the disk in SystemHive may actually cause it to work.  By default, hive registry will be placed in RAM, so there is an environment variable that must be set to tell hive registry to be put on a disk.  That variable is PRJ_ENABLE_FSREGHIVE.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Wednesday, November 17, 2010 12:01 PM
    Moderator
  • Thanks, Bruce. Hi Luan, In that case, the 'SystemHive' location may not be an issue. Regards, Mansukh
    Thursday, November 18, 2010 3:33 AM