Permalink
Browse files

Had a brain fart - Fixes nandb dump/flash

  • Loading branch information...
DanTheMan827 committed Jul 20, 2018
1 parent 2750807 commit 1226cdc01a3c4a578edd297c2ee3a6a89a0f22d1
Showing with 4 additions and 4 deletions.
  1. +4 −4 Tasks/MembootTasks.cs
@@ -659,7 +659,7 @@ public static TaskFunc ProcessNand(string nandDump, NandTasks task)
switch (task)
{
case NandTasks.DumpNandB:
partitionSize = long.Parse(hakchi.Shell.ExecuteSimple($"echo $((($(hexdump -e '1/4 \"%u\"' -s $((0x28)) -n 4 ${osDecryptedDevice})+0xfff)/0x1000))", throwOnNonZero: true).Trim()) * 4 * 1024;
partitionSize = long.Parse(hakchi.Shell.ExecuteSimple($"echo $((($(hexdump -e '1/4 \"%u\"' -s $((0x28)) -n 4 {osDecryptedDevice})+0xfff)/0x1000))", throwOnNonZero: true).Trim()) * 4 * 1024;
break;
case NandTasks.FlashNandB:
@@ -671,7 +671,7 @@ public static TaskFunc ProcessNand(string nandDump, NandTasks task)
hakchi.Shell.ExecuteSimple("cryptsetup open /dev/nandb root-crypt --type plain --cipher aes-xts-plain --key-file /key-file", 2000, true);
}
partitionSize = long.Parse(hakchi.Shell.ExecuteSimple($"blockdev --getsize64 ${osDecryptedDevice}", throwOnNonZero: true));
partitionSize = long.Parse(hakchi.Shell.ExecuteSimple($"blockdev --getsize64 {osDecryptedDevice}", throwOnNonZero: true));
break;
case NandTasks.DumpNandC:
@@ -724,11 +724,11 @@ public static TaskFunc ProcessNand(string nandDump, NandTasks task)
switch (task)
{
case NandTasks.DumpNandB:
Shared.ShellPipe($"dd if=${osDecryptedDevice} bs=128K count={(partitionSize / 1024) / 4 }", null, file, throwOnNonZero: true);
Shared.ShellPipe($"dd if={osDecryptedDevice} bs=128K count={(partitionSize / 1024) / 4 }", null, file, throwOnNonZero: true);
break;
case NandTasks.FlashNandB:
Shared.ShellPipe($"dd of=${osDecryptedDevice} bs=128K", file, throwOnNonZero: true);
Shared.ShellPipe($"dd of={osDecryptedDevice} bs=128K", file, throwOnNonZero: true);
if(hasKeyfile)
hakchi.Shell.Execute("cryptsetup close root-crypt", throwOnNonZero: true);
break;

0 comments on commit 1226cdc

Please sign in to comment.