Use target hostnames and restore lk2nd bootloader reboot

This commit is contained in:
Luxferre committed 2026-11-09 23:44:44 +02:00
1 parent 1c011b360a
commit 3b96b8f242
22 files changed
+203 -70

No files matched your search

+16 -6
View File
@@ -56,6 +56,11 @@
#define PON_POWER_OFF_SHUTDOWN 0x04U
#define PON_POWER_OFF_HARD_RESET 0x07U
/* FASTBOOT_MODE is 0x02. Low bits survive the beatles stock boot chain;
* the high-bit lane keeps generic lk2nd images working on other targets. */
#define FASTBOOT_COOKIE_LOW 0x02U
#define FASTBOOT_COOKIE_DUAL 0x0aU
/* MSM8905/MSM8909 TCSR Boot Misc Detect register for EDL (05c6:9008) */
#define MSM8905_TCSR_BOOT_MISC_DETECT 0x0193d100U
#define MSM8905_DLOAD_EDL 0x00000001U
@@ -210,14 +215,19 @@ static unsigned int msm8905_pon_prepare_restart_mode(const char *cmd)
strcmp(trimmed, "fastboot") == 0) {
if (pon_regmap) {
/*
* The stock boot chain scrubs PON_SOFT_RB_SPARE[7:2] and passes
* bits [1:0] through to the chain-loaded lk2nd image. The beatles
* lk2nd port reads those low bits as the reboot reason, so 0x02
* selects FASTBOOT_MODE and shows the menu instead of booting Linux.
* The stock beatles boot chain scrubs PON_SOFT_RB_SPARE[7:2] and
* passes bits [1:0] through to the chain-loaded lk2nd image. Its
* patched lk2nd port reads the low lane. Generic lk2nd still reads
* the upstream high lane, so set both lanes on non-beatles targets.
*/
regmap_write(pon_regmap, QPNP_PON_SOFT_RB_SPARE, 0x02U);
unsigned int cookie = of_machine_is_compatible("nokia,beatles")
? FASTBOOT_COOKIE_LOW : FASTBOOT_COOKIE_DUAL;
regmap_write(pon_regmap, QPNP_PON_SOFT_RB_SPARE, cookie);
pr_info("leds-msm8905-torch: armed PM8909 PON_SOFT_RB_SPARE (0x%02x) for lk2nd Fastboot menu\n",
cookie);
} else {
pr_info("leds-msm8905-torch: PM8909 PON_SOFT_RB_SPARE unavailable for lk2nd Fastboot menu\n");
}
pr_info("leds-msm8905-torch: armed PM8909 PON_SOFT_RB_SPARE (0x02) for lk2nd Fastboot menu\n");
return PON_POWER_OFF_HARD_RESET;
}
+5 -5
View File
@@ -3034,8 +3034,8 @@ open_builtin_menu(const char *menu_name, int keep_idx)
add_menu_item(label, "@menu:confirm_logout", 1);
snprintf(label, sizeof(label), "%s Reboot", ICON_RLD);
add_menu_item(label, "@menu:confirm_reboot", 1);
snprintf(label, sizeof(label), "%s Reboot to loader", ICON_RLD);
add_menu_item(label, "@menu:confirm_loader", 1);
snprintf(label, sizeof(label), "%s Reboot to bootloader", ICON_RLD);
add_menu_item(label, "@menu:confirm_bootloader", 1);
snprintf(label, sizeof(label), "%s Poweroff", ICON_PWR);
add_menu_item(label, "@menu:confirm_poweroff", 1);
snprintf(label, sizeof(label), "%s System Menu", ICON_MNU);
@@ -3050,9 +3050,9 @@ open_builtin_menu(const char *menu_name, int keep_idx)
reset_session_defaults(1, "Confirm Reboot");
add_menu_item("Yes", "sxmo_power.sh reboot", 0);
add_menu_item("No", "@menu:power", 1);
} else if (strcmp(menu_name, "confirm_loader") == 0) {
reset_session_defaults(1, "Confirm Loader");
add_menu_item("Yes", "sxmo_power.sh loader", 0);
} else if (strcmp(menu_name, "confirm_bootloader") == 0) {
reset_session_defaults(1, "Confirm Bootloader");
add_menu_item("Yes", "sxmo_power.sh bootloader", 0);
add_menu_item("No", "@menu:power", 1);
} else if (strcmp(menu_name, "confirm_poweroff") == 0) {
reset_session_defaults(1, "Confirm Poweroff");