19,502
社区成员
发帖
与我相关
我的任务
分享
// lqm: 1G08:dwStartSector = 7 * 64 (boot:7个block)
HANDLE BP_OpenPartition(DWORD dwStartSector, DWORD dwNumSectors, DWORD dwPartType, BOOL fActive, DWORD dwCreationFlags)
{
DWORD dwPartIndex;
BOOL fExists;
ASSERT (g_pbMBRSector);
if (!IsValidMBR()) // 这里的目的是什么???
{
DWORD dwFlags = 0;
if (dwCreationFlags == PART_OPEN_EXISTING)
{
RETAILMSG(1, (TEXT("OpenPartition: Invalid MBR. Cannot open existing partition 0x%x.\r\n"), dwPartType));
return INVALID_HANDLE_VALUE;
}
RETAILMSG(1, (TEXT("OpenPartition: Invalid MBR. Formatting flash.\r\n")));
if (g_FlashInfo.flashType == NOR)
{
dwFlags |= FORMAT_SKIP_BLOCK_CHECK;
}
BP_LowLevelFormat (0, g_FlashInfo.dwNumBlocks, dwFlags);
dwPartIndex = 0;
fExists = FALSE;
}
else
{
fExists = GetPartitionTableIndex(dwPartType, fActive, &dwPartIndex);
}
RETAILMSG(1, (TEXT("OpenPartition: Partition Exists=0x%x for part 0x%x.\r\n"), fExists, dwPartType));
if (fExists) {
// Partition was found.
if (dwCreationFlags == PART_CREATE_NEW)
return INVALID_HANDLE_VALUE;
if (g_partStateTable[dwPartIndex].pPartEntry == NULL) {
// Open partition. If this is the boot section partition, then file pointer starts after MBR
g_partStateTable[dwPartIndex].pPartEntry = (PPARTENTRY)(g_pbMBRSector + PARTTABLE_OFFSET + sizeof(PARTENTRY)*dwPartIndex);
g_partStateTable[dwPartIndex].dwDataPointer = 0;
}
return (HANDLE)&g_partStateTable[dwPartIndex];
}
else {
// If there are already 4 partitions, or creation flag specified OPEN_EXISTING, fail.
if ((dwPartIndex == NUM_PARTS) || (dwCreationFlags == PART_OPEN_EXISTING))
return INVALID_HANDLE_VALUE;
// Create new partition
return CreatePartition (dwStartSector, dwNumSectors, dwPartType, fActive, dwPartIndex);
}
return INVALID_HANDLE_VALUE;
}
static BOOL IsValidMBR()
{
// Check to see if the MBR is valid
// MBR block is always located at logical sector 0
g_dwMBRSectorNum = GetMBRSectorNum();
RETAILMSG (1, (TEXT("IsValidMBR: MBR sector = 0x%x\r\n"), g_dwMBRSectorNum));
if ((g_dwMBRSectorNum == INVALID_ADDR) || !FMD_ReadSector (g_dwMBRSectorNum, g_pbMBRSector, NULL, 1))
{
return FALSE;
}
// lqm added for test.10-04-12
RETAILMSG (1, (TEXT("g_pbMBRSector[0] = 0x%x\r\n"), g_pbMBRSector[0]));
RETAILMSG (1, (TEXT("g_pbMBRSector[1] = 0x%x\r\n"), g_pbMBRSector[1]));
RETAILMSG (1, (TEXT("g_pbMBRSector[2] = 0x%x\r\n"), g_pbMBRSector[2]));
RETAILMSG (1, (TEXT("g_pbMBRSector[SECTOR_SIZE-2] = 0x%x\r\n"), g_pbMBRSector[SECTOR_SIZE-2]));
RETAILMSG (1, (TEXT("g_pbMBRSector[SECTOR_SIZE-1] = 0x%x\r\n"), g_pbMBRSector[SECTOR_SIZE-1]));
// end added.
return ((g_pbMBRSector[0] == 0xE9) &&
(g_pbMBRSector[1] == 0xfd) &&
(g_pbMBRSector[2] == 0xff) &&
(g_pbMBRSector[SECTOR_SIZE-2] == 0x55) &&
(g_pbMBRSector[SECTOR_SIZE-1] == 0xAA));
}
Microsoft Windows CE Ethernet Bootloader Common Library Version 1.1 Built Apr 12 2010 09:47:46
Microsoft Windows CE Bootloader for the Samsung SMDK2440 Version 2.4 Built Apr 14 2010
FMD: ReadID (Mfg=ec, Dev=76)
FMD_Init: finished successful
FMD_Init: reserved_blocks 104
FMD_GetInfo
Press [ENTER] to launch image stored on boot media, or [SPACE] to enter boot monitor.
Initiating image launch in 5 seconds.
Ethernet Boot Loader Configuration:
0) IP address: 192.168.1.115
1) Subnet mask: 255.255.255.0
2) DHCP: Disabled
3) Boot delay: 5 seconds
4) Reset to factory default configuration
5) Startup image: LAUNCH EXISTING
6) Program disk image into SmartMedia card: Enabled
7) Program CS8900 MAC address (00:11:22:33:44:55)
8) Kernel Debugger: DISABLED
9) Format Boot Media for BinFS
F) Low-level format the Smart Media card
D) Download image now
L) LAUNCH existing Boot Media image
U) DOWNLOAD image now(USB)
R) Read Configuration
W) Write Configuration Right Now
Enter your selection: u
System ready!
Preparing for download...
Please send the Image through USB.
pUSBCtrlAddr->OCSR1.out_pkt_rdy = 0x1
Ep3Handler : downPtIndex = 0x30800040
Download BIN file information:
-----------------------------------------------------
[0]: Base Address=0x80200000 Length=0x22620b0
-----------------------------------------------------
ROMHDR at Address 80200044h
Writing single region/multi-region update, dwBINFSPartLength: 36053168
IsValidMBR: MBR sector = 0x1a0
g_pbMBRSector[0] = 0xe9
g_pbMBRSector[1] = 0xfd
g_pbMBRSector[2] = 0xff
g_pbMBRSector[SECTOR_SIZE-2] = 0x55
g_pbMBRSector[SECTOR_SIZE-1] = 0xaa
OpenPartition: Partition Exists=0x1 for part 0x21.
BP_SetDataPointer at 0x0
WriteData: Start = 0x0, Length = 0x22620b0.
Log2Phys: Logical 0x1c0 -> Physical 0x360
IsBlockBad(43A): TRUE
Updateded TOC!
IsValidMBR: MBR sector = 0x1a0
g_pbMBRSector[0] = 0xe9
g_pbMBRSector[1] = 0xfd
g_pbMBRSector[2] = 0xff
g_pbMBRSector[SECTOR_SIZE-2] = 0x55
g_pbMBRSector[SECTOR_SIZE-1] = 0xaa
OpenPartition: Partition Exists=0x1 for part 0xb.
TOC {
dwSignature: 0x434F544E
BootCfg {
ConfigFlags: 0x830
BootDelay: 0x5
ImageIndex: 1
IP: 192.168.1.115
MAC Address: 00:11:22:33:44:55
Port: 0.0.0.0
SubnetMask: 255.255.255.0
}
ID[0] {
dwVersion: 0x20004
dwSignature: 0x45424F54
String: 'eboot.nb0'
dwImageType: 0x2
dwTtlSectors: 0x200
dwLoadAddress: 0x80038000
dwJumpAddress: 0x80038000
dwStoreOffset: 0x0
sgList[0].dwSector: 0xA0
sgList[0].dwLength: 0x200
}
ID[1] {
dwVersion: 0x1
dwSignature: 0x43465348
String: ''
dwImageType: 0x2
dwTtlSectors: 0x11311
dwLoadAddress: 0x80200000
dwJumpAddress: 0x8022C480
dwStoreOffset: 0x0
sgList[0].dwSector: 0x360
sgList[0].dwLength: 0x11311
}
chainInfo.dwLoadAddress: 0X00000000
chainInfo.dwFlashAddress: 0X00000000
chainInfo.dwLength: 0X00000000
}
waitforconnect
INFO: OEMLaunch: Jumping to Physical Address 0x3022C480h (Virtual Address 0x8022C480h)...
Windows CE Kernel for ARM (Thumb Enabled) Built on Aug 4 2008 at 18:38:38
ProcessorType=0920 Revision=0
sp_abt=ffff5000 sp_irq=ffff2800 sp_undef=ffffc800 OEMAddressTable = 8022c354
DCache: 8 sets, 64 ways, 32 line size, 16384 size
ICache: 8 sets, 64 ways, 32 line size, 16384 size
Sp=ffffc7cc
OEMIoControl: Unsupported Code 0x10100b4 - device 0x0101 func 45
OEMIoControl: Unsupported Code 0x101008c - device 0x0101 func 35
FMD: ReadID (Mfg=ec, Dev=76)
FMD_Init: finished successful
FMD_Init: reserved_blocks 104
FMD_GetInfo
IsBlockBad(6C): TRUE
IsBlockBad(43A): TRUE
OEMIoControl: Unsupported Code 0x1010104 - device 0x0101 func 65
OEMIoControl: Unsupported Code 0x10100c4 - device 0x0101 func 49
OEMIoControl: Unsupported Code 0x10100c4 - device 0x0101 func 49
OEMIoControl: Unsupported Code 0x10100d0 - device 0x0101 func 52
OEMIoControl: Unsupported Code 0x10100f8 - device 0x0101 func 62
+CS8900:DriverEntry
CS8900:CSInit failure!!
dm9000 init.
[dm9]: Chip signature is 0000291E
INFO: CReg2440Uart::CReg2440Uart using processor frequency reported by the OAL (50000000).
I2C Init
IIC IRQ mapping: [IRQ:27->sysIRQ:19].
Key: DLL_PROCESS_ATTACH.
[Pwrbtn2440.c] EINT_InitializeAddresses Success
[Pwrbtn2440.c] KEY_Init Sucessfully!
[Pwrbtn2440.c] Wait EINT4...
INFO: WAVEDEV.DLL: SetI2SClockRate: Using processor frequency reported by the OAL (50000000).
Prescaler:2
[Bak_hw.cpp] BL_InitializeAddresses - Success
BL_ON progress bar thread closed!
++S3C2440DISP::S3C2440DISP
[s3c2440disp.cpp] rGPCCON = 0xaaaaaaaa
[s3c2440disp.cpp] LCDCON1 = 0x6300179
[s3c2440disp.cpp] LCDCON2 = 0x1577c043
[s3c2440disp.cpp] LCDCON3 = 0x2c31f28
[s3c2440disp.cpp] LCDCON4 = 0xd80
[s3c2440disp.cpp] LCDCON5 = 0x14b09
--S3C2440DISP::InitDisplay done
DISPLAY:800*480
OEMIoControl: Unsupported Code 0x10100fc - device 0x0101 func 63
BL_OFF
Microsoft Windows CE Ethernet Bootloader Common Library Version 1.1 Built Apr 12 2010 09:47:46
Microsoft Windows CE Bootloader for the Samsung SMDK2440 Version 2.4 Built Apr 13 2010
FMD: ReadID (Mfg=ec, Dev=76)
FMD_Init: finished successful
FMD_Init: reserved_blocks 0
FMD_GetInfo
Press [ENTER] to launch image stored on boot media, or [SPACE] to enter boot monitor.
Initiating image launch in 5 seconds.
Ethernet Boot Loader Configuration:
0) IP address: 192.168.1.115
1) Subnet mask: 255.255.255.0
2) DHCP: Disabled
3) Boot delay: 5 seconds
4) Reset to factory default configuration
5) Startup image: LAUNCH EXISTING
6) Program disk image into SmartMedia card: Enabled
7) Program CS8900 MAC address (00:11:22:33:44:55)
8) Kernel Debugger: DISABLED
9) Format Boot Media for BinFS
F) Low-level format the Smart Media card
D) Download image now
L) LAUNCH existing Boot Media image
U) DOWNLOAD image now(USB)
R) Read Configuration
W) Write Configuration Right Now
Enter your selection: u
System ready!
Preparing for download...
Please send the Image through USB.
pUSBCtrlAddr->OCSR1.out_pkt_rdy = 0x1
Ep3Handler : downPtIndex = 0x30800040
Download BIN file information:
-----------------------------------------------------
[0]: Base Address=0x80200000 Length=0x22620b4
-----------------------------------------------------
ROMHDR at Address 80200044h
Writing single region/multi-region update, dwBINFSPartLength: 36053172
IsValidMBR: MBR sector = 0x1a0
g_pbMBRSector[0] = 0xff
g_pbMBRSector[1] = 0xff
g_pbMBRSector[2] = 0xff
g_pbMBRSector[SECTOR_SIZE-2] = 0xff
g_pbMBRSector[SECTOR_SIZE-1] = 0xff
OpenPartition: Invalid MBR. Formatting flash.
Enter LowLevelFormat [0xd, 0xfff].
Erasing flash block(s) [0xd, 0xfff] (please wait): IsBlockBad(43A): TRUE
EraseBlocks: found a bad block (0x43a) - skipping...
Done.
WriteMBR: MBR block = 0xd.
Done.
OpenPartition: Partition Exists=0x0 for part 0x21.
CreatePartition: Enter CreatePartition for 0x21.
IsBlockBad(43A): TRUE
LastLogSector: Last log sector is: 0x1fe3f.
CreatePartition: Start = 0x1c0, Num = 0x11320.
Log2Phys: Logical 0x1c0 -> Physical 0x360
IsBlockBad(43A): TRUE
WriteMBR: MBR block = 0xd.
BP_SetDataPointer at 0x0
WriteData: Start = 0x0, Length = 0x22620b4.
Log2Phys: Logical 0x1c0 -> Physical 0x360
IsBlockBad(43A): TRUE
Updateded TOC!
IsValidMBR: MBR sector = 0x1a0
g_pbMBRSector[0] = 0xe9
g_pbMBRSector[1] = 0xfd
g_pbMBRSector[2] = 0xff
g_pbMBRSector[SECTOR_SIZE-2] = 0x55
g_pbMBRSector[SECTOR_SIZE-1] = 0xaa
OpenPartition: Partition Exists=0x0 for part 0xb.
CreatePartition: Enter CreatePartition for 0xb.
FindFreeSector: FreeSector is: 0x114e0 after processing part 0x21.
CreatePartition: Num sectors set to 0xe820 to allow for compaction blocks.
CreatePartition: Start = 0x114e0, Num = 0xe820.
WriteMBR: MBR block = 0xd.
TOC {
dwSignature: 0x434F544E
BootCfg {
ConfigFlags: 0x830
BootDelay: 0x5
ImageIndex: 1
IP: 192.168.1.115
MAC Address: 00:11:22:33:44:55
Port: 0.0.0.0
SubnetMask: 255.255.255.0
}
ID[0] {
dwVersion: 0x20004
dwSignature: 0x45424F54
String: 'eboot.nb0'
dwImageType: 0x2
dwTtlSectors: 0x200
dwLoadAddress: 0x80038000
dwJumpAddress: 0x80038000
dwStoreOffset: 0x0
sgList[0].dwSector: 0xA0
sgList[0].dwLength: 0x200
}
ID[1] {
dwVersion: 0x1
dwSignature: 0x43465348
String: ''
dwImageType: 0x2
dwTtlSectors: 0x11311
dwLoadAddress: 0x80200000
dwJumpAddress: 0x8022C480
dwStoreOffset: 0x0
sgList[0].dwSector: 0x360
sgList[0].dwLength: 0x11311
}
chainInfo.dwLoadAddress: 0X00000000
chainInfo.dwFlashAddress: 0X00000000
chainInfo.dwLength: 0X00000000
}
waitforconnect
INFO: OEMLaunch: Jumping to Physical Address 0x3022C480h (Virtual Address 0x8022C480h)...
Windows CE Kernel for ARM (Thumb Enabled) Built on Aug 4 2008 at 18:38:38
ProcessorType=0920 Revision=0
sp_abt=ffff5000 sp_irq=ffff2800 sp_undef=ffffc800 OEMAddressTable = 8022c354
DCache: 8 sets, 64 ways, 32 line size, 16384 size
ICache: 8 sets, 64 ways, 32 line size, 16384 size
Sp=ffffc7cc
OEMIoControl: Unsupported Code 0x10100b4 - device 0x0101 func 45
OEMIoControl: Unsupported Code 0x101008c - device 0x0101 func 35
FMD: ReadID (Mfg=ec, Dev=76)
FMD_Init: finished successful
FMD_Init: reserved_blocks 0
FMD_GetInfo
IsBlockBad(4): TRUE
IsBlockBad(43A): TRUE
OEMIoControl: Unsupported Code 0x1010104 - device 0x0101 func 65