From afce23df9a2a4991a885d1494629724869355ca5 Mon Sep 17 00:00:00 2001 From: snlavaise Date: Wed, 16 Sep 2026 23:12:19 -0300 Subject: [PATCH] board: qualcomm: rtwo bootcmd to chainload pmOS FIT Custom bootcmd/bootargs for the Motorola Edge 40 Pro (rtwo, SM8550). The Motorola ABL loads this U-Boot as its "kernel" and always fills /chosen/linux,initrd-start with the RAM address of whatever it loaded as "ramdisk" (standard Android/GKI boot protocol). We package a FIT image (mainline pmOS kernel + dtb + initramfs) as that ramdisk, so bootcmd reads $prevbl_initrd_start_addr (populated by CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR from that same DT property) and does `bootm` on it, with a menu/bootefi fallback if the FIT boot fails. Part of the rtwo bring-up: see project notes rtwo-uboot-chainload for the full mechanism and why this replaced booting the mainline kernel directly from the Motorola ABL. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015ADQrjdgE8awSA7TSaGgfr --- board/qualcomm/qcom-phone.env | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/board/qualcomm/qcom-phone.env b/board/qualcomm/qcom-phone.env index d1c586bd..7e5d9ce9 100644 --- a/board/qualcomm/qcom-phone.env +++ b/board/qualcomm/qcom-phone.env @@ -21,7 +21,15 @@ serial_gadget=setenv stdin serial,button-kbd,usbacm; \ # bootretry will run this command over and over, if we fail once # then bail out to the boot menu instead (with a pause to read # the error message) -bootcmd=bootefi bootmgr; pause; run menucmd +# +# rtwo (Motorola Edge 40 Pro, SM8550): the ABL loads the FIT image +# (mainline Image + dtb + initramfs) into the ramdisk slot of the +# Android boot.img. The ABL writes that address into +# /chosen/linux,initrd-start of the fdt it hands us, and U-Boot saves +# it as $prevbl_initrd_start_addr (CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR). +# Try that first; only fall back to the phone menu if it fails. +pmos_bootargs=earlycon console=ttyMSM0,115200n8 panic=5 pmos.debug-shell clk_ignore_unused pd_ignore_unused regulator_ignore_unused allow_mismatched_32bit_el0 pmos_boot_uuid=d4373976-057c-4cf3-a43d-00734001b405 pmos_root_uuid=09804032-85bb-4d57-95a5-00d1965fb10f pmos_rootfsopts=defaults +bootcmd=setenv bootargs $pmos_bootargs; echo pmOS: booting FIT at prevbl_initrd_start_addr=$prevbl_initrd_start_addr; bootm $prevbl_initrd_start_addr; echo pmOS: bootm failed; bootefi bootmgr; pause; run menucmd # When entering the menu (either from button press or failed boot) # remap bootcmd so it will re-open the menu and we won't get stuck @@ -29,17 +37,19 @@ bootcmd=bootefi bootmgr; pause; run menucmd menucmd=setenv bootcmd run menucmd; bootmenu -1 # Pause is used so the output can be read on the display -bootmenu_0=Boot=bootefi bootmgr; pause -bootmenu_1=Enable serial console gadget=run serial_gadget -bootmenu_2=Enable USB mass storage=echo "Press any key to exit UMS mode"; ums 0 scsi 0 -bootmenu_3=Enable fastboot mode=run fastboot +bootmenu_0=Boot pmOS mainline (FIT)=setenv bootargs $pmos_bootargs; bootm $prevbl_initrd_start_addr; pause +bootmenu_1=Boot=bootefi bootmgr; pause +bootmenu_2=Enable serial console gadget=run serial_gadget +bootmenu_3=Enable USB mass storage=echo "Press any key to exit UMS mode"; ums 0 scsi 0 +bootmenu_4=Enable fastboot mode=echo "Press any key to exit fastboot mode"; run fastboot # Disabling bootretry means we'll just drop the shell -bootmenu_4=Drop to shell=setenv bootretry -1 -bootmenu_5=Reset device=reset -bootmenu_6=Dump clocks=clk dump; pause -bootmenu_7=Dump environment=printenv; pause -bootmenu_8=Board info=bdinfo; pause -bootmenu_9=Dump bootargs=fdt addr $fdt_addr_r; fdt print /chosen bootargs; pause +bootmenu_5=Drop to shell=setenv bootretry -1 +bootmenu_6=Reset device=reset +bootmenu_7=Dump clocks=clk dump; pause +bootmenu_8=Dump environment=printenv; pause +bootmenu_9=Board info=bdinfo; pause +bootmenu_10=Dump bootargs=fdt addr $fdt_addr_r; fdt print /chosen bootargs; pause +bootmenu_11=Power off=poweroff # Allow holding the volume down button while U-Boot loads to enter # the boot menu