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
f4ed6274
Commit
f4ed6274
authored
Dec 14, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Invert vbmeta header patching config
vbmeta header should not be patched in most cases
parent
56eb1a1c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
bootimg.cpp
native/jni/magiskboot/bootimg.cpp
+1
-1
main.cpp
native/jni/magiskboot/main.cpp
+2
-2
boot_patch.sh
scripts/boot_patch.sh
+3
-3
util_functions.sh
scripts/util_functions.sh
+2
-2
No files found.
native/jni/magiskboot/bootimg.cpp
View file @
f4ed6274
...
@@ -756,7 +756,7 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) {
...
@@ -756,7 +756,7 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) {
memcpy
(
footer
,
boot
.
avb_footer
,
sizeof
(
AvbFooter
));
memcpy
(
footer
,
boot
.
avb_footer
,
sizeof
(
AvbFooter
));
footer
->
original_image_size
=
__builtin_bswap64
(
off
.
total
);
footer
->
original_image_size
=
__builtin_bswap64
(
off
.
total
);
footer
->
vbmeta_offset
=
__builtin_bswap64
(
off
.
vbmeta
);
footer
->
vbmeta_offset
=
__builtin_bswap64
(
off
.
vbmeta
);
if
(
!
check_env
(
"KEEP
VBMETAFLAG"
))
{
if
(
check_env
(
"PATCH
VBMETAFLAG"
))
{
vbmeta
->
flags
=
__builtin_bswap32
(
3
);
vbmeta
->
flags
=
__builtin_bswap32
(
3
);
}
}
}
}
...
...
native/jni/magiskboot/main.cpp
View file @
f4ed6274
...
@@ -35,8 +35,8 @@ Supported actions:
...
@@ -35,8 +35,8 @@ Supported actions:
If '-n' is provided, it will not attempt to recompress ramdisk.cpio,
If '-n' is provided, it will not attempt to recompress ramdisk.cpio,
otherwise it will compress ramdisk.cpio and kernel with the same format
otherwise it will compress ramdisk.cpio and kernel with the same format
as in <origbootimg> if the file provided is not already compressed.
as in <origbootimg> if the file provided is not already compressed.
All disable flags will be set in the vbmeta header, unless env variable
If env variable PATCHVBMETAFLAG is set to true, all disable flags will
KEEPVBMETAFLAG is set to true
.
be set in the vbmeta header
.
hexpatch <file> <hexpattern1> <hexpattern2>
hexpatch <file> <hexpattern1> <hexpattern2>
Search <hexpattern1> in <file>, and replace with <hexpattern2>
Search <hexpattern1> in <file>, and replace with <hexpattern2>
...
...
scripts/boot_patch.sh
View file @
f4ed6274
...
@@ -70,11 +70,11 @@ fi
...
@@ -70,11 +70,11 @@ fi
# Flags
# Flags
[
-z
$KEEPVERITY
]
&&
KEEPVERITY
=
false
[
-z
$KEEPVERITY
]
&&
KEEPVERITY
=
false
[
-z
$KEEPFORCEENCRYPT
]
&&
KEEPFORCEENCRYPT
=
false
[
-z
$KEEPFORCEENCRYPT
]
&&
KEEPFORCEENCRYPT
=
false
[
-z
$
KEEPVBMETAFLAG
]
&&
KEEP
VBMETAFLAG
=
false
[
-z
$
PATCHVBMETAFLAG
]
&&
PATCH
VBMETAFLAG
=
false
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
export
KEEPVERITY
export
KEEPVERITY
export
KEEPFORCEENCRYPT
export
KEEPFORCEENCRYPT
export
KEEP
VBMETAFLAG
export
PATCH
VBMETAFLAG
chmod
-R
755
.
chmod
-R
755
.
...
@@ -151,7 +151,7 @@ ui_print "- Patching ramdisk"
...
@@ -151,7 +151,7 @@ ui_print "- Patching ramdisk"
echo
"KEEPVERITY=
$KEEPVERITY
"
>
config
echo
"KEEPVERITY=
$KEEPVERITY
"
>
config
echo
"KEEPFORCEENCRYPT=
$KEEPFORCEENCRYPT
"
>>
config
echo
"KEEPFORCEENCRYPT=
$KEEPFORCEENCRYPT
"
>>
config
echo
"
KEEPVBMETAFLAG=
$KEEP
VBMETAFLAG
"
>>
config
echo
"
PATCHVBMETAFLAG=
$PATCH
VBMETAFLAG
"
>>
config
echo
"RECOVERYMODE=
$RECOVERYMODE
"
>>
config
echo
"RECOVERYMODE=
$RECOVERYMODE
"
>>
config
[
!
-z
$SHA1
]
&&
echo
"SHA1=
$SHA1
"
>>
config
[
!
-z
$SHA1
]
&&
echo
"SHA1=
$SHA1
"
>>
config
...
...
scripts/util_functions.sh
View file @
f4ed6274
...
@@ -382,7 +382,7 @@ get_flags() {
...
@@ -382,7 +382,7 @@ get_flags() {
getvar KEEPVERITY
getvar KEEPVERITY
getvar KEEPFORCEENCRYPT
getvar KEEPFORCEENCRYPT
getvar RECOVERYMODE
getvar RECOVERYMODE
getvar
KEEP
VBMETAFLAG
getvar
PATCH
VBMETAFLAG
if
[
-z
$KEEPVERITY
]
;
then
if
[
-z
$KEEPVERITY
]
;
then
if
$SYSTEM_ROOT
;
then
if
$SYSTEM_ROOT
;
then
KEEPVERITY
=
true
KEEPVERITY
=
true
...
@@ -403,7 +403,7 @@ get_flags() {
...
@@ -403,7 +403,7 @@ get_flags() {
KEEPFORCEENCRYPT
=
false
KEEPFORCEENCRYPT
=
false
fi
fi
fi
fi
[
-z
$
KEEPVBMETAFLAG
]
&&
KEEP
VBMETAFLAG
=
false
[
-z
$
PATCHVBMETAFLAG
]
&&
PATCH
VBMETAFLAG
=
false
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
}
}
...
...
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