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
22857064
Commit
22857064
authored
Nov 24, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce KEEPVBMETAFLAG env variable
Close #4447, close #4906, close #4901, close #4964
parent
65a79610
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
11 deletions
+20
-11
bootimg.cpp
native/jni/magiskboot/bootimg.cpp
+3
-1
main.cpp
native/jni/magiskboot/main.cpp
+12
-10
boot_patch.sh
scripts/boot_patch.sh
+3
-0
util_functions.sh
scripts/util_functions.sh
+2
-0
No files found.
native/jni/magiskboot/bootimg.cpp
View file @
22857064
...
...
@@ -768,8 +768,10 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) {
memcpy
(
footer
,
boot
.
avb_footer
,
sizeof
(
AvbFooter
));
footer
->
original_image_size
=
__builtin_bswap64
(
off
.
total
);
footer
->
vbmeta_offset
=
__builtin_bswap64
(
off
.
vbmeta
);
if
(
!
check_env
(
"KEEPVBMETAFLAG"
))
{
vbmeta
->
flags
=
__builtin_bswap32
(
3
);
}
}
if
(
boot
.
flags
[
DHTB_FLAG
])
{
// DHTB header
...
...
native/jni/magiskboot/main.cpp
View file @
22857064
...
...
@@ -6,7 +6,7 @@
using
namespace
std
;
static
void
print_
method
s
()
{
static
void
print_
format
s
()
{
for
(
int
fmt
=
GZIP
;
fmt
<
LZOP
;
++
fmt
)
{
fprintf
(
stderr
,
"%s "
,
fmt2name
[(
format_t
)
fmt
]);
}
...
...
@@ -33,8 +33,10 @@ Supported actions:
Repack boot image components from current directory
to [outbootimg], or new-boot.img if not specified.
If '-n' is provided, it will not attempt to recompress ramdisk.cpio,
otherwise it will compress ramdisk.cpio and kernel with the same method
in <origbootimg> if the file provided is not already compressed.
otherwise it will compress ramdisk.cpio and kernel with the same format
as in <origbootimg> if the file provided is not already compressed.
All disable flags will be set in the vbmeta header, unless env variable
KEEPVBMETAFLAG is set to true.
hexpatch <file> <hexpattern1> <hexpattern2>
Search <hexpattern1> in <file>, and replace with <hexpattern2>
...
...
@@ -91,21 +93,21 @@ Supported actions:
cleanup
Cleanup the current working directory
compress[=
method
] <infile> [outfile]
Compress <infile> with [
method
] (default: gzip), optionally to [outfile]
compress[=
format
] <infile> [outfile]
Compress <infile> with [
format
] (default: gzip), optionally to [outfile]
<infile>/[outfile] can be '-' to be STDIN/STDOUT
Supported
method
s: )EOF"
,
arg0
);
Supported
format
s: )EOF"
,
arg0
);
print_
method
s
();
print_
format
s
();
fprintf
(
stderr
,
R"EOF(
decompress <infile> [outfile]
Detect
method
and decompress <infile>, optionally to [outfile]
Detect
format
and decompress <infile>, optionally to [outfile]
<infile>/[outfile] can be '-' to be STDIN/STDOUT
Supported
method
s: )EOF"
);
Supported
format
s: )EOF"
);
print_
method
s
();
print_
format
s
();
fprintf
(
stderr
,
"
\n\n
"
);
exit
(
1
);
...
...
scripts/boot_patch.sh
View file @
22857064
...
...
@@ -70,9 +70,11 @@ fi
# Flags
[
-z
$KEEPVERITY
]
&&
KEEPVERITY
=
false
[
-z
$KEEPFORCEENCRYPT
]
&&
KEEPFORCEENCRYPT
=
false
[
-z
$KEEPVBMETAFLAG
]
&&
KEEPVBMETAFLAG
=
false
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
export
KEEPVERITY
export
KEEPFORCEENCRYPT
export
KEEPVBMETAFLAG
chmod
-R
755
.
...
...
@@ -149,6 +151,7 @@ ui_print "- Patching ramdisk"
echo
"KEEPVERITY=
$KEEPVERITY
"
>
config
echo
"KEEPFORCEENCRYPT=
$KEEPFORCEENCRYPT
"
>>
config
echo
"KEEPVBMETAFLAG=
$KEEPVBMETAFLAG
"
>>
config
echo
"RECOVERYMODE=
$RECOVERYMODE
"
>>
config
[
!
-z
$SHA1
]
&&
echo
"SHA1=
$SHA1
"
>>
config
...
...
scripts/util_functions.sh
View file @
22857064
...
...
@@ -382,6 +382,7 @@ get_flags() {
getvar KEEPVERITY
getvar KEEPFORCEENCRYPT
getvar RECOVERYMODE
getvar KEEPVBMETAFLAG
if
[
-z
$KEEPVERITY
]
;
then
if
$SYSTEM_ROOT
;
then
KEEPVERITY
=
true
...
...
@@ -402,6 +403,7 @@ get_flags() {
KEEPFORCEENCRYPT
=
false
fi
fi
[
-z
$KEEPVBMETAFLAG
]
&&
KEEPVBMETAFLAG
=
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