Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #This script requires some binary files, get them by extracting https://files.sshnuke.net/hekate2rawnand.zip
- #If on Windows, easiest way to get a compatible shell for running this script would be to install https://gitforwindows.org/ and then "Git Bash here" in the context menu of this folder
- #To get hekate_ipl to dump USER (and maybe BOOT0/1) you can download my fork from https://github.com/rajkosto/hekate/releases
- if [ ! -f "gpt_prefix.bin" ]; then
- echo "Missing required binary files. Get the zip from https://files.sshnuke.net/hekate2rawnand.zip and extract it to this folder."
- exit 1
- fi
- statusParam="status=progress"
- ddSupportsLine=`dd --help 2>&1 | grep "shows periodic transfer statistics"`
- if [ -z "$ddSupportsLine" ]; then
- statusParam=""
- fi
- dd of=hekate-RawNand.bin if=gpt_prefix.bin skip=0 seek=0 count=34 bs=512
- dd of=hekate-RawNand.bin if=PRODINFO skip=0 seek=34 count=8158 bs=512
- dd of=hekate-RawNand.bin if=PRODINFOF skip=0 seek=256 count=256 bs=16384
- dd of=hekate-RawNand.bin if=BCPKG2-1-Normal-Main skip=0 seek=512 count=512 bs=16384
- dd of=hekate-RawNand.bin if=BCPKG2-2-Normal-Sub skip=0 seek=1024 count=512 bs=16384
- dd of=hekate-RawNand.bin if=BCPKG2-3-SafeMode-Main skip=0 seek=1536 count=512 bs=16384
- dd of=hekate-RawNand.bin if=BCPKG2-4-SafeMode-Sub skip=0 seek=2048 count=512 bs=16384
- dd of=hekate-RawNand.bin if=BCPKG2-5-Repair-Main skip=0 seek=2560 count=512 bs=16384
- dd of=hekate-RawNand.bin if=BCPKG2-6-Repair-Sub skip=0 seek=3072 count=512 bs=16384
- dd of=hekate-RawNand.bin if=SAFE skip=0 seek=3584 count=4096 bs=16384 $statusParam
- dd of=hekate-RawNand.bin if=SYSTEM skip=0 seek=7680 count=163840 bs=16384 $statusParam
- userStartSeek=171520
- userCurrSeek=$userStartSeek
- if [ -f "USER" ]; then
- fileSizeInBlocks=1703936
- dd of=hekate-RawNand.bin if=USER skip=0 seek=$userCurrSeek count=$fileSizeInBlocks bs=16384 $statusParam
- userCurrSeek=`expr "$userCurrSeek" + "$fileSizeInBlocks"`
- else
- for file in USER.*; do
- [ -f "$file" ] || break
- fileSize=`(
- du --apparent-size --block-size=1 "$file" 2>/dev/null ||
- gdu --apparent-size --block-size=1 "$file" 2>/dev/null ||
- find "$file" -printf "%s" 2>/dev/null ||
- gfind "$file" -printf "%s" 2>/dev/null ||
- stat --printf="%s" "$file" 2>/dev/null ||
- stat -f%z "$file" 2>/dev/null ||
- wc -c <"$file" 2>/dev/null
- ) | awk '{print $1}'`
- fileSizeInBlocks=`expr "$fileSize" / 16384`
- dd of=hekate-RawNand.bin "if=$file" skip=0 seek=$userCurrSeek count=$fileSizeInBlocks bs=16384 $statusParam
- userCurrSeek=`expr "$userCurrSeek" + "$fileSizeInBlocks"`
- done
- fi
- if [ "$userCurrSeek" -ne "$userStartSeek" ]; then
- dd of=hekate-RawNand.bin if=gpt_suffix.bin skip=0 seek=61071327 count=33 bs=512
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement