Skip to contentSkip to conversation

U boot Scripting features

U-Boot-Users harsh poshtiwala 1 participant 1 message Nov 1, 2007

lore
Share & tools
lore
#0 lore raw

Hi All,

I am using ARM926EJS based cutom board.
Linux 2.6.14
Uboot -1.1.4
Flash -Spansion 64MB NOR Flash (CFI complient)

I want ot run a SCRIPT or execute a C FUNCTION soon as u boot starts and checks kernel images header and checksum.

if kernel image is bad uboot will call my function or execute a script that will jump to a specific ( predefined Flash Memory ( which was already erased )location and write a byte with my set values.

I tried both the ways but i do have following difficulties on each approch.

1,SCRIPT
If i want to do some mathamatical operation in the script how do i achieve ?

For example i want to increment a varible everytime my script is run.

I couldn't do the "+' operation in the script.

I want to achieve something like following.
=================================================================
echo "this is my script"

if (primary_image)
{
mw.b 0x100000 0xFE bootcount
cp.b 0x10000 0x33f00000 bootcount

}

else
{
mw.b 0x100000 0xFD bootcount
cp.b 0x10000 0x33f00000 bootcount
}

bootcount ++;

=========================
Here Primary_image will be set by my cmd_bootm.c and i want to pass it to the script.

Is the above thing doable with uboot scripting ?

Is there any way to do Mathamatical / arithmatic and logical operations in U boot script?

2,My function Which supports uboot monitor command "mw" ( Memeory write)

after compiling i coudn't execute my function on the target it says bad image type.

ofcourse i loaded / burned this image at specific loacation i.e 0x30f00000 and i did

autoscr 0x30f00000

Bad image type

Here is the command i used to create image.I tried all the valid -T ( type option ) of the mkimage utility.

Could you please throw some pointers on any of this ?

./mkimage -A ARM -O linux -T firmware -C none -a 0x1000000 -e 0x100000 -n 'MyScript' -d MyScript.o MyScript.img

Image Name:   MyScript
Created:      Wed Oct 31 19:32:48 2007
Image Type:   ARM Linux Firmware (uncompressed)
Data Size:    7051 Bytes = 6.89 kB = 0.01 MB
Load Address: 0x01000000
Entry Point:  0x00100000

[root at volleyball u-boot-CFI]# cp MyScript.img /tftpboot/cmd.img

3,Is there any way to access the bootload count on ARM architecture ,i defined #define CONFIG_BOOTCOUNT_LIMIT in my board config file but the compilation failed at undefined reference to bootload() / or similar function call.

Signature · 2 lines
Thanks & Regards
Harsh