5.9.4.1. source - run script from memory
=> help source source - run script from memory Usage: source [addr] - run script starting at addr - A valid image header must be present =>
With the source
command you can run "shell" scripts under U-Boot: You create a U-Boot script image by simply writing the commands you want to run into a text file; then you will have to use the mkimage
tool to convert this text file into a U-Boot image (using the image type script
).
This image can be loaded like any other image file, and with source
you can run the commands in such an image. For instance, the following text file:
echo echo Network Configuration: echo ---------------------- echo Target: printenv ipaddr hostname echo echo Server: printenv serverip rootpath echo
can be converted into a U-Boot script image using the mkimage
command like this:
bash$ mkimage -A ppc -O linux -T script -C none -a 0 -e 0 \ > -n "autoscr example script" \ > -d ./testsystems/dulg/testcases/example.script /tftpboot/duts/canyonlands/example.scr Image Name: autoscr example script Created: Mon Feb 8 16:36:04 2010 Image Type: PowerPC Linux Script (uncompressed) Data Size: 157 Bytes = 0.15 kB = 0.00 MB Load Address: 0x00000000 Entry Point: 0x00000000 Contents: Image 0: 149 Bytes = 0 kB = 0 MB
Now you can load and execute this script image in U-Boot:
=> tftp 0x100000 /tftpboot/duts/canyonlands/example.scr Using ppc_4xx_eth0 device TFTP from server 192.168.1.1; our IP address is 192.168.100.6 Filename '/tftpboot/duts/canyonlands/example.scr'. Load address: 0x100000 Loading: # done Bytes transferred = 221 (dd hex) => imi ## Checking Image at 00100000 ... Legacy image found Image Name: autoscr example script Created: 2010-02-08 15:36:04 UTC Image Type: PowerPC Linux Script (uncompressed) Data Size: 157 Bytes = 0.2 kB Load Address: 00000000 Entry Point: 00000000 Contents: Image 0: 149 Bytes = 0.1 kB Verifying Checksum ... OK => source 0x100000 ## Executing script at 00100000 Network Configuration: ---------------------- Target: ipaddr=192.168.100.6 hostname=canyonlands Server: serverip=192.168.1.1 rootpath=/opt/eldk/ppc_4xxFP =>
摘自:http://www.denx.de/wiki/DULG/UBootCmdGroupExec