U-Boot Cheatsheet
Quick reference for common U-Boot CLI commands over serial console during Embedded Linux board bring-up and debugging.
Environment Variables
printenv # Print all environment variables
printenv bootcmd bootargs # Print specific variables
setenv bootdelay 3 # Set a temporary value
setenv bootargs "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait"
saveenv # Save environment to flash/eMMC
env default -a # Reset to built-in defaults
Storage (MMC / eMMC / SD)
mmc list # List MMC/SD devices
mmc dev 0 # Select MMC device 0
mmc info # Show card/eMMC info
mmc part # Show partition table
ls mmc 0:1 / # List files on partition 1 (FAT/ext4)
load mmc 0:1 ${kernel_addr_r} Image
load mmc 0:1 ${fdt_addr_r} board.dtb
Networking & TFTP Boot
setenv ipaddr 192.168.1.50
setenv serverip 192.168.1.10
ping ${serverip} # Verify reachability to TFTP server
tftpboot ${kernel_addr_r} Image
tftpboot ${fdt_addr_r} board.dtb
Booting the Linux Kernel
# ARM64 (Image)
booti ${kernel_addr_r} - ${fdt_addr_r}
# ARM32 (zImage)
bootz ${kernel_addr_r} - ${fdt_addr_r}
# FIT Image (.itb)
bootm ${loadaddr}
Inspecting Device Tree & Memory
fdt addr ${fdt_addr_r} # Point to DTB loaded in RAM
fdt print / # Print Device Tree structure
fdt get value val /model # Read a DTB property
md.w 0x40000000 16 # Display 16 words from memory
mw.l 0x40000000 0x12345678 # Write 32-bit value to memory
reset # Reboot the board