Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
ce87591c
Commit
ce87591c
authored
Jul 24, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unable to get SHA1 value issue
parent
25c289ad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
main.c
jni/magiskboot/main.c
+2
-2
boot_patch.sh
scripts/boot_patch.sh
+5
-5
flash_script.sh
scripts/flash_script.sh
+3
-3
magisk_uninstaller.sh
scripts/magisk_uninstaller.sh
+4
-4
No files found.
jni/magiskboot/main.c
View file @
ce87591c
...
@@ -68,8 +68,8 @@ int main(int argc, char *argv[]) {
...
@@ -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
]);
...
...
scripts/boot_patch.sh
View file @
ce87591c
...
@@ -3,11 +3,11 @@
...
@@ -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 @@
...
@@ -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
...
@@ -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
...
...
scripts/flash_script.sh
View file @
ce87591c
...
@@ -3,7 +3,7 @@
...
@@ -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
...
@@ -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"
...
@@ -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
...
...
scripts/magisk_uninstaller.sh
View file @
ce87591c
...
@@ -3,17 +3,17 @@
...
@@ -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
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment