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
32ee8e46
Commit
32ee8e46
authored
Nov 14, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly and fully support dtbo patching
parent
e79aa54b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
16 deletions
+20
-16
java
java
+1
-1
bootstages.c
jni/core/bootstages.c
+3
-2
flash_script.sh
scripts/flash_script.sh
+1
-1
util_functions.sh
scripts/util_functions.sh
+15
-12
No files found.
java
@
389299af
Subproject commit
99c74b31be15a239fdffe4a727d2d83feb52b8bb
Subproject commit
389299afd103337ec3ab787278ac56ac249f9195
jni/core/bootstages.c
View file @
32ee8e46
...
...
@@ -621,10 +621,11 @@ void post_fs_data(int client) {
rm_rf
(
DATABIN
);
cp_afc
(
bin_path
,
DATABIN
);
rm_rf
(
bin_path
);
// Lazy.... use shell blob to match files
exec_command_sync
(
"sh"
,
"-c"
,
"mv /data/magisk/stock_boot* /data"
,
NULL
);
}
// Lazy.... use shell blob to match files
exec_command_sync
(
"sh"
,
"-c"
,
"mv -f /data/magisk/stock_*.img.gz /data"
,
NULL
);
// Initialize
daemon_init
();
...
...
scripts/flash_script.sh
View file @
32ee8e46
...
...
@@ -102,7 +102,7 @@ $BOOTMODE || recovery_actions
# Boot patching
##########################################################################################
find_boot_image
[
-z
$BOOTIMAGE
]
&&
find_boot_image
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
ui_print
"- Found boot image:
$BOOTIMAGE
"
...
...
scripts/util_functions.sh
View file @
32ee8e46
...
...
@@ -100,15 +100,14 @@ resolve_link() {
}
find_boot_image
()
{
if
[
-z
"
$BOOTIMAGE
"
]
;
then
if
[
!
-z
$SLOT
]
;
then
BOOTIMAGE
=
`
find /dev/block
-iname
boot
$SLOT
|
head
-n
1
`
2>/dev/null
else
for
BLOCK
in
boot_a kern-a android_boot kernel boot lnx bootimg
;
do
BOOTIMAGE
=
`
find /dev/block
-iname
$BLOCK
|
head
-n
1
`
2>/dev/null
[
!
-z
$BOOTIMAGE
]
&&
break
done
fi
BOOTIMAGE
=
if
[
!
-z
$SLOT
]
;
then
BOOTIMAGE
=
`
find /dev/block
-iname
boot
$SLOT
|
head
-n
1
`
2>/dev/null
else
for
BLOCK
in
boot_a kern-a android_boot kernel boot lnx bootimg
;
do
BOOTIMAGE
=
`
find /dev/block
-iname
$BLOCK
|
head
-n
1
`
2>/dev/null
[
!
-z
$BOOTIMAGE
]
&&
break
done
fi
# Recovery fallback
if
[
-z
"
$BOOTIMAGE
"
]
;
then
...
...
@@ -123,8 +122,7 @@ find_boot_image() {
migrate_boot_backup
()
{
# Update the broken boot backup
if
[
-f
/data/stock_boot_.img.gz
]
;
then
$MAGISKBIN
/magiskboot
--decompress
/data/stock_boot_.img.gz
mv
/data/stock_boot_.img /data/stock_boot.img
$MAGISKBIN
/magiskboot
--decompress
/data/stock_boot_.img.gz /data/stock_boot.img
fi
# Update our previous backup to new format if exists
if
[
-f
/data/stock_boot.img
]
;
then
...
...
@@ -171,13 +169,18 @@ patch_dtbo_image() {
$MAGISKBIN
/magiskboot
--compress
$DTBOIMAGE
$MAGISKBIN
/stock_dtbo.img.gz
ui_print
"- Patching fstab in dtbo to remove avb-verity"
$MAGISKBIN
/magiskboot
--dtb-patch
$DTBOIMAGE
return
0
fi
fi
return
1
}
restore_imgs
()
{
STOCKBOOT
=
/data/stock_boot_
${
1
}
.img.gz
STOCKDTBO
=
/data/stock_dtbo.img.gz
# Make sure all blocks are writable
$MAGISKBIN
/magisk
--unlock-blocks
2>/dev/null
find_dtbo_image
if
[
!
-z
"
$DTBOIMAGE
"
-a
-f
"
$STOCKDTBO
"
]
;
then
ui_print
"- Restoring stock dtbo image"
...
...
@@ -187,7 +190,7 @@ restore_imgs() {
find_boot_image
if
[
!
-z
"
$BOOTIMAGE
"
-a
-f
"
$STOCKBOOT
"
]
;
then
ui_print
"- Restoring stock boot image"
flash_boot_image
$STOCKBOOT
"
$BOOTIMAGE
"
gzip
-d
<
$STOCKBOOT
|
cat
- /dev/zero 2>/dev/null |
dd
of
=
"
$BOOTIMAGE
"
bs
=
4096 2>/dev/null
return
0
fi
return
1
...
...
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