6/25/2019 Running a Script in U-boot | NXP Community
More documents in i.MX Processors
Log in to create and rate content, and to follow, bookmark, and share content with other members.
Running a Script in U-boot
Document created by Leonardo Sandoval Gonzalez on Oct 15, 2012 • Last modified by Jodi Paul on Apr 19,
2013
Version 4
Like • 2 Comment • 1
Pre-requisites:
An TFTP server
U-boot with TFTP capabilities
If you need to run a script (for example, running multiple setenv's commands) in U-boot for many boards, you can instead
create a U-boot script (called script image), place it into your tftp folder, then ask U-boot to fetch it and run it. For example,
you want to run the following setenv instructions
setenv loadaddr 0x10800000
setenv bootargs_base 'setenv bootargs console=ttymxc0,115200'
setenv bootargs_mmc 'setenv bootargs ${bootargs} root=/dev/mmcblk0p1 rootwait rw video=mxcfb0:dev=ldb,LDB-
XGA,if=RGB666'
setenv bootcmd_mmc 'run bootargs_base bootargs_mmc;mmc dev 3;mmc read ${loadaddr} 0x800 0x2000;bootm'
run bootcmd_mmc
save it into a file, I choose the name 'myscript'; under your <U-boot folder>/tools, execute
$ mkimage -T script -C none -n 'My Script' -d myscript myscript.img
and copy myscript.img file into your TFTP folder.
On the target, set the following two variables (serverip and bootcmd)
# Set the Server IP, where the TFTP server is running
setenv serverip <the server IP> # In case the server IP is static, you can place this line into the U-boot script
setenv scriptaddr 0x10700000
setenv scriptname myscript.img
https://community.nxp.com/docs/DOC-93628 1/4
6/25/2019 Running a Script in U-boot | NXP Community
# You can use either TFTP or DHCP
setenv tftpcmd tftp # or 'dhcp' in case you want to use dhcp U-boot command
# Not needed for dhcp
setenv ipaddr <the target IP> # needed in case the command tftp is used
setenv gatewayip <the Gateway IP> # needed in case the command tftp is used
setenv bootcmd '${tftpcmd} ${scriptaddr} ${scriptname}; source ${scriptaddr}'
saveenv
reset
That is all you need to do.
Enjoy U-booting!
ATTACHMENTS
OUTCOMES
Helpful(1)
Visibility: i.MX Processors • 23769 Views
Last Modified by Jodi Paul on Apr 19, 2013 9:51 AM
Ratings:
Average User Rating
(0 ratings)
https://community.nxp.com/docs/DOC-93628 2/4
6/25/2019 Running a Script in U-boot | NXP Community
1 Comment
Ganesh Biradar
Jul 21, 2015 3:59 AM
I have a custom made board of i.MX6, i have to add a script which test RAM working, for that i have to
copy my script in SD/MMC(8GB) card,this testing will be done in uboot, now i need some help on this i
have created script file using mkimage. for this where i can copy and how to run that script at what
address location. NOTE: i can't use tftp/dhcp because this board doesn't have tftp/dhcp support.
Actions Like • 0
Related Content
i.MX51 Flashing Linux Application Only with SD Card Reader
Boot I.MX6q SABRE over the Network using TFTP and NFS
LS1088ARDB/LS1088ARDB-PB - How to update composite firmware image in QSPI NOR flash
MCIMX28LCD on i.MX 6SoloX SABRE board
LS1046ARDB - How to update PBL/RCW binary in QSPI NOR flash
Recommended Content
MPC5748G_I2C module
u-boot hanging in T4160RDB-64B Machine
i.MX8 Boot process and creating a bootable image
Windows 10 - Couldn't reserve space for cygwin's heap, Win32 error 0
Boot process issue | i.MX6Q Sabreauto
Incoming Links
Re: Uboot script to run commands automatically .
Re: Question, i.MX6SoloX eFuse programming
Re: U-Boot environment variables from MfgTool
u-boot on the Vybrid tower board in a few commands
https://community.nxp.com/docs/DOC-93628 3/4
6/25/2019 Running a Script in U-boot | NXP Community
U-Boot
ABOUT NXP NXP RESOURCES
Investors Mobile Apps
Press, News, Blogs Contact Us
Careers
FOLLOW NXP
NEWS
Look at our latest Press Releases and Product News. Read more
Privacy | Terms of Use | Terms of Sale | Feedback
©2006-2019 NXP Semiconductors. All rights reserved.
Home | Top of page | Help
https://community.nxp.com/docs/DOC-93628 4/4