Re: Making flash the root file system

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Tony,
It looks like your FlashDisk profile has AutoFormat and AutoPart set to 1.
If the block driver is reformatting every bootup, that would expalin why the
file system formats every time you reboot.
In these examples, AutoFormat and AutoPart are set to 0:
http://msdn2.microsoft.com/en-us/library/ms892393.aspx

I hope this helps.

Best regards,
Gary

<tony@xxxxxxxxxxxxx> wrote in message
news:1181243880.273244.202000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have been posting and getting responses on the following thread:

http://groups.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/781ae18f7672e308/9c607c8638e297e8#9c607c8638e297e8

Suddenly I can't post to it. I try to post and it says post
successful, but the post never shows up. I waited for an hour and it
still didn't show up. Normally it shows up within a few seconds or
minutes at the most.

I hope noone minds that I start a new thread because of that.

If you read that thread you saw that I had trouble just getting the
flash driver to load. I have the flash driver loading and a new drive
on my device called NAND Flash. I can create folders and files on this
drive and everything works fine.

I have the following registry settings:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\NandFlash]
"Dll"="nandfcd.dll"
"Order"=dword:0
"Prefix"="DSK"
"Profile"="FlashDisk"
"IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"
"FriendlyName"="i.MX21 NAND FLASH Driver"

; These can overridden in the particular named profile
; Various Flags
; AutoFormat - Formats the store automatically
; AutoPart - Automatically partitions the store with largest
creatable partition
; AutoMount - Automatically Mounts each detected partition (if FSD
driver is available)
; MountFlags (deprecated in WinCE 5.0)- Flags on how the partition
is mounted
; 1 - Hidden file system
; 2 - May contain system registry
; 4 - Mount as root of file system, "\"
; 8 - Hide ROM when mounting FS root
; 10 - Mount filesystem as an external ROM filesystem
; 20 - Treat all files and subdirectories as system files
; The following registry values replace the MountFlags:
; MountHidden - Hidden file system (same as MountFlags=1)
; MountAsBootable - May contain system registry (same as
MountFlags=2)
; MountAsRoot - Mount as root of file system, "\" (same as
MountFlags=4)
; MountAsROM - Mount as an external ROM filesystem (same as
MountFlags=10)
; MountSystem - Treat all files and subdirectories as system
files (same as MountFlags=20)

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FlashDisk]
"Name"="i.MX21 NAND FLASH"
"Folder"="NAND Flash"
"DefaultFileSystem"="FATFS"
"AutoMount"=dword:1
; Auto part and format disk if no partitions are present.
; WARNING! This can cause long boot times when encountering a
fresh disk.
"AutoPart"=dword:1
"AutoFormat"=dword:1

; Default values for fatfs. These can be overridden per profile
; Flags DWORD See available flags below
; Valid Bits for Flags registry value
;FATFS_UPDATE_ACCESS 0x00000001 update access times if
set
;FATFS_DISABLE_LOG 0x00000002 disable event logging if
set
;FATFS_DISABLE_AUTOSCAN 0x00000004 disable automatic
ScanVolume()
;FATFS_VERIFY_WRITES 0x00000008 verify all writes (as
opposed to a handful)
;FATFS_ENABLE_BACKUP_FAT 0x00000010 add a backup FAT to all
formats
;FATFS_FORCE_WRITETHROUGH 0x00000020 Force fat to be always
writethrough
;FATFS_DISABLE_AUTOFORMAT 0x00000040 disable automatic
formatting of unformatted volumes
;FATFS_WFWS_NOWRITETHRU 0x00010000 disable writethrough on
WriteFileWithSeek API,
; improve memory-mapped
file performance
;FATFS_DISABLE_FORMAT 0x00020000 disable format
;FATFS_TRANS_DATA 0x00040000 transact data on a write
(i.e. clone cluster on every write)
;FATFS_TFAT_USECLUS1 0x00080000 Use cluster 1 entry in
FAT table for TFAT transaction.
; By default, TFAT uses the
NOF field of the boot sector
;FATFS_DISABLE_TFAT_REDIR 0x00100000 Indicates to disable
redirect the root directory
; to another hidden
directory for FAT12 or 16,
; since root dir isn't
transacted in those cases
;FATFS_TFAT_ALWAYS 0x00200000 Always mark transaction
status, even only one sector in FAT is changed
;FATFS_FORCE_TFAT 0x00400000 Force TFAT transactioning
even if volume isn't formatted as TFAT
; NOTES: common.reg default is "Flags"=dword:00000064
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FlashDisk\FATFS]
; Override common setting to enable automatic formatting of
unformatted volumes
"Flags"=dword:00000024

