Files
uboot-rtwo/board/qualcomm/qcom-phone.env
T
snlavaiseandClaude Sonnet 5 afce23df9a 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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ADQrjdgE8awSA7TSaGgfr
2026-09-16 23:16:16 -03:00

58 lines
2.7 KiB
Bash

bootdelay=0
bootretry=1
stdin=serial,button-kbd
stdout=serial,vidconsole
stderr=serial,vidconsole
# Fastboot is keen to use the address from kconfig, but we
# allocate its buffer at runtime.
fastboot=fastboot -l $fastboot_addr_r usb 0
# Always probe for UFS storage, though it should be done by board code.
preboot=scsi scan
# Shortcut to enable USB serial gadget and disable bootretry
serial_gadget=setenv stdin serial,button-kbd,usbacm; \
setenv stdout serial,vidconsole,usbacm; \
setenv stderr serial,vidconsole,usbacm; \
setenv bootretry -1; \
echo Enabled U-Boot console serial gadget
# 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)
#
# 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
# at the console with no way to type
menucmd=setenv bootcmd run menucmd; bootmenu -1
# Pause is used so the output can be read on the display
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_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
button_cmd_0_name=Volume Down
button_cmd_0=run menucmd