Skip to content

Commit

Permalink
Fixed #1
Browse files Browse the repository at this point in the history
  • Loading branch information
gus33000 committed Apr 9, 2019
1 parent 1274236 commit af22227
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 7 additions & 2 deletions FlashingPayloadGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ internal static FlashingPayload[] GetOptimizedPayloads(FlashPart[] flashParts, U
flashPart.Stream.Read(buffer, 0, (Int32)chunkSize);
byte[] hash = crypto.ComputeHash(buffer);

if (flashingPayloads.Any(x => ByteOperations.Compare(x.ChunkHashes.First(), hash)))
byte[] emptyness = new byte[] { 0xFA, 0x43, 0x23, 0x9B, 0xCE, 0xE7, 0xB9, 0x7C, 0xA6, 0x2F, 0x00, 0x7C, 0xC6, 0x84, 0x87, 0x56, 0x0A, 0x39, 0xE1, 0x9F, 0x74, 0xF3, 0xDD, 0xE7, 0x48, 0x6D, 0xB3, 0xF9, 0x8D, 0xF8, 0xE4, 0x71 };

if (!ByteOperations.Compare(emptyness, hash))
flashingPayloads.Add(new FlashingPayload(1, new byte[][] { hash }, new UInt32[] { ((UInt32)flashPart.StartLocation / chunkSize) + i }, new UInt32[] { j }, new Int64[] { position }));

/*if (flashingPayloads.Any(x => ByteOperations.Compare(x.ChunkHashes.First(), hash)))
{
var payloadIndex = flashingPayloads.FindIndex(x => ByteOperations.Compare(x.ChunkHashes.First(), hash));
var locationList = flashingPayloads[payloadIndex].TargetLocations.ToList();
Expand All @@ -96,7 +101,7 @@ internal static FlashingPayload[] GetOptimizedPayloads(FlashPart[] flashParts, U
else
{
flashingPayloads.Add(new FlashingPayload(1, new byte[][] { hash }, new UInt32[] { ((UInt32)flashPart.StartLocation / chunkSize) + i }, new UInt32[] { j }, new Int64[] { position }));
}
}*/

CurrentProcess1++;
ShowProgress(CurrentProcess1, TotalProcess1, startTime);
Expand Down
1 change: 0 additions & 1 deletion Img2Ffu.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
<Compile Include="FlashingPayload.cs" />
<Compile Include="FlashingPayloadGenerator.cs" />
<Compile Include="FlashPart.cs" />
<Compile Include="GetDiskSize.cs" />
<Compile Include="GPT.cs" />
<Compile Include="ImageHeader.cs" />
<Compile Include="ImageSplitter.cs" />
Expand Down
6 changes: 3 additions & 3 deletions StoreHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public class StoreHeader
public UInt32 ValidateDescriptorCount = 0;
public UInt32 ValidateDescriptorLength = 0;
public UInt32 InitialTableIndex = 0;
public UInt32 InitialTableCount = 1;
public UInt32 InitialTableCount = 0;
public UInt32 FlashOnlyTableIndex = 0; // Should be the index of the critical partitions, but for now we don't implement that
public UInt32 FlashOnlyTableCount = 1;
public UInt32 FlashOnlyTableCount = 0;
public UInt32 FinalTableIndex; //= WriteDescriptorCount - FinalTableCount;
public UInt32 FinalTableCount = 2;
public UInt32 FinalTableCount = 0;
}
}

0 comments on commit af22227

Please sign in to comment.