; Additional settings for multi xip or persistent storage in NAND

; Entry for nand driver to be loaded by storage manager.
; Once a driver has been loaded by storage manager, it will not
; be loaded again by device manager.
; Note: Needed for Hive registry or persistent storage
[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\Nandfcd]
"DriverPath"="Drivers\\BuiltIn\\NandFlash"
; LoadFlags 0x01 == load synchronously
"LoadFlags"=dword:1
"BootPhase"=dword:0
; Note: if BinFS is used together with PS, then should ensure
; this is loaded after BinFS by setting order to 1 and that
; BinFS autoload order is 0.
"Order"=dword:0

; NAND persistent storage settings only
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FlashDisk\FATFS]
; System registry in FATFS partition
"MountAsBootable"=dword:1
; To mount FAT partition as root
"MountAsRoot"=dword:1

As you can see I have set the flash to mount as bootable and mount as
root. I also have ROM File System as a part of my platform.

How do I tell if it is working? If I create a folder or file under My
Documents and reboot it doesn't stay like the ones I create on NAND
Flash drive do. I looked through the debug log and don't see any
errors. The only thing I do see is that the formatter is running every
time it loads. Here is the output:

8943 PID:bfc44ee TID:bfc44ca 0x8bfc4288:
FLASHDRV.DLL:L2P_GetPhysicalSectorAddr() - Secondary table doesn't
exist for logical sector 0x0!!!
8977 PID:bfc44ee TID:bfc44ca 0x8bfc4288: PD_FormatPartition - type
is 6
8979 PID:bfc44ee TID:bfc44ca 0x8bfc4288: NumSec=130720
BytesPerSec=512 FreeSec=0 BiggestCreatable=0
8979 PID:bfc44ee TID:bfc44ca 0x8bfc4288: Partition PART00
NumSectors=130718
8979 PID:bfc44ee TID:bfc44ca 0x8bfc4288: MSPART!PD_OpenPartition:
dwStoreId=000B2F30, PartName=PART00
8993 PID:bfc44ee TID:bfc44ca 0x8bfc4288: >>> Loading module
fatfsd.dll at address 0x03E40000-0x03E6B000 (RW data at
0x01FF2000-0x01FF263C)
Loaded symbols for 'C:\WINCE500\PBWORKSPACES\3PLAY\RELDIR
\MX21_ARMV4I_DEBUG\FATFSD.DLL'
9005 PID:bfc44ee TID:bfc44ca 0x8bfc4288: >>> Loading module
fatutil.dll at address 0x03E10000-0x03E27000 (RW data at
0x01FED000-0x01FEE0E8)
Loaded symbols for 'C:\WINCE500\PBWORKSPACES\3PLAY\RELDIR
\MX21_ARMV4I_DEBUG\FATUTIL.DLL'
9009 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FormatDisk!FormatVolume:
New extended boot sector successfully written
9508 PID:bfc44ee TID:bfc44ca 0x8bfc4288:
FLASHDRV.DLL:L2P_GetPhysicalSectorAddr() - Secondary table doesn't
exist for logical sector 0x200!!!
10002 PID:bfc44ee TID:bfc44ca 0x8bfc4288:
FLASHDRV.DLL:L2P_GetPhysicalSectorAddr() - Secondary table doesn't
exist for logical sector 0x400!!!
10033 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FormatDisk!FormatVolume:
New FAT #0 successfully written
10034 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FormatDisk!FormatVolume:
New root directory successfully written
10036 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FormatDisk!FormatVolume:
New BPB successfully written
10036 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FormatDisk!FormatVolume
complete.
10037 PID:bfc44ee TID:bfc44ca 0x8bfc4288: <<< Unloading module
fatutil.dll at address 0x03E10000-0x03E27000 (RW data at
0x01FED000-0x01FEE0E8)
Unloaded symbols for 'C:\WINCE500\PBWORKSPACES\3PLAY\RELDIR
\MX21_ARMV4I_DEBUG\FATUTIL.DLL'
10038 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FSD_MountDisk: mounting
volumes for hDsk=000B4CA0
10040 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!OpenVolume: access
time updates disabled
10040 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!OpenVolume: event
logging enabled
10041 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!OpenVolume:
automatic scanning disabled
10041 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!OpenVolume: write
verify disabled
10041 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!OpenVolume: extra
FAT on format disabled
10041 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!OpenVolume: force
write through enabled
10043 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!OpenVolume: Codepage
= 1
10045 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!OpenVolume: Number
of path cache entries = 50
10063 PID:bfc44ee TID:bfc44ca 0x8bfc4288: >>> Loading module
diskcache.dll at address 0x03E30000-0x03E39000 (RW data at
0x01FF0000-0x01FF04F4)
Loaded symbols for 'C:\WINCE500\PBWORKSPACES\3PLAY\RELDIR
\MX21_ARMV4I_DEBUG\DISKCACHE.DLL'
10065 PID:bfc44ee TID:bfc44ca 0x8bfc4288: CreateCache: Successful.
Cache Size: 256 KB, Start: 32, End: 1053.
10066 PID:bfc44ee TID:bfc44ca 0x8bfc4288: CreateCache: Successful.
Cache Size: 512 KB, Start: 1054, End: 130717.
10480 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!InitVolume: FAT
version: 32
10480 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FATFS!InitVolume: Cluster
Size (Sectors): 1
10482 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FS: Registering file
system NAND Flash, index 4, flags 0x00000002
10483 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FS: Mount complete (NAND
Flash, index 4, flags 0x00000002)
10484 PID:bfc44ee TID:bfc44ca 0x8bfc4288: InitSharedHeap: 44000000
10000 c
10485 PID:bfc44ee TID:bfc44ca 0x8bfc4288: InitSharedHeap: return
44000060
10495 PID:bfc44ee TID:bfc44ca 0x8bfc4288: >>> Loading module
relfsd.dll at address 0x03E00000-0x03E0B000 (RW data at
0x01FEB000-0x01FEBADC)
Loaded symbols for 'C:\WINCE500\PBWORKSPACES\3PLAY\RELDIR
\MX21_ARMV4I_DEBUG\RELFSD.DLL'
10501 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FS: Registering file
system Release, index 5, flags 0x00000000
10501 PID:bfc44ee TID:bfc44ca 0x8bfc4288: Mounted ReleaseFSD volume
'\Release'
10514 PID:bfc44ee TID:bfc44ca 0x8bfc4288: size of 'dbglist.txt' =
00000000
10516 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FS: Mount complete
(Release, index 5, flags 0x00000000)
10516 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FSREG: Unable to read
value "NoDefaultUser" under HKEY_LOCAL_MACHINE\init\BootVars
10516 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FSREG: Logging in default
user.
10517 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FSREG: Unable to read
value "DefaultUser" under HKEY_LOCAL_MACHINE\init\BootVars
10517 PID:bfc44ee TID:bfc44ca 0x8bfc4288: SetCurrentUser: Logging
out (nobody), logging in default
10517 PID:bfc44ee TID:bfc44ca 0x8bfc4288: FS: Using default path
"\profiles\"

The problem with thinking that is it is that files in NAND Flash stick
around after a reboot. Maybe the root is at a different location or
partition?

Any ideas?



.



Relevant Pages