mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-03-28 01:02:19 +00:00
Introduce KEEPVBMETAFLAG env variable
Close #4447, close #4906, close #4901, close #4964
This commit is contained in:
parent
65a79610aa
commit
228570640e
@ -768,7 +768,9 @@ 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);
|
||||||
vbmeta->flags = __builtin_bswap32(3);
|
if (!check_env("KEEPVBMETAFLAG")) {
|
||||||
|
vbmeta->flags = __builtin_bswap32(3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boot.flags[DHTB_FLAG]) {
|
if (boot.flags[DHTB_FLAG]) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static void print_methods() {
|
static void print_formats() {
|
||||||
for (int fmt = GZIP; fmt < LZOP; ++fmt) {
|
for (int fmt = GZIP; fmt < LZOP; ++fmt) {
|
||||||
fprintf(stderr, "%s ", fmt2name[(format_t) fmt]);
|
fprintf(stderr, "%s ", fmt2name[(format_t) fmt]);
|
||||||
}
|
}
|
||||||
@ -33,8 +33,10 @@ Supported actions:
|
|||||||
Repack boot image components from current directory
|
Repack boot image components from current directory
|
||||||
to [outbootimg], or new-boot.img if not specified.
|
to [outbootimg], or new-boot.img if not specified.
|
||||||
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 method
|
otherwise it will compress ramdisk.cpio and kernel with the same format
|
||||||
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
|
||||||
|
KEEPVBMETAFLAG is set to true.
|
||||||
|
|
||||||
hexpatch <file> <hexpattern1> <hexpattern2>
|
hexpatch <file> <hexpattern1> <hexpattern2>
|
||||||
Search <hexpattern1> in <file>, and replace with <hexpattern2>
|
Search <hexpattern1> in <file>, and replace with <hexpattern2>
|
||||||
@ -91,21 +93,21 @@ Supported actions:
|
|||||||
cleanup
|
cleanup
|
||||||
Cleanup the current working directory
|
Cleanup the current working directory
|
||||||
|
|
||||||
compress[=method] <infile> [outfile]
|
compress[=format] <infile> [outfile]
|
||||||
Compress <infile> with [method] (default: gzip), optionally to [outfile]
|
Compress <infile> with [format] (default: gzip), optionally to [outfile]
|
||||||
<infile>/[outfile] can be '-' to be STDIN/STDOUT
|
<infile>/[outfile] can be '-' to be STDIN/STDOUT
|
||||||
Supported methods: )EOF", arg0);
|
Supported formats: )EOF", arg0);
|
||||||
|
|
||||||
print_methods();
|
print_formats();
|
||||||
|
|
||||||
fprintf(stderr, R"EOF(
|
fprintf(stderr, R"EOF(
|
||||||
|
|
||||||
decompress <infile> [outfile]
|
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
|
<infile>/[outfile] can be '-' to be STDIN/STDOUT
|
||||||
Supported methods: )EOF");
|
Supported formats: )EOF");
|
||||||
|
|
||||||
print_methods();
|
print_formats();
|
||||||
|
|
||||||
fprintf(stderr, "\n\n");
|
fprintf(stderr, "\n\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -70,9 +70,11 @@ fi
|
|||||||
# Flags
|
# Flags
|
||||||
[ -z $KEEPVERITY ] && KEEPVERITY=false
|
[ -z $KEEPVERITY ] && KEEPVERITY=false
|
||||||
[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false
|
[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false
|
||||||
|
[ -z $KEEPVBMETAFLAG ] && KEEPVBMETAFLAG=false
|
||||||
[ -z $RECOVERYMODE ] && RECOVERYMODE=false
|
[ -z $RECOVERYMODE ] && RECOVERYMODE=false
|
||||||
export KEEPVERITY
|
export KEEPVERITY
|
||||||
export KEEPFORCEENCRYPT
|
export KEEPFORCEENCRYPT
|
||||||
|
export KEEPVBMETAFLAG
|
||||||
|
|
||||||
chmod -R 755 .
|
chmod -R 755 .
|
||||||
|
|
||||||
@ -149,6 +151,7 @@ ui_print "- Patching ramdisk"
|
|||||||
|
|
||||||
echo "KEEPVERITY=$KEEPVERITY" > config
|
echo "KEEPVERITY=$KEEPVERITY" > config
|
||||||
echo "KEEPFORCEENCRYPT=$KEEPFORCEENCRYPT" >> config
|
echo "KEEPFORCEENCRYPT=$KEEPFORCEENCRYPT" >> config
|
||||||
|
echo "KEEPVBMETAFLAG=$KEEPVBMETAFLAG" >> config
|
||||||
echo "RECOVERYMODE=$RECOVERYMODE" >> config
|
echo "RECOVERYMODE=$RECOVERYMODE" >> config
|
||||||
[ ! -z $SHA1 ] && echo "SHA1=$SHA1" >> config
|
[ ! -z $SHA1 ] && echo "SHA1=$SHA1" >> config
|
||||||
|
|
||||||
|
@ -382,6 +382,7 @@ get_flags() {
|
|||||||
getvar KEEPVERITY
|
getvar KEEPVERITY
|
||||||
getvar KEEPFORCEENCRYPT
|
getvar KEEPFORCEENCRYPT
|
||||||
getvar RECOVERYMODE
|
getvar RECOVERYMODE
|
||||||
|
getvar KEEPVBMETAFLAG
|
||||||
if [ -z $KEEPVERITY ]; then
|
if [ -z $KEEPVERITY ]; then
|
||||||
if $SYSTEM_ROOT; then
|
if $SYSTEM_ROOT; then
|
||||||
KEEPVERITY=true
|
KEEPVERITY=true
|
||||||
@ -402,6 +403,7 @@ get_flags() {
|
|||||||
KEEPFORCEENCRYPT=false
|
KEEPFORCEENCRYPT=false
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
[ -z $KEEPVBMETAFLAG ] && KEEPVBMETAFLAG=false
|
||||||
[ -z $RECOVERYMODE ] && RECOVERYMODE=false
|
[ -z $RECOVERYMODE ] && RECOVERYMODE=false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user