Fix unable to get SHA1 value issue
This commit is contained in:
parent
25c289ad3e
commit
ce87591c62
@ -68,8 +68,8 @@ int main(int argc, char *argv[]) {
|
|||||||
mmap_ro(argv[2], (unsigned char **) &buf, &size);
|
mmap_ro(argv[2], (unsigned char **) &buf, &size);
|
||||||
SHA1(sha1, buf, size);
|
SHA1(sha1, buf, size);
|
||||||
for (int i = 0; i < 20; ++i)
|
for (int i = 0; i < 20; ++i)
|
||||||
fprintf(stderr, "%02x", sha1[i]);
|
printf("%02x", sha1[i]);
|
||||||
fprintf(stderr, "\n");
|
printf("\n");
|
||||||
munmap(buf, size);
|
munmap(buf, size);
|
||||||
} else if (argc > 2 && strcmp(argv[1], "--unpack") == 0) {
|
} else if (argc > 2 && strcmp(argv[1], "--unpack") == 0) {
|
||||||
unpack(argv[2]);
|
unpack(argv[2]);
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
#
|
#
|
||||||
# Magisk Boot Image Patcher
|
# Magisk Boot Image Patcher
|
||||||
# by topjohnwu
|
# by topjohnwu
|
||||||
#
|
#
|
||||||
# This script should be placed in a directory with the following files:
|
# This script should be placed in a directory with the following files:
|
||||||
#
|
#
|
||||||
# File name type Description
|
# File name type Description
|
||||||
#
|
#
|
||||||
# boot_patch.sh script A script to patch boot. Expect path to boot image as parameter.
|
# boot_patch.sh script A script to patch boot. Expect path to boot image as parameter.
|
||||||
# (this file) The script will use binaries and files in its same directory
|
# (this file) The script will use binaries and files in its same directory
|
||||||
# to complete the patching process
|
# to complete the patching process
|
||||||
@ -19,7 +19,7 @@
|
|||||||
# All magisk entrypoints are defined here
|
# All magisk entrypoints are defined here
|
||||||
# chromeos folder This folder should store all the utilities and keys to sign
|
# chromeos folder This folder should store all the utilities and keys to sign
|
||||||
# (optional) a chromeos device, used in the tablet Pixel C
|
# (optional) a chromeos device, used in the tablet Pixel C
|
||||||
#
|
#
|
||||||
# If the script is not running as root, then the input boot image should be a stock image
|
# If the script is not running as root, then the input boot image should be a stock image
|
||||||
# or have a backup included in ramdisk internally, since we cannot access the stock boot
|
# or have a backup included in ramdisk internally, since we cannot access the stock boot
|
||||||
# image placed under /data we've created when previously installing
|
# image placed under /data we've created when previously installing
|
||||||
@ -147,7 +147,7 @@ case $? in
|
|||||||
0 ) # Stock boot
|
0 ) # Stock boot
|
||||||
ui_print_wrap "- Stock boot image detected!"
|
ui_print_wrap "- Stock boot image detected!"
|
||||||
ui_print_wrap "- Backing up stock boot image"
|
ui_print_wrap "- Backing up stock boot image"
|
||||||
SHA1=`./magiskboot --sha1 "$BOOTIMAGE" | tail -n 1`
|
SHA1=`./magiskboot --sha1 "$BOOTIMAGE" 2>/dev/null`
|
||||||
STOCKDUMP=stock_boot_${SHA1}.img
|
STOCKDUMP=stock_boot_${SHA1}.img
|
||||||
dd if="$BOOTIMAGE" of=$STOCKDUMP
|
dd if="$BOOTIMAGE" of=$STOCKDUMP
|
||||||
./magiskboot --compress $STOCKDUMP
|
./magiskboot --compress $STOCKDUMP
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Magisk Flash Script
|
# Magisk Flash Script
|
||||||
# by topjohnwu
|
# by topjohnwu
|
||||||
#
|
#
|
||||||
# This script will detect, construct the environment for Magisk
|
# This script will detect, construct the environment for Magisk
|
||||||
# It will then call boot_patch.sh to patch the boot image
|
# It will then call boot_patch.sh to patch the boot image
|
||||||
#
|
#
|
||||||
@ -87,7 +87,7 @@ find_boot_image
|
|||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
ui_print "- Constructing environment"
|
ui_print "- Constructing environment"
|
||||||
|
|
||||||
is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
|
is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
|
||||||
|
|
||||||
# Copy required files
|
# Copy required files
|
||||||
@ -152,7 +152,7 @@ ui_print "- Found Boot Image: $BOOTIMAGE"
|
|||||||
|
|
||||||
# Update our previous backup to new format if exists
|
# Update our previous backup to new format if exists
|
||||||
if [ -f /data/stock_boot.img ]; then
|
if [ -f /data/stock_boot.img ]; then
|
||||||
SHA1=`$MAGISKBIN/magiskboot --sha1 /data/stock_boot.img | tail -n 1`
|
SHA1=`$MAGISKBIN/magiskboot --sha1 /data/stock_boot.img 2>/dev/null`
|
||||||
STOCKDUMP=/data/stock_boot_${SHA1}.img
|
STOCKDUMP=/data/stock_boot_${SHA1}.img
|
||||||
mv /data/stock_boot.img $STOCKDUMP
|
mv /data/stock_boot.img $STOCKDUMP
|
||||||
$MAGISKBIN/magiskboot --compress $STOCKDUMP
|
$MAGISKBIN/magiskboot --compress $STOCKDUMP
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
#
|
#
|
||||||
# Magisk Uninstaller
|
# Magisk Uninstaller
|
||||||
# by topjohnwu
|
# by topjohnwu
|
||||||
#
|
#
|
||||||
# This script can be placed in /cache/magisk_uninstaller.sh
|
# This script can be placed in /cache/magisk_uninstaller.sh
|
||||||
# The Magisk main binary will pick up the script, and uninstall itself, following a reboot
|
# The Magisk main binary will pick up the script, and uninstall itself, following a reboot
|
||||||
# This script can also be used in flashable zip with the uninstaller_loader.sh
|
# This script can also be used in flashable zip with the uninstaller_loader.sh
|
||||||
#
|
#
|
||||||
# This script will try to do restoration with the following:
|
# This script will try to do restoration with the following:
|
||||||
# 1-1. Find and restore the original stock boot image dump (OTA proof)
|
# 1-1. Find and restore the original stock boot image dump (OTA proof)
|
||||||
# 1-2. If 1-1 fails, restore ramdisk from the internal backup
|
# 1-2. If 1-1 fails, restore ramdisk from the internal backup
|
||||||
# (ramdisk fully restored, not OTA friendly)
|
# (ramdisk fully restored, not OTA friendly)
|
||||||
# 1-3. If 1-2 fails, it will remove added files in ramdisk, however modified files
|
# 1-3. If 1-2 fails, it will remove added files in ramdisk, however modified files
|
||||||
# are remained modified, because we have no backups. By doing so, Magisk will
|
# are remained modified, because we have no backups. By doing so, Magisk will
|
||||||
# not be started at boot, but this isn't actually 100% cleaned up
|
# not be started at boot, but this isn't actually 100% cleaned up
|
||||||
# 2. Remove all Magisk related files
|
# 2. Remove all Magisk related files
|
||||||
# (The list is LARGE, most likely due to bad decision in early versions
|
# (The list is LARGE, most likely due to bad decision in early versions
|
||||||
@ -84,7 +84,7 @@ esac
|
|||||||
|
|
||||||
# Update our previous backup to new format if exists
|
# Update our previous backup to new format if exists
|
||||||
if [ -f /data/stock_boot.img ]; then
|
if [ -f /data/stock_boot.img ]; then
|
||||||
SHA1=`./magiskboot --sha1 /data/stock_boot.img | tail -n 1`
|
SHA1=`./magiskboot --sha1 /data/stock_boot.img 2>/dev/null`
|
||||||
STOCKDUMP=/data/stock_boot_${SHA1}.img
|
STOCKDUMP=/data/stock_boot_${SHA1}.img
|
||||||
mv /data/stock_boot.img $STOCKDUMP
|
mv /data/stock_boot.img $STOCKDUMP
|
||||||
./magiskboot --compress $STOCKDUMP
|
./magiskboot --compress $STOCKDUMP
|
||||||
|
Loading…
Reference in New Issue
Block a user