Skip to content

Commit

Permalink
Merge pull request #33 from liuyq/hikey-aosp
Browse files Browse the repository at this point in the history
HiKeyFastboot.c: add support for sparse image with CHUNK_TYPE_FILL
  • Loading branch information
hzhuang1 authored Aug 25, 2016
2 parents 39add71 + 9cc2c01 commit de2f370
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ HiKeyFastbootPlatformFlashPartition (
CHUNK_HEADER *ChunkHeader;
UINTN Offset = 0;
UINT32 Chunk, EntrySize, EntryOffset;
UINT32 *FillVal, TmpCount, FillBuf[1024];
VOID *Buffer;


Expand Down Expand Up @@ -469,6 +470,27 @@ HiKeyFastbootPlatformFlashPartition (
}
Image+=WriteSize;
break;
case CHUNK_TYPE_FILL:
//Assume fillVal is 0, and we can skip here
FillVal = (UINT32 *)Image;
Image += sizeof(UINT32);
if (*FillVal != 0){
mTextOut->OutputString(mTextOut, OutputString);
for(TmpCount = 0; TmpCount < 1024; TmpCount++){
FillBuf[TmpCount] = *FillVal;
}
for (TmpCount= 0; TmpCount < WriteSize; TmpCount += sizeof(FillBuf)) {
if ((WriteSize - TmpCount) < sizeof(FillBuf)) {
Status = DiskIo->WriteDisk (DiskIo, MediaId, Offset + TmpCount, WriteSize - TmpCount, FillBuf);
} else {
Status = DiskIo->WriteDisk (DiskIo, MediaId, Offset + TmpCount, sizeof(FillBuf), FillBuf);
}
if (EFI_ERROR (Status)) {
return Status;
}
}
}
break;
case CHUNK_TYPE_DONT_CARE:
break;
case CHUNK_TYPE_CRC32:
Expand Down

0 comments on commit de2f370

Please sign in to comment.