uboot的source命令

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

转载于:https://www.cnblogs.com/ziqiuqiandao/p/3208645.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值