diff options
author | Haojian Zhuang <haojian.zhuang@outlook.com> | 2016-08-25 17:54:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-25 17:54:46 +0800 |
commit | c4dd1326b07c3b5e9e98e5b5e95309025955769d (patch) | |
tree | 07838f485ff302a1df83732a654802d5692696d8 | |
parent | 4afb800c14c9cbe19ca9e718d0977e3df11112e1 (diff) | |
parent | bc1a46415e550b03b01318e49f7f34613153d2b2 (diff) | |
download | OpenPlatformPkg-c4dd1326b07c3b5e9e98e5b5e95309025955769d.tar.gz |
Merge pull request #31 from liuyq/hikey-aosp
HiKeyFastboot.c: add support for sparse image with CHUNK_TYPE_FILL
-rw-r--r-- | Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c index 7dafa19..61292bf 100644 --- a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c +++ b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c @@ -363,6 +363,7 @@ HiKeyFastbootPlatformFlashPartition ( CHUNK_HEADER *ChunkHeader;
UINTN Offset = 0;
UINT32 Chunk, EntrySize, EntryOffset;
+ UINT32 *FillVal, TmpCount, FillBuf[1024];
VOID *Buffer;
@@ -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, WriteDisk - 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:
|