mirror of
https://gist.github.com/3793a40dd0c7930f12b79ca1931a3296.git
synced 2025-10-31 13:51:11 -04:00
This commit is contained in:
parent
83aadd766a
commit
ef37aa6d64
@ -1,6 +1,6 @@
|
|||||||
# extract-updater-rofs
|
# extract-updater-rofs
|
||||||
# Extracts firmware CIAs from ROFS containers for some gigaleak SystemUpdaters.
|
# Extracts firmware CIAs from ROFS containers for some gigaleak SystemUpdaters.
|
||||||
# Place in same directory as ROFS named "romfs.bin"
|
# Place in same directory as an extracted "romfs.bin" OR "Contents.cnt"
|
||||||
|
|
||||||
echo "Finding CIA headers in file..."
|
echo "Finding CIA headers in file..."
|
||||||
od -t x -A d romfs.bin | grep "00002020 00000000 00000a00 00000350" | sed 's/ .*//' | sed 's/^0*//' > romfs-dir.txt
|
od -t x -A d romfs.bin | grep "00002020 00000000 00000a00 00000350" | sed 's/ .*//' | sed 's/^0*//' > romfs-dir.txt
|
||||||
@ -76,6 +76,7 @@ START_HEADER=$( tail -n 1 romfs-dir.txt )
|
|||||||
NEXT_HEADER=$((16#$(xxd romfs.bin | grep "226e 6f6e 6522" | sed 's/: .*//' | sed 's/^0*//')));
|
NEXT_HEADER=$((16#$(xxd romfs.bin | grep "226e 6f6e 6522" | sed 's/: .*//' | sed 's/^0*//')));
|
||||||
# Find "226e 6f6e 6522" as it is the last predictable data to mark the end of Contents.cnt and the last CIA.
|
# Find "226e 6f6e 6522" as it is the last predictable data to mark the end of Contents.cnt and the last CIA.
|
||||||
# Upsettingly I have to use xxd because od wouldn't turn up any results for this... I liked od's formatting more :despair:
|
# Upsettingly I have to use xxd because od wouldn't turn up any results for this... I liked od's formatting more :despair:
|
||||||
|
if [ $NEXT_HEADER != "" ]; then
|
||||||
echo " Check CIA length"
|
echo " Check CIA length"
|
||||||
echo "Final CIA header at ${START_HEADER}"
|
echo "Final CIA header at ${START_HEADER}"
|
||||||
echo "Contents.cnt end at ${NEXT_HEADER}"
|
echo "Contents.cnt end at ${NEXT_HEADER}"
|
||||||
@ -100,3 +101,5 @@ dd skip=${START_HEADER} count=${CIA_LENGTH} if=romfs.bin of="0.cia" bs=1
|
|||||||
echo "Final CIA output as '0.cia', ${CIA_LENGTH} bytes."
|
echo "Final CIA output as '0.cia', ${CIA_LENGTH} bytes."
|
||||||
echo "================================================="
|
echo "================================================="
|
||||||
echo "All CIAs extracted from RomFS!"
|
echo "All CIAs extracted from RomFS!"
|
||||||
|
else
|
||||||
|
echo "Could not find end of last CIA! For extracting manually, start address is ${START_HEADER} (decimal)"
|
||||||
Loading…
Reference in New Issue
Block a user