The Windows Embedded CE 6.0 (R2) operating system mounts a File System at startup. By default, this File System is located in RAM and the content is the ROM (content of the nk.bin), this is the RAM and ROM File System. This FS is represented by a backslash (“\”). Additional File Systems can be mounted on the system (external storage) and will be accessible through subfolders of the root (\Hard Drive,…). The inconvenience with this configuration is that your persistent files must be located inside this subfolder, but you may want to be able to store those persistent files directly at the root of the main File System. In that case you have to enable the ROM-only File System.
To be able to mount the storage device as a root folder we have some prerequisites to check.
Mount the storage device in boot Phase 1The system is booting in different step, and drivers are usually loaded during the last boot step. To mount this storage area as root folder, you must load your storage device driver in the early steps of the boot. So Device Manager must be loaded first and then your block driver.
Start the Device ManagerThe device manager must be start at this Phase in order to be able to load the storage driver.
[HKEY_LOCAL_MACHINE\init\BootVars]
"Start DevMgr"=dword:1
Set the block driver to be loaded at this Phase of the boot.[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\]
"Profile"="FlashDisk"
…
"Flags"=dword:1000
You can notice in the registry setting above that we are associating this Storage driver to a Storage Manager profile using the Profile key. This profile will be used later to define the settings for this storage device (File System type, auto format, …). Flags key is used to specify to the device manager when the driver must be loaded.
Set the storage profileOnce the storage driver definition is done we have to specify to the Storage Manager how to use this storage space :
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FlashDisk]
"AutoMount"=dword:1
"AutoPart"=dword:1
"AutoFormat"=dword:1
"PartitionDriver"="mspart.dll"
"MountAsBootable"=dword:1
"Name"="NANDFLASH"
"Folder"="NandFlash"
"DefaultFileSystem"="FATFS"
For this storage (FlashDisk) we are enabling the FATFS file system, the content will be automatically formatted (AutoFormat) and partition will be created if the storage is blank (AutoPart). But one of the most important parameters is the MountAsBootable parameter, that will allow the system to access this storage during the boot.
To complete the configuration of the device we need to set the File System properties to finally make this Storage Device as Root.
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FlashDisk\FATFS]
"MountAsRoot"=dword:1
"MountAsBootable"=dword:1
"MountPermanent"=dword:1
Enable the ROM-only File SystemAt this step we are ready to select the ROM-only File System from the catalog to turn on this feature. After selecting this component you have to do a Clean Sysgen to fully enable the feature in your Windows CE binary image.
Note : You must include the file system replication filter in your OS design for ActiveSync to work correctly when you are mounting a file system as the root directory.
Erase the Storage contentBefore booting the device for the first time, the content of the storage device must be completely erased (most of the bootloaders provide a menu to clean up your storage device).
After booting all the files that you will store under \ will be accessible on the next boot.
Final noteTo clean up the registry file and to insert those settings only when the ROM-Only File System option is selected in your OSDesign, you can use IF statement with the SYSGEN_FSROMONLY variable.
- Nicolas