none
How to mount a file system on an existing partition in Windows CE 6.0 R3 RRS feed

  • Question

  • Hi, 

    We try to use part of the SD card as ROM and the rest of it for file system on our product which uses Wince 6.0 R3 as main OS.  in Eboot, I added the code that formats and creates two FAT partitions beyond the part of the SD used as ROM.

    The problem I haven't figured out how to mount the hive file system on the first FAT partition when the main OS boot!  Can that be done by setting registry keys?

    Thanks in advance,

    YQuy

    Friday, October 22, 2010 9:30 PM

All replies

  • So how many partition are there in your SD card?
    Sounds like there are 3, first for storing OS image followed by 2 FAT partitions and one of the them for storing registry hive?

    Assume the above partition layout is accurate, you may have the following registry setting in boot hive to indicate Storage Manager to mount second partition (part01) as bootable. (for registry hive) Also make sure all of the necessary SD relative registry setting has been included in boot hive.

    ; HIVE BOOT SECTION
    [HKLM\System\StorageManager\Profiles\SDMemory\Part01]
     "MountAsBootable"=dword:1
    ; END HIVE BOOT SECTION

    Monday, October 25, 2010 5:06 AM
  • I'm interested in how you had format the SD card with two FAT partitions from bootloder....can you give me some tips ?

    Thanks, Paolo.

    Monday, October 25, 2010 2:20 PM
  • Thanks for your response.

    Actually, the way we configure our SD card before is like this: we conceptually divided the card into two sections, the first one from sector 0 to sector n is treated as ROM containing binary images.  And we modified the SD driver to report to Wince sector (n+1) as the beginning of the SD and set registry keys to auto format and auto partion this 2nd part as ONE bootable, mount permanent partition.  This scheme has been working for us.

    We now need to further partition the second part into two partitions instead of one.  To do that, I added code in the boot loader to partition this sections into two partitions and modified the registry as below:

    [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory\Part00]

    "Folder"="ROOT"

    "MountAsBootable"=dword:1

    "MountAsRoot"=dword:1

    "MountPermanent"=dword:1

    "AutoPart"=dword:0

     

    "AutoFormat"=dword:0

    "FormatTfat"=dword:0

     

     

    [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory\Part01]

    "Folder"="USER"

    "MountAsBootable"=dword:0

    "MountAsRoot"=dword:0

    "MountPermanent"=dword:1

    "AutoMount"=dword:1

    "AutoPart"=dword:0

    "AutoFormat"=dword:0

    "FormatTfat"=dword:0

    I'm able to verify that there are two partitions in the MBR.  But the main wince kernel won't boot, there is no messages but I assume file system gets stuck somewhere trying to mount.

    Am I missing something else?

    Thanks,

    YQuy

    Monday, October 25, 2010 2:30 PM
  • Hi Paolo,

    I start with the BOOTPART folder that comes with Wince,

    C:\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\ETHDBG\BOOTPART

    The code in this folder is for NAND flash, so I have to modify it for the SD card, then call the function:

    BP_OpenPartition twice to create 2 new partitions. The sizes, partition types, etc are specified in the parameters. 

    I can post the file if you're interested.

    Yquy

    Monday, October 25, 2010 5:34 PM
  • Hi YQuy...thank you very much ! I will appreciate it if you post the file !

    Thanks, Paolo.

    Monday, October 25, 2010 5:45 PM
  • Sure, Paolo.  During boot loader boot, I called this function SDMMC_Init() from sdfmd.cpp to initialized the SD card. Once the card init, I called the BP_Openpartion as below to create two new partitions:

     

    if(INVALID_HANDLE_VALUE != (BP_OpenPartition(Part0_Offset, dwNumSectors, PART_DOS3_FAT, TRUE, PART_CREATE_NEW)))

     

    "INFO: *********** Create Partition 0 OK!! *********** \r\n")));

     

    "INFO: Creating Partition 1!!!\r\n")));

     

    if(INVALID_HANDLE_VALUE != (BP_OpenPartition((DWORD)NEXT_FREE_LOC, (DWORD)USE_REMAINING_SPACE, PART_DOS3_FAT, FALSE, PART_CREATE_NEW)))

     

    "INFO: *********** Create Partition 1 OK!! *********** \r\n")));

     

    }

    The code that create the partition is below. Please note that my MBR is not located at sector 0 but somewhere else. You'd have to adjust that accordingly.

    Hope this helps.

    Yquy

    P.S: I can't insert the code here, the file is much bigger for the allowed space. Give me your email address, I'd email the file to you.

     

    {

    OALMSG(1, (_T(

     

    }

    OALMSG(1, (_T(

    {

    OALMSG(1, (_T(

    Monday, October 25, 2010 6:08 PM
  • Ok thanks...send me to cubanito@hotmail.it. Thanks !! Paolo.
    Monday, October 25, 2010 6:35 PM
  • I just sent it. Hope it'd help you.

    YQuy

    Monday, October 25, 2010 7:48 PM
  • Thank you very much !!

    Paolo.

    Monday, October 25, 2010 8:45 PM
  • Hi YQuy,

    I am trying to create multiple partitions on SD in the eboot.

    I appreciate if you could send me the source file as well to this mail ID source.code.online@hotmail.com .

    Thank you for your kind help.

     

    Tuesday, October 26, 2010 2:40 AM
  • So you have a special SD card driver that hides those sectors for storing OS Image, right?
    Assume you have kernel debugger enabled OS image (if not please build one by unset IMGNODEBUGGER then MAKEIMG), is relative drivers to mount SD card are all loaded before hanged? (SD card, BUS, host, FAT, MSPART and etc)
    If not, you may need to double check the registry, perhaps one or more drivers' registry setting is not included in boot hive.
    If so, is the OS can recognize and mount these 2 partitions correctly?
    hint: you can use ObjectSotore mounted as root and bootable (hive) so OS can still boot up, then verify if both partitions on SD card are mounted?

    Tuesday, October 26, 2010 4:38 AM
  • That's correct, in the SDMemory client driver, we modified to report the start sector at somewhere in the middle of the SD.  The sectors 0 to sector n are used as ROM to store the OS image, non volatile storage, etc.

    I know that the SD drivers are loaded, but then system hang during boot.  I think it's within the filesys module.  If that is the case, then KITL image won't help because we don't have the source code for it!

    YQuy

    Wednesday, October 27, 2010 4:30 PM
  • I got side tracked for a couple of days. Now I'm back on this problem!  I built and ran KITL to understand better where I am stuck.

    Below is the debug output. Apparently, the FSDMGR does find my partitions and tries to mount them.  At the end, I still fail to have the file system mounted on the part 00.  I put a break point and stepped through the code and found that every time it mounts a partition, it sent the IOCTL:  IOCTL_DISK_GETINFO which I returned the same info as the SD card info, for both times it sents when mounting the partitions 0, and 1.  I guess this is not right. But I'm not sure what I should return, the number of sectors, size of the pariticular partition? but how do I know which partition I'm dealing with when I got this IOCTL?

    I would greatly appreciate your input on this matter.

    Thanks,

    Yquy

    4294774258 PID:400002 TID:9f0002 FSDMGR!MountStore: Attaching new storage device "DSK1:"
    4294774259 PID:400002 TID:9f0002 >>>> DISK GET/SET INFO <<<<<
    4294774260 PID:400002 TID:9f0002 >>>> IOCTL_DISK_DEVICE_INFO <<<<<
    4294774261 PID:400002 TID:9f0002 SDMemory: GetDeviceInfo - Profile = SDMemory, length = 18
    4294774304 PID:400002 TID:9f0002 FSDMGR!StoreDisk_t::OpenDisk(0xD004AAC0) DeviceInfo Class(0x00000001) Flags(0x00000001) Type(0xA0000000) Profile(SDMemory)
    4294774347 PID:400002 TID:9f0002 SDMemory: GetStorageID Insufficient buffer space
    SDMemory: -GetStorageID
    4294774402 PID:400002 TID:9f0002 FSDMGR!DumpRegKey: Dumping registry for key System\StorageManager\Profiles
    4294774403 PID:400002 TID:9f0002   AutoMount = 00000001
    4294774403 PID:400002 TID:9f0002   AutoPart = 00000000
    4294774439 PID:400002 TID:9f0002   AutoFormat = 00000000
    4294774468 PID:400002 TID:9f0002   MountFlags = 00000000
    4294774469 PID:400002 TID:9f0002   DefaultFileSystem =
    4294774469 PID:400002 TID:9f0002   PartitionDriverName = MSPART
    4294774469 PID:400002 TID:9f0002   Folder = Mounted Volume
    4294774470 PID:400002 TID:9f0002   ActivityEvent = PowerManager/ActivityTimer/SystemActivity
    4294774471 PID:400002 TID:9f0002 FSDMGR!DumpRegKey: Dumping registry for key SDMemory
    4294774499 PID:400002 TID:9f0002   Name = SD Memory Card
    4294774528 PID:400002 TID:9f0002   Folder = SD Memory
    4294774556 PID:400002 TID:9f0002   MountAsBootable = 00000001
    4294774593 PID:400002 TID:9f0002   MountAsRoot = 00000001
    4294774622 PID:400002 TID:9f0002   MountPermanent = 00000001
    4294774623 PID:400002 TID:9f0002   AutoMount = 00000001
    4294774623 PID:400002 TID:9f0002   AutoPart = 00000001
    4294774624 PID:400002 TID:9f0002   AutoFormat = 00000001
    4294774633 PID:400002 TID:9f0002 OSAXST1: >>> Loading Module 'mspart.dll' (0x8FEC82F4) at address 0xC0670000-0xC067F000 in Process 'NK.EXE' (0x82A88AA0)
    PB Debugger Loaded symbols for 'C:\WINCE600\OSDESIGNS\MC3SYSTEM\MC3SYSTEM\RELDIR\MC3_ARMV4I_DEBUG\MSPART.DLL'
    4294775078 PID:400002 TID:9f0002 FSDMGR!LoadPartitionDriver: Loading partition driver mspart.dll hModule=8FEC82F4
    4294775107 PID:400002 TID:9f0002 >>>> IOCTL_DISK_GETINFO <<<<<
    4294775108 PID:400002 TID:9f0002 >>>> DISK ACCESS <<<<<
    4294775138 PID:400002 TID:9f0002 >>>> DISK ACCESS <<<<<
    4294775140 PID:400002 TID:9f0002 >>>> DISK ACCESS <<<<<
    4294775142 PID:400002 TID:9f0002 FSDMGR!StoreDisk_t::MountStore: Opened the store "DSK1:" hStore=0xD004B6E0
    4294775142 PID:400002 TID:9f0002 >>>> DISK ACCESS <<<<<
    4294775144 PID:400002 TID:9f0002 FSDMGR!StoreDisk_t::MountStore: Geometry: NumSec=3695616 BytesPerSec=512 FreeSec=9743 BiggestCreatable=9743


    +++++++++++++++++++++++++++++++++++++++ partition 00: size: 500 MB  <<<< MY COMMENT

    4294775196 PID:400002 TID:9f0002 Partition Part00  NumSectors=1024000 
    4294775197 PID:400002 TID:9f0002 MSPART!PD_OpenPartition: dwStoreId=D004B6E0, PartName=Part00
    4294775197 PID:400002 TID:9f0002 FSDMGR!StoreDisk_t::LoadPartition: mounting partition "Part00" on store "DSK1:"
    4294775198 PID:400002 TID:9f0002 FSDMGR!ParitionDisk::LoadPartition: Partition Type 0x01 --> "FATFS"
    4294775200 PID:400002 TID:9f0002 FSDMGR!ParitionDisk::MountPartition: "FATFS" --> exfat.dll
    4294775213 PID:400002 TID:9f0002 OSAXST1: >>> Loading Module 'exfat.dll' (0x8FEC84FC) at address 0xC0570000-0xC05AB000 in Process 'NK.EXE' (0x82A88AA0)
    PB Debugger Loaded symbols for 'C:\WINCE600\OSDESIGNS\MC3SYSTEM\MC3SYSTEM\RELDIR\MC3_ARMV4I_DEBUG\EXFAT.DLL'
    4294775561 PID:400002 TID:9f0002 FSD_MountDisk: Mounting volume for hDsk=D004BA40

    4294775590 PID:400002 TID:9f0002 >>>> IOCTL_DISK_GETINFO <<<<<
    4294775591 PID:400002 TID:9f0002 >>>> DISK ACCESS <<<<<
    4294775623 PID:400002 TID:9f0002 FSDMGR!MountedVolume_t::~MountedVolume_t: deleting volume (D004C000)
    4294775650 PID:400002 TID:9f0002 FSDMGR!FileSystemDriver_t::~FileSystemDriver_t: deleting FSD (D004BEC0)
    4294775657 PID:400002 TID:9f0002 OSAXST1: <<< Unloading Module 'exfat.dll' (0x8FEC84FC) at address 0xC0570000-0xC05AB000 in Process 'NK.EXE' (0x82A88AA0)
    PB Debugger Unloaded symbols for 'C:\WINCE600\OSDESIGNS\MC3SYSTEM\MC3SYSTEM\RELDIR\MC3_ARMV4I_DEBUG\EXFAT.DLL'


    +++++++++++++++++++++++++++++++++++++ partition 01: size: 1,201 MB   <<<<<< MY COMMENT

    4294775661 PID:400002 TID:9f0002 Partition Part01  NumSectors=2460145
    4294775691 PID:400002 TID:9f0002 MSPART!PD_OpenPartition: dwStoreId=D004B6E0, PartName=Part01
    4294775691 PID:400002 TID:9f0002 FSDMGR!StoreDisk_t::LoadPartition: mounting partition "Part01" on store "DSK1:"
    4294775720 PID:400002 TID:9f0002 FSDMGR!ParitionDisk::LoadPartition: Partition Type 0x01 --> "FATFS"
    4294775749 PID:400002 TID:9f0002 FSDMGR!ParitionDisk::MountPartition: "FATFS" --> exfat.dll
    4294775799 PID:400002 TID:9f0002 OSAXST1: >>> Loading Module 'exfat.dll' (0x8FEC85BC) at address 0xC0570000-0xC05AB000 in Process 'NK.EXE' (0x82A88AA0)
    PB Debugger Loaded symbols for 'C:\WINCE600\OSDESIGNS\MC3SYSTEM\MC3SYSTEM\RELDIR\MC3_ARMV4I_DEBUG\EXFAT.DLL'
    4294776153 PID:400002 TID:9f0002 FSD_MountDisk: Mounting volume for hDsk=D004BEC0

    4294776182 PID:400002 TID:9f0002 >>>> IOCTL_DISK_GETINFO <<<<<
    4294776183 PID:400002 TID:9f0002 >>>> DISK ACCESS <<<<<
    4294776213 PID:400002 TID:9f0002 FSDMGR!MountedVolume_t::~MountedVolume_t: deleting volume (D004C4E0)
    4294776239 PID:400002 TID:9f0002 FSDMGR!FileSystemDriver_t::~FileSystemDriver_t: deleting FSD (D004C340)
    4294776268 PID:400002 TID:9f0002 OSAXST1: <<< Unloading Module 'exfat.dll' (0x8FEC85BC) at address 0xC0570000-0xC05AB000 in Process 'NK.EXE' (0x82A88AA0)
    PB Debugger Unloaded symbols for 'C:\WINCE600\OSDESIGNS\MC3SYSTEM\MC3SYSTEM\RELDIR\MC3_ARMV4I_DEBUG\EXFAT.DLL'
    4294783178 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294793180 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294803183 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294813185 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294823246 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294833248 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294843250 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294853252 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294863254 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294873256 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294883258 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294893260 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294903262 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294913264 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.
    4294923266 PID:400002 TID:650002 FILESYS: Waiting for bootable file system to be mounted.

     

    Thursday, November 4, 2010 9:16 PM
  • Hi YQuy,

    I am trying to do the same thing as you did for NAND flash.  Did you eventually figure out how to resolve the issue?  If so, can you tell me how you did it?

    Thanks,

    Luan


    Luan Le
    Friday, July 8, 2011 8:17 PM
  • I'm interested in how you had format the SD card with two FAT partitions from bootloder....can you give me some tips ?

    Thanks, Paolo.

    thanks...send me to sunboyjp@163.coml. Thanks !! Paolo.
    Thursday, May 30, 2013 2:03 PM