uboot - bunnyamin/bunnix GitHub Wiki

Terminology

  • bootz Load Linux zImage or InitRD according to format <initrd addres>:<initrd size>
  • booti ARM64 Image
  • bootm fitImage, uImage (legacy)

SYS_LOAD_ADDR = Default address to load the kernel or other "Image" (booti)

Build

  1. make mrproper
  2. Export necessary environment variables:
  • export ARCH=arm64
  • export DTC_FLAGS="-@"
  • export CFLAGS=""
  • export CPPFLAGS=""
  • export CROSS_COMPILE=aarch64-linux-gnu-
  • export PLAT=<board, paltform, system>
  • export BL31=<bl31.bin>
  1. make <configs/<system>_defconfig
  • make xconfig
  1. make

The dtb files are found in dts/*.

Partition the storage device

  1. Make sure the storage device is unmounted lslbk -f
  2. Ensure the beginning of the device is empty dd if=/dev/zero of=/dev/sd? bs=1M count=20
    • The "beginning" is the span in which any specific boot-loader method implements.
  3. Create partition: Specifics may depend on board manufacturer.
  4. Verify sectors created as intended:
    • sfdisk -uS -d /dev/sd?
  5. Create filesystem and mount it:
    • mkfs.ext4 -L <label>_<size>_<year> /dev/sd?2
    • mount /dev/sd?2 /mnt
Event Error Cause Consequence Remedy
Compile binman: Node '/binman/simple-bin/fit': subnode 'images/@atf-SEQ': Failed to read ELF file: Python: No module named 'elftools' Install python-pyelftools

Boot configuration

The standard format for boot configuration files is extlinux.conf, as handled by U-Boot's "syslinux" (disk) or "pxe boot" (network). The official U-Boot documentation " ...recommends that distros generate extlinux.conf rather than boot.scr. extlinux.conf is intended to work across multiple bootloaders, whereas boot.scr will only work with U-Boot. ..."

The Linux kernel CONFIG_BOOTMETH_EXTLINUX=y enables support for extlinux/extlinux.conf.

Debug

Shell

Devices

  • mmc list List available devices
  • mmc dev 1 Switch to device MMC
  • mmc part Print partitions on
  • ls mmc 1:4 / List MMC 1 partition 4 root directory.

Environment

In u-boot shell:

  • bdinfo
  • printenv

Documentation

=> help
?         - alias for 'help'
base      - print or set address offset
bdinfo    - print Board Info structure
blkcache  - block cache diagnostics and control
boot      - boot default, i.e., run 'bootcmd'
bootd     - boot default, i.e., run 'bootcmd'
bootefi   - Boots an EFI payload from memory
bootelf   - Boot from an ELF image in memory
bootflow  - Boot flows
booti     - boot Linux kernel 'Image' format from memory
bootm     - boot application image from memory
bootp     - boot image via network using BOOTP/TFTP protocol
bootvx    - Boot vxWorks from an ELF image
cmp       - memory compare
coninfo   - print console devices and information
cp        - memory copy
crc32     - checksum calculation
dhcp      - boot image via network using DHCP/TFTP protocol
dm        - Driver model low level access
echo      - echo args to console
editenv   - edit environment variable
eficonfig - provide menu-driven UEFI variable maintenance interface
env       - environment handling commands
exit      - exit script
ext2load  - load binary file from a Ext2 filesystem
ext2ls    - list files in a directory (default /)
ext4load  - load binary file from a Ext4 filesystem
ext4ls    - list files in a directory (default /)
ext4size  - determine a file's size
false     - do nothing, unsuccessfully
fatinfo   - print information about filesystem
fatload   - load binary file from a dos filesystem
fatls     - list files in a directory (default /)
fatmkdir  - create a directory
fatrm     - delete a file
fatsize   - determine a file's size
fatwrite  - write file into a dos filesystem
fdt       - flattened device tree utility commands
fstype    - Look up a filesystem type
fstypes   - List supported filesystem types
go        - start application at address 'addr'
gpio      - query and control gpio pins
gpt       - GUID Partition Table
gzwrite   - unzip and write memory to block device
help      - print command description/usage
i2c       - I2C sub-system
iminfo    - print header information for application image
imxtract  - extract a part of a multi-image
itest     - return true/false on integer compare
ln        - Create a symbolic link
load      - load binary file from a filesystem
loadb     - load binary file over serial line (kermit mode)
loads     - load S-Record file over serial line
loadx     - load binary file over serial line (xmodem mode)
loady     - load binary file over serial line (ymodem mode)
loop      - infinite loop on address range
ls        - list files in a directory (default /)
lzmadec   - lzma uncompress a memory region
md        - memory display
mdio      - MDIO utility commands
mii       - MII utility commands
mm        - memory modify (auto-incrementing address)
mmc       - MMC sub system
mmcinfo   - display MMC info
mw        - memory write (fill)
net       - NET sub-system
nm        - memory modify (constant address)
panic     - Panic with optional message
part      - disk partition related commands
ping      - send ICMP ECHO_REQUEST to network host
pinmux    - show pin-controller muxing
pmic      - PMIC sub-system
printenv  - print environment variables
pxe       - commands to get and boot from pxe files
To use IPv6 add -ipv6 parameter
random    - fill memory with random pattern
regulator - uclass operations
reset     - Perform RESET of the CPU
run       - run commands in an environment variable
save      - save file to a filesystem
setenv    - set environment variables
setexpr   - set environment variable as the result of eval expression
sf        - SPI flash sub-system
showvar   - print local hushshell variables
size      - determine a file's size
sleep     - delay execution for some time
source    - run script from memory
test      - minimal test like /bin/sh
tftpboot  - load file via network using TFTP protocol
true      - do nothing, successfully
unlz4     - lz4 uncompress a memory region
unzip     - unzip a memory region
usb       - USB sub-system
usbboot   - boot from USB device
version   - print monitor, compiler and linker version
⚠️ **GitHub.com Fallback** ⚠️