[U-Boot-Users] Scripting Doubt

Hi,
I have an elementary doubt regarding u-boot scripts. I will explain this by taking an example. Let the script be setenv my_script setenv a 5 ; setenv b 5 ; On the u-boot prompt, I can run this script as "run my_script". Is it possible to save this script in some way in the uboot image itself, so that when I download uboot, I have this variable set in the environment. Basically I am looking for some kind of compile time support, the way it happens for bootcmd. I went through the documentation, but it only talked about running scripts by downloading a text-file after u-boot is up. I am looking for some kind of compile time support.
Thanks, Ajay

Ajay,
On Wed, 2006-08-23 at 21:36 +0530, Ajay Jain wrote:
Hi,
I have an elementary doubt regarding u-boot scripts. I will explain this by taking an example. Let the script be setenv my_script setenv a 5 ; setenv b 5 ; On the u-boot prompt, I can run this script as "run my_script". Is it possible to save this script in some way in the uboot image itself, so that when I download uboot, I have this variable set in the environment. Basically I am looking for some kind of compile time support, the way it happens for bootcmd. I went through the documentation, but it only talked about running scripts by downloading a text-file after u-boot is up. I am looking for some kind of compile time support.
The command 'setenv' means 'set the value of an environment variable'. Your script can be an environment variable as long as you excape it properly. Typing 'saveenv' afterwards will save this to wherever you store your environment variables (either in separate flash sectors, the U-boot sector or EEPROM). It will then be available persistently. You can of course hard-code default environment variables. Look through the code - you'll see lots of examples.
regards, Ben

In message b92b327b0608230906w2943e462w8c23a82fb8763e51@mail.gmail.com you wrote:
I have an elementary doubt regarding u-boot scripts. I will explain this by taking an example. Let the script be setenv my_script setenv a 5 ; setenv b 5 ;
This is not a script. It is just a command you enter to the command interpreter.
On the u-boot prompt, I can run this script as "run my_script". Is it
You don't run a script. You execute the content of an environment variable.
Please don't say I'm nitpicking here. It is extremely important to understand the differences, so please use exact terms!
possible to save this script in some way in the uboot image itself, so that when I download uboot, I have this variable set in the environment. Basically I am looking for some kind of compile time support, the way it happens for bootcmd. I went through the documentation, but it only talked about running scripts by downloading a text-file after u-boot is up. I am looking for some kind of compile time support.
This is because your confusion of terms. You are dealing with (default) environment variables. You have to look up environment variable definitions in the documentation, especially in the README. See for example CONFIG_EXTRA_ENV_SETTINGS
Best regards,
Wolfgang Denk
participants (3)
-
Ajay Jain
-
Ben Warren
-
Wolfgang Denk