大家好!
这里再次向大家请教一下FAT文件系统的加载问题!
最近我把FLASH中作了这样的分区,开头的是NK,紧接NK的block放的是MBR,然后空了一个block,再接着的8个block(1M)分区为FAT32,再后面的部分我就没有分区了.我的MBR在sboot里给写在了第41个block(前面40个block用做存放NK.NB0--5M字节),1个block有256个sector,1个sector有512字节,总共有512个block,共64M字节,现在当我加载的时候出现了下面的现象:关键是最后出现了一个DEBUGCHK failed
>>> Loading module mspart.dll at address 0x03E30000-0x03E3E000 (RW data at 0x01FE6000-0x01FE64AC)
Loaded symbols for 'D:\WINCE500\PBWORKSPACES\MYDESIGN2\RELDIR\MY9261_ARMV4I_DEBUG\MSPART.DLL'
154255 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: Loading partition driver mspart.dll hModule=83A4D15C
154275 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: Driver mspart.dll loaded
154305 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: nSectorAddr 0x00002800
154330 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: nSectorAddr 0x00005200
154360 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: Opened the store hStore=000908E0
154385 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: nSectorAddr 0x00002800
154410 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: NumSec=120320 BytesPerSec=512 FreeSec=107520 BiggestCreatable=107520
154435 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: Partition Part00 NumSectors=2048
154460 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: MSPART!PD_OpenPartition: dwStoreId=000908E0, PartName=Part00
154505 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: >>> Loading module fatfsd.dll at address 0x03ED0000-0x03EFA000 (RW data at 0x01FF4000-0x01FF463C)
Loaded symbols for 'D:\WINCE500\PBWORKSPACES\MYDESIGN2\RELDIR\MY9261_ARMV4I_DEBUG\FATFSD.DLL'
156300 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FSD_MountDisk: mounting volumes for hDsk=0010EA70
156325 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: nSectorAddr 0x00005200
156355 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!MountDisk: BPB_HiddenSectors(-1) != 0
156380 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!OpenVolume: access time updates disabled
156410 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!OpenVolume: event logging enabled
156435 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!OpenVolume: automatic scanning disabled
156460 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!OpenVolume: write verify disabled
156485 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!OpenVolume: extra FAT on format disabled
156510 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!OpenVolume: force write through enabled
156540 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!OpenVolume: Codepage = 1
156565 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!OpenVolume: Number of path cache entries = 50
156595 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!InitVolume: sector 0 byte 0 suspicious (0xf2)
156635 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!InitVolume: invalid BPB, volume deemed invalid
156660 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!InitVolume: FAT version: 12
156685 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FATFS!InitVolume: Cluster Size (Sectors): 255
156720 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: >>> Loading module fatutil.dll at address 0x03EA0000-0x03EB3000 (RW data at 0x01FF0000-0x01FF09BC)
Loaded symbols for 'D:\WINCE500\PBWORKSPACES\MYDESIGN2\RELDIR\MY9261_ARMV4I_DEBUG\FATUTIL.DLL'
158525 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FLASHDRV.DLL:WriteToMedia() - Trying to write to read-only sectors (0x2a00, 0x1)!
158555 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: FLASHDRV.DLL:WriteToMedia() failed.
158580 PID:63ae7b52 TID:63ae7b2e 0x83ae78ec: Unknown: DEBUGCHK failed in file c:\macallan\public\common\oak\drivers\fsd\fatutil\main\diskinterface.cpp at line 44
The Kernel Debugger has been disconnected successfully.
我的分区如下:
hPart = BP_OpenPartition( 10752,
2048,
PART_DOS32,
TRUE,
PART_OPEN_ALWAYS);
这里的10752=40*256+256(MBR)+256(空出的block)
请大家赐教啊!!!
知道各位大侠都很忙,但是搞到这份上了,不甘心啊!!
还请给点思路啊
DEBUGCHK failed
那个地方的代码贴出来。
万分感谢yashi 斑竹的关照!!
哪个出错的地方在这:
BOOL CDiskInterface::WriteSectors (DWORD dwSector, LPBYTE lpBuf, DWORD dwNumSectors)
{
SG_REQ sg;
DWORD dwResult;
sg.sr_start = dwSector;
sg.sr_num_sec = dwNumSectors;
sg.sr_num_sg = 1;
sg.sr_status = ERROR_NOT_SUPPORTED; // not used by ATADisk
sg.sr_callback = NULL;
sg.sr_sglist[0].sb_buf = (LPBYTE) MapPtrToProcess(lpBuf, GetCurrentProcess());
sg.sr_sglist[0].sb_len = m_dwBytesPerSector * dwNumSectors;
dwResult = DeviceIoControl(m_hVolume, DISK_IOCTL_WRITE, &sg, sizeof(sg),
NULL, 0, NULL, NULL);
if (!dwResult) {
ASSERT(0);//就是这里出错的!!!
DEBUGMSG(ZONE_OUTPUT, (L"Write Sector failed (%d) when writing to Sector %d\r\n", sg.sr_status, dwSector));
SetLastError(ERROR_WRITE_FAULT);
}
return dwResult;
}
现在情况是这样的,上面的问题已经解决,通过改变FMD_ReadSector里的 pSectorInfoBuff->bOEMReserved = 0x02就可以了,可是又出现了新的问题,
168520 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: Driver mspart.dll loaded
168550 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: Opened the store hStore=000905E0
168575 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: NumSec=107520 BytesPerSec=512 FreeSec=0 BiggestCreatable=0
168600 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: Partition Part00 NumSectors=107264
168625 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: MSPART!PD_OpenPartition: dwStoreId=000905E0, PartName=Part00
168665 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: >>> Loading module fatfsd.dll at address 0x03ED0000-0x03EFA000 (RW data at 0x01FF4000-0x01FF463C)
Loaded symbols for 'D:\WINCE500\PBWORKSPACES\MYDESIGN2\RELDIR\MY9261_ARMV4I_DEBUG\FATFSD.DLL'
170450 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FSD_MountDisk: mounting volumes for hDsk=00104B10
170475 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!MountDisk: BPB_HiddenSectors(-1) != 0
170505 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!OpenVolume: access time updates disabled
170530 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!OpenVolume: event logging enabled
170555 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!OpenVolume: automatic scanning disabled
170580 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!OpenVolume: write verify disabled
170605 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!OpenVolume: extra FAT on format disabled
170630 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!OpenVolume: force write through enabled
170655 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!OpenVolume: Codepage = 1
170680 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!OpenVolume: Number of path cache entries = 50
170710 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!InitVolume: sector 0 byte 0 suspicious (0xf2)
170735 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!InitVolume: invalid BPB, volume deemed invalid
170760 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!InitVolume: FAT version: 12
170785 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FATFS!InitVolume: Cluster Size (Sectors): 255
170820 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: >>> Loading module fatutil.dll at address 0x03EA0000-0x03EB3000 (RW data at 0x01FF0000-0x01FF09BC)
Loaded symbols for 'D:\WINCE500\PBWORKSPACES\MYDESIGN2\RELDIR\MY9261_ARMV4I_DEBUG\FATUTIL.DLL'
172625 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FLASHDRV.DLL:CP_StartCompactor() - There aren't any DIRTY sectors left; the compactor can't be started
172655 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FLASHDRV.DLL:SM_GetNextFreeSector() - Unable to start compactor in critical situation!!!
172690 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FLASHDRV.DLL:SM_GetNextFreeSector() - Unable to reclaim any free sectors in a critical compaction stage. Media must be full.
172720 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FLASHDRV.DLL:WriteToMedia() - Unable to get next free physical sector address for writing! The media is full...
172750 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: FLASHDRV.DLL:WriteToMedia() failed.
172775 PID:23ae7b52 TID:23ae7b2e 0x83ae78ec: Unknown: DEBUGCHK failed in file c:\macallan\public\common\oak\drivers\fsd\fatutil\main\diskinterface.cpp at line 44
The Kernel Debugger has been disconnected successfully.
停住的地方和上面的问题一样,只是报了不同的错误.我觉得可能是
这句打映消息 NumSec=107520 BytesPerSec=512 FreeSec=0 BiggestCreatable=0
中的 FreeSec=0造成的,但是这个参数该如何改变呢??
请斑竹不吝赐教!!
刚更改了一下sboot里的分区:
hPart = BP_OpenPartition( 256, // next block of MBR
2048 ,// USE_REMAINING_SPACE 改为 2048
PART_DOS32,
TRUE,
PART_OPEN_ALWAYS);
现在我把上面的第2个参数改为2048后,
出现了
NumSec=107520 BytesPerSec=512 FreeSec=105216 BiggestCreatable=105216 65000 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: Partition Part00 NumSectors=2048
65030 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: MSPART!PD_OpenPartition: dwStoreId=000905E0, PartName=Part00
65070 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: >>> Loading module fatfsd.dll at address 0x03ED0000-0x03EFA000 (RW data at 0x01FF4000-0x01FF463C)
Loaded symbols for 'D:\WINCE500\PBWORKSPACES\MYDESIGN2\RELDIR\MY9261_ARMV4I_DEBUG\FATFSD.DLL'
67885 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FSD_MountDisk: mounting volumes for hDsk=00104B10
67905 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!MountDisk: BPB_HiddenSectors(-1) != 0
67935 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!OpenVolume: access time updates disabled
67960 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!OpenVolume: event logging enabled
67985 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!OpenVolume: automatic scanning disabled
68010 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!OpenVolume: write verify disabled
68035 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!OpenVolume: extra FAT on format disabled
68060 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!OpenVolume: force write through enabled
68085 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!OpenVolume: Codepage = 1
68115 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!OpenVolume: Number of path cache entries = 50
68145 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!InitVolume: sector 0 byte 0 suspicious (0xf2)
68170 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!InitVolume: invalid BPB, volume deemed invalid
68195 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!InitVolume: FAT version: 12
68220 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FATFS!InitVolume: Cluster Size (Sectors): 255
68250 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: >>> Loading module fatutil.dll at address 0x03EA0000-0x03EB3000 (RW data at 0x01FF0000-0x01FF09BC)
Loaded symbols for 'D:\WINCE500\PBWORKSPACES\MYDESIGN2\RELDIR\MY9261_ARMV4I_DEBUG\FATUTIL.DLL'
70060 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FLASHDRV.DLL:CP_StartCompactor() - There aren't any DIRTY sectors left; the compactor can't be started
70090 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FLASHDRV.DLL:SM_GetNextFreeSector() - Unable to start compactor in critical situation!!!
70120 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FLASHDRV.DLL:SM_GetNextFreeSector() - Unable to reclaim any free sectors in a critical compaction stage. Media must be full.
70155 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FLASHDRV.DLL:WriteToMedia() - Unable to get next free physical sector address for writing! The media is full...
70185 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: FLASHDRV.DLL:WriteToMedia() failed.
70210 PID:e3ae7b52 TID:e3ae7b2e 0x83ae78ec: Unknown: DEBUGCHK failed in file c:\macallan\public\common\oak\drivers\fsd\fatutil\main\diskinterface.cpp at line 44
The Kernel Debugger has been disconnected successfully.
虽然FreeSec不为0了,但是问题依旧,说明问题不在这里!
继续...