Skip to content

aboot: Don't do extlinux boot when selected recovery from menu#723

Merged
TravMurav merged 1 commit into
msm8916-mainline:mainfrom
dropout-zzz:fix-recovery-menu
Jun 25, 2026
Merged

aboot: Don't do extlinux boot when selected recovery from menu#723
TravMurav merged 1 commit into
msm8916-mainline:mainfrom
dropout-zzz:fix-recovery-menu

Conversation

@dropout-zzz

@dropout-zzz dropout-zzz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

When I have an ext2 partition with extlinux.conf flashed into the virtual boot partition (512k after lk2nd if I understand correctly), selecting "Recovery" in Fastboot menu still boots mainline for me, but it should boot device into recovery mode.

(my device is using msm8952 platform)

it was annoying and as a workaround I always had to temporarily erase my boot

it seems like extlinux boot handlings is done by a function called lk2nd_boot():

lk2nd/lk2nd/boot/boot.c

Lines 66 to 74 in 1250da0

/**
* lk2nd_boot() - Try to boot the OS.
*
* This method is supposed to be called from aboot.
* If appropriate OS is found, it will be booted, and this
* method will never return.
*/
void lk2nd_boot(void)
{

so if that function is called it would try to find a partition with extlinux.conf to boot unconditionally

I found lk2nd_boot() is already guarded in another usage in aboot.c (seems that code path is for normal boot, i.e. when not entering Fastboot menu):

lk2nd/app/aboot/aboot.c

Lines 5657 to 5658 in 1250da0

if (!boot_into_recovery)
lk2nd_boot();

My understanding is: currently when ABOOT starts up it detects if volume key is held and sets boot_into_recovery flag

lk2nd/app/aboot/aboot.c

Lines 5595 to 5596 in 1250da0

if (keys_get_state(KEY_VOLUMEUP))
boot_into_recovery = 1;

so lk2nd_boot() is bypassed if should boot into recovery mode

if I understand correctly when "Recovery" is selected from menu, it sets boot_into_recovery flag eventually calls cmd_continue():

static void opt_recovery(void)
{
extern unsigned boot_into_recovery;
boot_into_recovery = 1;
cmd_continue(NULL, NULL, 0);
}

cmd_continue() also lives in aboot.c but it seems to lack a check on boot_into_recovery:

lk2nd/app/aboot/aboot.c

Lines 4674 to 4677 in 1250da0

#if WITH_LK2ND_BOOT
lk2nd_boot();
#endif
boot_linux_from_mmc();

this commit adds that missing check

(I know I can also just use key combinations to force a recovery boot but still)

@dropout-zzz

dropout-zzz commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Steps I used to reproduce the issue on my device:

  1. Shut device off
  2. Hold Power key, when phone vibrated, release Power and immediately hold Vol- to enter LK2nd's Fastboot mode
  3. Ensure boot partition has ext2 filesystem with valid extlinux.conf, select "Recovery" using Volume keys in menu showing on device screen
  4. Press Power button to confirm the selection, device boots from extlinux configuration instead of into recovery mode

@TravMurav TravMurav merged commit 7c6191c into msm8916-mainline:main Jun 25, 2026
42 checks passed
@TravMurav

Copy link
Copy Markdown
Member

Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants