From 260dda65648d54a56058e231ce32790ea4bb18f7 Mon Sep 17 00:00:00 2001 From: HappyZ Date: Mon, 3 Dec 2018 02:10:56 -0600 Subject: [PATCH] Update README.md --- fw_updater_packer_unpacker/README.md | 71 +++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/fw_updater_packer_unpacker/README.md b/fw_updater_packer_unpacker/README.md index ae4bb57..275e8ce 100644 --- a/fw_updater_packer_unpacker/README.md +++ b/fw_updater_packer_unpacker/README.md @@ -1,6 +1,26 @@ -# Official Version +# 0x0 Allow your DPT to accept PKG without correct key -Only support unpacking since we don't have the encryption key to repack it. +This will create SECURITY FLAW in your system! + +Comment out the key verification: (edit via `busybox vi`) +``` +######################################## +# verify sig +######################################## +# dd if=$1 bs=$(($DATA_OFFSET)) skip=1 2>/dev/null | head -c $(($BODY_SIZE)) | +# openssl dgst -sha256 -verify $3 -signature $SIG_FILE 1>/dev/null +# if [ $? -ne 0 ] +# then +# echo "Verify failed." +# exit 0 +# fi +``` + +# 0x1 Create your own PKG package + +## Use Official PKGs as Examples + +An easy approach is to use the official pkg to begin with. Once you have downloaded the official pkg, use `official_pkg_unpacker_pkg.sh` to unpack it. Usage: ``` @@ -8,20 +28,49 @@ chmod +x official_pkg_unpacker_pkg.sh ./official_pkg_unpacker_pkg.sh ``` -# Unofficial Version +Then you can change the bash and let it run "anything" (as long as supported in diagnosis mode) during the update. -With modified diagnosis mode, it shall support unofficial pkg. +## Tips -Unpacker is the same as official one, except we disabled verification. +* In the bash, `exit 0` means it will reboot, while `exit 1` or any error status will shut down the system. +* Double check your commands. Try them first in diagnosis mode. -The repacker follows a reversed procedure, but we simply use the data encryption key. +# 0x2 Re-Pack it with your own key -Usage: +(as written in the bash, I use the data decryption key instead) + +Pack the PKG with: ``` -chmod +x unofficial_pkg_unpacker_pkg.sh chmod +x unofficial_pkg_repacker_pkg.sh - -./unofficial_pkg_unpacker_pkg.sh ./unofficial_pkg_repacker_pkg.sh -``` \ No newline at end of file +``` + +# 0x3 Validate the package + + +Easy validation by unpacking it again: +``` +chmod +x unofficial_pkg_unpacker_pkg.sh + +./unofficial_pkg_unpacker_pkg.sh +``` + +If succeeded, the package PKG will be recognized by the DPT system. + + +# 0x4 Flash it + +You can use `dpt-tools.py` to update the firmware you made: + +``` +python dpt-tools.py -id -k -ip +``` +Then type `fw` and follow the instruction. + + +# Known Issues + +* After reboot, it will appear errors saying update failed. But PKG is actually applied. + +* Not supporting animations yet.