• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1] 2 3
Author Topic: Where does u-boot store the env variables such as bootargs?  (Read 10656 times)
CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« on: August 07, 2009, 10:29:50 PM »

Where does u-boot store the env variables such as bootargs?

I do not know if this question makes any sense...  Is it not possible to change he value of the bootargs from a utility (while running *nix), by mounting  the proper flash area in rw mode, and changing the value, so one does not have to bring up u-boot for at least some of the function changes such changing the boot drive from nand to SDCard or another device?  Is this possible to do?  What is that I may be missing here?
Logged

Cordially, CqCn

debio
Newbie
*

Karma: 0
Posts: 43


View Profile
« Reply #1 on: August 07, 2009, 10:51:35 PM »

It's theoretically possible to edit them directly; they're stored in the NAND flash. I don't think there's actually a way though.
If there's something drastically wrong with yours, why can't you just press a key when U-Boot says and stop the boot process or use the recovery app to reload U-Boot?
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #2 on: August 07, 2009, 11:14:57 PM »

debio, Thanks.  Currently I have no real problem.  I was just thinking that providing such a script would be an easier way than bring up uboot thru the serial port connected to another computer etc, if one is interested in experimenting with booting from different devices.  Once one knows exactly where this is stored, and the exact format, it should not be difficult to write a script or a compiled utility.   I think the previous system I have been using, the slubOS/BE (and my plans are to port all my system to ShPg), has such a utility, turnup, I think.  You simply type something like turnup /dev/sda2 or turnup /dev/sdb3 and then reboot! Which will reboot from one of those new places.  Of course some checks have to be done in the utility to make sure the new target is valid.  Even in case one makes an error, one can always bring up uboot thru the serial terminal and correct the error in an ineractive way.  Does this make sense ?

Hopefully somebody here will show us where these variables are stored and how
Logged

Cordially, CqCn

rooster
Guest
« Reply #3 on: August 08, 2009, 12:17:16 PM »

Hi,

Look in the sheeva installer, there is a binary called fw_setenv, it accepts the uboot environment parameters one at a time.
You can use it to create uboot environment structure that can later be burned into NAND flash @ 0xa0000 (size is 0x40000)

You can also use the installer to do it for you with openOCD SW.
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #4 on: August 08, 2009, 12:55:35 PM »

Hi,

Look in the sheeva installer, there is a binary called fw_setenv, it accepts the uboot environment parameters one at a time.
You can use it to create uboot environment structure that can later be burned into NAND flash @ 0xa0000 (size is 0x40000)

You can also use the installer to do it for you with openOCD SW.
rooster, I was thinking about this new BootNextFromDev utility to be added to Debian or other os; not as modified part of the boot nor flashed into nand.  The flash can be remounted rw at normal os runtime, and then the exact devicename used in the bootargs set of env can be changed --- that is a quick and dirty hack without changing anything in the uboot.  Of course as part of uboot in the future, a more robust interface can be provided to this new utiltiy.  I do not speak *nix well, so I have not looked at the uboot code yet.
« Last Edit: August 08, 2009, 12:59:13 PM by CqCn » Logged

Cordially, CqCn

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #5 on: August 10, 2009, 03:30:07 PM »

Hi,

Look in the sheeva installer, there is a binary called fw_setenv, it accepts the uboot environment parameters one at a time.
You can use it to create uboot environment structure that can later be burned into NAND flash @ 0xa0000 (size is 0x40000)

You can also use the installer to do it for you with openOCD SW.
rooster, Could you please show me a sample command line to mount the u-boot area or the environment area to say /mnt/ub_experiemnt ?

I see the following in dmesg:
Quote
Using static partition definition
Creating 3 MTD partitions on "nand_mtd":
0x00000000-0x00100000 : "u-boot"
0x00100000-0x00300000 : "uImage"
0x00300000-0x20000000 : "root"
Can this u_boot area be viewed from the command line, once *nix is up?  Alternatly can it be remounted?  I am running the distribution from the box.
Logged

Cordially, CqCn

dattaway
Jr. Member
**

Karma: 5
Posts: 91



View Profile WWW
« Reply #6 on: August 16, 2009, 02:48:14 PM »

I have been looking for this too.  A way to configure Sheeva's uboot from its own bash shell to be exact. 

Unfortunately, the fw_printenv and fw_setenv utilities in the installer appear to be compiled for the x86 side of things.
Logged

Ann Onemouse
Newbie
*

Karma: 0
Posts: 12


View Profile
« Reply #7 on: August 16, 2009, 08:46:12 PM »

A way to configure Sheeva's uboot from its own bash shell to be exact. 

Unfortunately, the fw_printenv and fw_setenv utilities in the installer appear to be compiled for the x86 side of things.

This page:
http://elinux.org/U-boot_environment_variables_in_linux
suggests that cross-compiling the fw_printenv and fw_setenv utilities in a properly-set up cross-compilation environment will work.
But no binaries to prove it are provided.    Huh

Perhaps someone out there who has a "real" cross-compilation environment wants to try this and post results?

- Ann

Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #8 on: August 16, 2009, 09:14:57 PM »

Yes, binary of a utility would be great!

bootnext sdcard | sda1 | sda2 | sdb1 | ...  is the way I think of the command line parameters.

But what I do not understand is: if this can be compiled into a utility, why can it not be made into a script?  Just as boot/kernel version changes, if a new version of utility is needed, the script can be made similarly version dependent.
Logged

Cordially, CqCn

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #9 on: August 17, 2009, 07:34:46 AM »

Ann,

Could you please provide a link to the source code?
Logged

Cordially, CqCn

Ann Onemouse
Newbie
*

Karma: 0
Posts: 12


View Profile
« Reply #10 on: August 17, 2009, 07:52:10 AM »

Ann,
Could you please provide a link to the source code?

Here's the source code...
git://git.denx.de/u-boot.git

form http://git.denx.de/?p=u-boot.git;a=summary
-Ann
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #11 on: August 17, 2009, 09:07:17 AM »

Thank you.  Using your url, I looked at this tree:
http://git.denx.de/?p=u-boot.git;a=tree
While I have not exhausted every file there, I could not find anything starting with fw_ at all.  I lack familiarity with this whole area.  Have you seen the actual source code file there?
« Last Edit: August 18, 2009, 07:41:13 AM by CqCn » Logged

Cordially, CqCn

Ann Onemouse
Newbie
*

Karma: 0
Posts: 12


View Profile
« Reply #12 on: August 17, 2009, 10:38:47 AM »

While I have not exhausted every file there, I could not anything starting with fw_ at all.  My lack of familiarity with this whole environment.  Have you seen the actual source code file there?

Not yet. Since I cannot (yet) figure out how to get a proper development environment working for this device on an x86 host, I intend to set up a development environment by booting the device over NFS. Then i will try installing gcc, libc, and git from the operating system utilities. Finally, I will try to find the source for the uBoot utilities and compile them using the device itself.

Will report back on results.

-Ann
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #13 on: August 18, 2009, 07:39:49 AM »

Ann, Curious about the boot over nfs part.  Why not install all the development tools with apt-get?  ShPlug is definitely fast enough for development.  I might want to get into trying some of this too; I have used gcc for some big projects before, but *nix is not second nature to me.  I would be interested in a full tools howto -- where to get the complete environment, ...

But I keep thinking it should be possible to write this env utility in a script language, either bash or something like php...  That is my current interest.
« Last Edit: August 18, 2009, 08:25:02 AM by CqCn » Logged

Cordially, CqCn

rooster
Guest
« Reply #14 on: August 18, 2009, 11:05:24 AM »

fw_setenv fw_getenv in Ubuntu is in uboot-envtools package, simply aptitude install it.

You will need to manage to get a mapping to the uboot environment settings (probably add to uboot environments to mtdparts) and then edit the /etc/fw_env.config according to flash sector size and address.

The for fw_env.config format is as follows:

# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundand
# environment sector is assumed present.
# MTD device name       Device offset   Env. size       Flash sector size
/dev/mtd1                   0x00080000      0x1000          0x10000

I will try to get the correct settings tomorrow
Logged

Pages: [1] 2 3
Print
Jump to: