U-boot commands: Difference between revisions

From embeddedTS Manuals
No edit summary
(Cleaned up grammar, added section, made writing more general)
Line 5: Line 5:
help i2c
help i2c


# This is a command added to u-boot by TS to read the baseboard id
# This is a command added to U-Boot by TS to read the baseboard ID on our
# Computer on Module devices
bbdetect
bbdetect
echo ${baseboard} ${baseboardid}  
echo ${baseboard} ${baseboardid}  
# The echos willreturn:
# The echo will return something similar to:
# TS-8390 2
# TS-8390 2


# Boots into the binary at $loadaddr.  This file needs to have
# Boots into the binary at $loadaddr.  The loaded file needs to have
# the uboot header from mkimage.  A uImage already contains this.
# the U-Boot header from mkimage.  A uImage already contains this.
bootm
bootm
# Boots into the binary at $loadaddr, skips the initrd, specifies
# Boots into the binary at $loadaddr, skips the initrd, specifies
# the fdtaddr so Linux knows where to find the board support
# the FDT addrress so Linux knows where to find the device tree
bootm ${loadaddr} - ${fdtaddr}
bootm ${loadaddr} - ${fdtaddr}
# Boot a Linux zImage loaded at $loadaddr
bootz
# Boot in to a Linux zImage at $loadaddr, skip initrd, specifies
# the FDT address to Linux knows where to find the device tree
bootz ${loadaddr} - ${fdtaddr}


# Get a DHCP address
# Get a DHCP address
Line 27: Line 34:
true # do nothing, successfully
true # do nothing, successfully


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


# GPIO can be manipulated from u-boot.  Keep in mind that the IOMUX  
# 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
# in U-Boot is only setup enough to boot the device, so not all pins will
# be set to GPIO mode out of the box.  Boot to the full operating system
# be set to GPIO mode out of the box.  Boot to the full operating system
# for more GPIO support.
# for more GPIO support.
# GPIO are specified in bank, IO in the imx6 manual.  U-boot uses a flat numberspace,
# GPIO are specified in bank and IO in this manual.  U-Boot uses a flat numberspace,
# so for CN2_83/EIM_OE this is bank 2 dio 25, or (32*2)+25=89
# so for bank 2 DIO 25, this would be number (32*2)+25=89
# Set CN1_83 low
# Note that on some products, bank 1 is the first bank
# Set 2_25 low
gpio clear 83
gpio clear 83
# Set CN1_83 high
# Set 2_25 high
gpio set 83
gpio set 83
# Read CN1_83
# Read 2_25
gpio input 83
gpio input 83


Line 63: Line 71:
load sata 0:1 ${loadaddr} /boot/uImage
load sata 0:1 ${loadaddr} /boot/uImage


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


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


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


# Access memory like devmem in Linux, you can read/write arbitrary memory
# Access memory like devmem in Linux, read/write arbitrary memory
# using mw and md
# using mw and md
# write
# write
Line 110: Line 118:
# SPI access is through the SF command
# SPI access is through the SF command
# Be careful with sf commands since
# Be careful with sf commands since
# this is where u-boot and the FPGA bitstream exist
# this is where U-Boot and the FPGA bitstream exist
# Improper use can render the board unbootable
# Improper use can render the board unbootable
sf probe
sf probe
Line 117: Line 125:
sleep 10
sleep 10


# You can load HUSH scripts that have been created with mkimage
# Load HUSH scripts that have been created with mkimage
load mmc 0:1 ${loadaddr} /boot/ubootscript
load mmc 0:1 ${loadaddr} /boot/ubootscript
source ${loadaddr}
source ${loadaddr}
Line 133: Line 141:
time sf probe
time sf probe


# Print U-boot version/build information
# Print U-Boot version/build information
version
version
</source>
</source>

Revision as of 13:49, 27 September 2018

# 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 on our 
# Computer on Module devices
bbdetect
echo ${baseboard} ${baseboardid} 
# The echo will return something similar to:
# TS-8390 2

# Boots into the binary at $loadaddr.  The loaded file needs to have
# the U-Boot header from mkimage.  A uImage already contains this.
bootm
# Boots into the binary at $loadaddr, skips the initrd, specifies
# the FDT addrress so Linux knows where to find the device tree
bootm ${loadaddr} - ${fdtaddr}

# Boot a Linux zImage loaded at $loadaddr
bootz
# Boot in to a Linux zImage at $loadaddr, skip initrd, specifies
# the FDT address to Linux knows where to find the device tree
bootz ${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 can set fuses in the processor
# Setting fuses can brick the unit, will void the 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 device, 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 and IO in this manual.  U-Boot uses a flat numberspace,
# so for bank 2 DIO 25, this would be number (32*2)+25=89
# Note that on some products, bank 1 is the first bank
# Set 2_25 low
gpio clear 83
# Set 2_25 high
gpio set 83
# Read 2_25
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

# View the FDT from U-Boot
load mmc 0:1 ${fdtaddr} /boot/imx6q-ts4900.dtb
fdt addr ${fdtaddr}
fdt print

# It is possible to blindly jump to any memory location
# This is similar to bootm, but it does not require
# the use of 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, 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

# 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