Commit f4ed6274 authored by topjohnwu's avatar topjohnwu

Invert vbmeta header patching config

vbmeta header should not be patched in most cases
parent 56eb1a1c
...@@ -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("KEEPVBMETAFLAG")) { if (check_env("PATCHVBMETAFLAG")) {
vbmeta->flags = __builtin_bswap32(3); vbmeta->flags = __builtin_bswap32(3);
} }
} }
......
...@@ -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>
......
...@@ -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 ] && KEEPVBMETAFLAG=false [ -z $PATCHVBMETAFLAG ] && PATCHVBMETAFLAG=false
[ -z $RECOVERYMODE ] && RECOVERYMODE=false [ -z $RECOVERYMODE ] && RECOVERYMODE=false
export KEEPVERITY export KEEPVERITY
export KEEPFORCEENCRYPT export KEEPFORCEENCRYPT
export KEEPVBMETAFLAG export PATCHVBMETAFLAG
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=$KEEPVBMETAFLAG" >> config echo "PATCHVBMETAFLAG=$PATCHVBMETAFLAG" >> config
echo "RECOVERYMODE=$RECOVERYMODE" >> config echo "RECOVERYMODE=$RECOVERYMODE" >> config
[ ! -z $SHA1 ] && echo "SHA1=$SHA1" >> config [ ! -z $SHA1 ] && echo "SHA1=$SHA1" >> config
......
...@@ -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 KEEPVBMETAFLAG getvar PATCHVBMETAFLAG
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 ] && KEEPVBMETAFLAG=false [ -z $PATCHVBMETAFLAG ] && PATCHVBMETAFLAG=false
[ -z $RECOVERYMODE ] && RECOVERYMODE=false [ -z $RECOVERYMODE ] && RECOVERYMODE=false
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment