U-boot commands: Difference between revisions

From embeddedTS Manuals
(Created page with "These commands are agnostic to the operating system you are running, but may be useful for testing or scripting: <source lang=bash> # The most important command is help # Th...")
 
No edit summary
Line 1: Line 1:
These commands are agnostic to the operating system you are running, but may be useful for testing or scripting:
<source lang=bash>
<source lang=bash>
# The most important command is  
# The most important command is  
Line 25: Line 23:
# and ${ip_dyn} which can be used to check if the dhcp was successful
# and ${ip_dyn} which can be used to check if the dhcp was successful


# These commands are mainly used for scripting:
# These commands are used for scripting:
false # do nothing, unsuccessfully
false # do nothing, unsuccessfully
true # do nothing, successfully
true # do nothing, successfully
Line 79: Line 77:
ls mmc 0:1 /
ls mmc 0:1 /


# Similar to devmem in Linux, you can read/write arbitrary memory
# Access memory like devmem in Linux, you can read/write arbitrary memory
# using mw and md
# using mw and md
# write
# write
Line 86: Line 84:
md 0x10000000 1
md 0x10000000 1


# Test memory. Typically just used in production
# Test memory.
mtest
mtest


# Read newly inserted SD card
# Check for new SD card
mmc rescan
mmc rescan
# Read SD card size
# Read SD card size
Line 98: Line 96:
mmcinfo
mmcinfo


# The NFS command is similar to 'load', but used over the network
# The NFS command is like 'load', but used over the network
dhcp
dhcp
env set serverip 192.168.0.11
env set serverip 192.168.0.11
Line 124: Line 122:


# Most commands have return values that can be used to test
# Most commands have return values that can be used to test
# success, and HUSH scripting supports comparisons similar to
# success, and HUSH scripting supports comparisons like
# test in Bash, but much more minimal
# test in Bash, but much more minimal
if load mmc 1:1 ${fdtaddr} /boot/uImage;
if load mmc 1:1 ${fdtaddr} /boot/uImage;
Line 132: Line 130:
fi
fi


# Commands can be timed with "time" similar to Linux
# Commands can be timed with "time"
time sf probe
time sf probe



Revision as of 13:18, 10 February 2017

# The most important command is 
help
# This can also be used to see more information on a specific command
help i2c

# This is a command added to u-boot by TS to read the baseboard id
bbdetect
echo ${baseboard} ${baseboardid} 
# The echos willreturn:
# TS-8390 2

# Boots into the binary at $loadaddr.  This file needs to have
# the uboot header from mkimage.  A uImage already contains this.
bootm
# Boots into the binary at $loadaddr, skips the initrd, specifies
# the fdtaddr so Linux knows where to find the board support
bootm ${loadaddr} - ${fdtaddr}

# Get a DHCP address
dhcp
# This sets ${ipaddr}, ${dnsip}, ${gatewayip}, ${netmask}
# and ${ip_dyn} which can be used to check if the dhcp was successful

# These commands are used for scripting:
false # do nothing, unsuccessfully
true # do nothing, successfully

# This command lets you set fuses in the processor
# Setting fuses can brick your board, will void your warranty,
# and should not be done in most cases
fuse

# GPIO can be manipulated from u-boot.  Keep in mind that the IOMUX 
# in u-boot is only setup enough to boot the board, so not all pins will
# be set to GPIO mode out of the box.  Boot to the full operating system
# for more GPIO support.
# GPIO are specified in bank, IO in the imx6 manual.  U-boot uses a flat numberspace,
# so for CN2_83/EIM_OE this is bank 2 dio 25, or (32*2)+25=89
# Set CN1_83 low
gpio clear 83
# Set CN1_83 high
gpio set 83
# Read CN1_83
gpio input 83

# Control LEDs
led red on
led green on
led all off
led red toggle

# This command is used to copy a file from most devices
# Load kernel from SD
load mmc 0:1 ${loadaddr} /boot/uImage
# Load Kernel from eMMC
load mmc 1:1 ${loadaddr} /boot/uImage
# Load kernel from USB
usb start
load usb 0:1 ${loadaddr} /boot/uImage
# Load kernel from SATA
sata init
load sata 0:1 ${loadaddr} /boot/uImage

# You can view the fdt from u-boot with fdt
load mmc 0:1 ${fdtaddr} /boot/imx6q-ts4900.dtb
fdt addr ${fdtaddr}
fdt print

# You can blindly jump into any memory
# This is similar to bootm, but it does not use the 
# u-boot header
load mmc 0:1 ${loadaddr} /boot/custombinary
go ${loadaddr}

# Browse fat,ext2,ext3,or ext4 filesystems:
ls mmc 0:1 /

# Access memory like devmem in Linux, you can read/write arbitrary memory
# using mw and md
# write
mw 0x10000000 0xc0ffee00 1
# read
md 0x10000000 1

# Test memory.
mtest

# Check for new SD card
mmc rescan
# Read SD card size
mmc dev 0
mmcinfo
# Read eMMC Size
mmc dev 1
mmcinfo

# The NFS command is like 'load', but used over the network
dhcp
env set serverip 192.168.0.11
nfs ${loadaddr} 192.168.0.11:/path/to/somefile

# Test ICMP
dhcp
ping 192.168.0.11

# Reboot
reset

# SPI access is through the SF command
# Be careful with sf commands since
# this is where u-boot and the FPGA bitstream exist
# Improper use can render the board unbootable
sf probe

# Delay in seconds
sleep 10

# You can load HUSH scripts that have been created with mkimage
load mmc 0:1 ${loadaddr} /boot/ubootscript
source ${loadaddr}

# Most commands have return values that can be used to test
# success, and HUSH scripting supports comparisons like
# test in Bash, but much more minimal
if load mmc 1:1 ${fdtaddr} /boot/uImage;
	then echo Loaded Kernel
else
	echo Could not find kernel
fi

# Commands can be timed with "time"
time sf probe

# Print U-boot version/build information
version