Skip to content

Commit

Permalink
NB1: Force set boot lun to xbl_a instead of xbl
Browse files Browse the repository at this point in the history
For some time now, TWRP has suffered from the slot switching
bug which affects only switching from slot B, to slot A. Logs show that
bootcontrol is unable to switch xbl partition. Because in recovery every _a partition
gets a symlink without the slot postfix, gpt utils selects /dev/block/bootdevice/by-name/xbl
instead of /dev/block/bootdevice/by-name/xbl_a when switching to slot A. So force the
gpt-utils library to select only _a/_b variants.

Build the library seperately and replace librecovery_updater_msm with our updated
gpt-utils in order for the bootctrl to notice our change. This should fix the slot
change problem. From limited testing slot switching now works 100% of the time
  • Loading branch information
raphaelthegreat committed Dec 22, 2020
1 parent a4dd72b commit 5952072
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions gpt-utils/gpt-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,7 @@ int gpt_utils_set_xbl_boot_partition(enum boot_chain chain)

if (chain == BACKUP_BOOT) {
boot_lun_id = BOOT_LUN_B_ID;
if (!stat(XBL_BACKUP, &st))
boot_dev = XBL_BACKUP;
else if (!stat(XBL_AB_SECONDARY, &st))
if (!stat(XBL_AB_SECONDARY, &st))
boot_dev = XBL_AB_SECONDARY;
else {
fprintf(stderr, "%s: Failed to locate secondary xbl\n",
Expand All @@ -678,9 +676,7 @@ int gpt_utils_set_xbl_boot_partition(enum boot_chain chain)
}
} else if (chain == NORMAL_BOOT) {
boot_lun_id = BOOT_LUN_A_ID;
if (!stat(XBL_PRIMARY, &st))
boot_dev = XBL_PRIMARY;
else if (!stat(XBL_AB_PRIMARY, &st))
if (!stat(XBL_AB_PRIMARY, &st))
boot_dev = XBL_AB_PRIMARY;
else {
fprintf(stderr, "%s: Failed to locate primary xbl\n",
Expand Down
Binary file modified recovery/root/vendor/lib64/hw/bootctrl.msm8998.so
100755 → 100644
Binary file not shown.
Binary file added recovery/root/vendor/lib64/libgptutils.so
Binary file not shown.

0 comments on commit 5952072

Please sign in to comment.