Question

I'm working with u-boot on ARM using QEMU. I'm using the 'versatilepb' machine since both Linux and u-boot work well with it. I would like to write a script to handle some of the boot procedures (set kernel args, calculate CRC's, etc...) - but I can't seem to find how to run my script. I've got the script in memory and I can identify it with u-boot:

VersatilePB # iminfo 0x285EC

## Checking Image at 000285ec ...
   Legacy image found
   Image Name:   Test Linux Boot
   Image Type:   ARM Linux Script (uncompressed)
   Data Size:    300 Bytes = 300 Bytes
   Load Address: 00000000
   Entry Point:  00000000
   Contents:
      Image 0: 292 Bytes = 292 Bytes
   Verifying Checksum ... OK

However, I can't figure out how to run it:

VersatilePB # run 0x285EC
Unknown command 'run' - try 'help'
VersatilePB # autoscr 0x285EC
Unknown command 'autoscr' - try 'help'
VersatilePB # go 0x285EC
## Starting application at 0x000285EC ...
qemu: fatal: Trying to execute code outside RAM or ROM at 0x56190526

I understand that the last command failed since I have a script image (built using mkimage -A arm -T script -C none -n "Test Linux Boot" -d myscript.sh ./boot-commands.img) and not an actual standalone application.

My test script is extremely simple and is just meant to boot a Linux kernel:

#Global Variables
FLASH_ADDR=0x34000000
BOOT_ARGS="console=ttyAMA0"

#Now we'll try booting it from the beginning of flash
setenv bootcmd bootm $FLASH_ADDR
setenv bootargs $BOOT_ARGS

Typing bootm 0x34000000 at the u-boot command line successfully boots the Linux kernel

Am I missing something on how to run a u-boot script?

Was it helpful?

Solution

This is a community wiki answer.

You should add the version of u-boot that you are using. For the "run" command, verify that CONFIG_CMD_RUN is defined in your configuration. by sessyargc.jp

The command autoscr is enabled by defining CONFIG_CMD_SOURCE in your configuration as per U-boot command documetnation. by Joe Kul

The scripts do not run as plain ascii and must be pre-processed by mkimage as per the documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top