[U-Boot] U-boot environment redundancy

2010-04-06 Thread Nitin Mahajan
Hello,

I have some query regarding how the u-boot environment redundancy works.

As per my understanding, we need to set the CONFIG_ENV_ADDR_REDUND
and  CONFIG_ENV_SIZE_REDUND macros in the board config file.

The boot loader is supposed to read the both the environments and based on the 
obsolete/active flag in the environment and CRC check, determine which 
environment to pick up.
And the logic for reading both environments, determining which one to use goes 
into the medium specific file, like env_nand.c or env_flash.c.

1. Whether this understanding of mine is correct?

2. Everytime when we do saveenv, how does boot loader determine which range to 
save the env? 

3. The env rotation is automatically by boot loader that is the obsolete/active 
flag change? The active/ obsolete flag is supposed to be part of the env itself?

4. If I need to implement all this for MMC, do I need to add more logic to the 
MMC patch 
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/71792/match=environment+mmc
submitted in recent past?

regards

-Nitin


  Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Saving environment variables in MMC

2010-04-02 Thread Nitin Mahajan

Hello,

--- On Thu, 1/4/10, Detlev Zundel d...@denx.de wrote:

 From: Detlev Zundel d...@denx.de
 Subject: Re: [U-Boot] Saving environment variables in MMC
 To: nitin...@yahoo.com
 Cc: U-Boot user list u-boot@lists.denx.de
 Date: Thursday, 1 April, 2010, 5:35 PM
 Hi Nitin,
 
  It is rather common to write to the U-Boot
 environment in projects
  for example to switch to a new set of kernel+file
 system after an
  update from within linux for the next boot.
  
  My use case is exactly same, to switch to a new set of
 kernel+fs after
  an update for the next boot.
 
  I also have another usecase of updating the env
 variable 'bootargs' if
  required in the field. So this use-case combined with
 fw_env, what is
  your feedback?
 
 It is doable of course.  Maybe if I did not mention it
 before, I advise
 using a redundant environment for such procedures so that
 even a
 powerloss during this upgrade will not brick the device.

Can I get some pointers to some example implementation of a redundant 
environment. I mean how does a switching between the environments happen?
Who clears or sets the obsolete flag for the redundant env?

-Nitin

 
  Could you give me some pointers on upgrading u-boot
 itself, but I
  don't have a spare partition for that. I would have to
 replace working
  copy itself?
 
 I would not recommend upgrading U-Boot in the field. 
 As it is not
 possible to build in redundancy for U-Boot (on most systems
 I know),
 there is always the possibility to kill the device with
 such an update.
 
  I would wanted to have more info(in addition to what I
 have
  implemented) regarding the failsafe upgrade mechanisms
 for
  embedded-linux apps and kernel? Could you please point
 me to right
  forums regarding this. I understand that this is not
 specific to
  u-boot, but just give me some pointers.
 
 I'm sorry that I cannot point you to a ready to use recipe
 here, as this
 really depends on your strategy regarding upgrades, i.e.
 will you do the
 upgrade from within Linux? (judging by your questions, you
 will...)  Do
 you have enough ressources to keep two self-contained
 program images
 (at least kernel+dtb+rootfs) so you can always update the
 other half?
 If not, you will probably want to build a non-upgradeable
 fallback
 system which is only capable to update the other part.
 
 As you see, solving your problem really requires you to
 define your
 problem more rigorously first.
 
 In order to protoect against interrupts during the update,
 you may very
 well want to have a watchdog on your system and use the
 bootcount
 (grep the documentation for it) feature of U-Boot to detect
 failing boot
 attempts.
 
 I hope this is enough to get you started.
 
 Cheers
   Detlev
 
 -- 
 Thanks so much for Emacs.  What a wondrous system --
 one of the real
 seven wonders of the world.  Forced to choose between
 Emacs and, say,
 any pyramid, I'd take Emacs.   
    -- Robert Boyer
 --
 DENX Software Engineering GmbH,      MD:
 Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich,  Office: Kirchenstr.5, D-82194
 Groebenzell, Germany
 Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email:
 d...@denx.de
 


  New Email names for you! 
Get the Email name you#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Saving environment variables in MMC

2010-04-01 Thread Nitin Mahajan

Hello, thanks for your valuable inputs.
--- On Thu, 1/4/10, Detlev Zundel d...@denx.de wrote:

 From: Detlev Zundel d...@denx.de
 Subject: Re: [U-Boot] Saving environment variables in MMC
 To: nitin...@yahoo.com
 Cc: U-Boot user list u-boot@lists.denx.de
 Date: Thursday, 1 April, 2010, 5:35 PM
 Hi Nitin,
 
  It is rather common to write to the U-Boot
 environment in projects
  for example to switch to a new set of kernel+file
 system after an
  update from within linux for the next boot.
  
  My use case is exactly same, to switch to a new set of
 kernel+fs after
  an update for the next boot.
 
  I also have another usecase of updating the env
 variable 'bootargs' if
  required in the field. So this use-case combined with
 fw_env, what is
  your feedback?
 
 It is doable of course.  Maybe if I did not mention it
 before, I advise
 using a redundant environment for such procedures so that
 even a
 powerloss during this upgrade will not brick the device.
 

I will grep the mailing list archives for more info on the redundant 
environment technique.

  Could you give me some pointers on upgrading u-boot
 itself, but I
  don't have a spare partition for that. I would have to
 replace working
  copy itself?
 
 I would not recommend upgrading U-Boot in the field. 
 As it is not
 possible to build in redundancy for U-Boot (on most systems
 I know),
 there is always the possibility to kill the device with
 such an update.
 
  I would wanted to have more info(in addition to what I
 have
  implemented) regarding the failsafe upgrade mechanisms
 for
  embedded-linux apps and kernel? Could you please point
 me to right
  forums regarding this. I understand that this is not
 specific to
  u-boot, but just give me some pointers.
 
 I'm sorry that I cannot point you to a ready to use recipe
 here, as this
 really depends on your strategy regarding upgrades, i.e.
 will you do the
 upgrade from within Linux? (judging by your questions, you
 will...)  Do
 you have enough ressources to keep two self-contained
 program images
 (at least kernel+dtb+rootfs) so you can always update the
 other half?
 If not, you will probably want to build a non-upgradeable
 fallback
 system which is only capable to update the other part.
 
 As you see, solving your problem really requires you to
 define your
 problem more rigorously first.
 
 In order to protoect against interrupts during the update,
 you may very
 well want to have a watchdog on your system and use the
 bootcount
 (grep the documentation for it) feature of U-Boot to detect
 failing boot
 attempts.

Ya I did that, implemented the store bootcount and load bootcount routines for 
OMAP 35x.

regards

-Nitin
 
 I hope this is enough to get you started.
 
 Cheers
   Detlev
 
 -- 
 Thanks so much for Emacs.  What a wondrous system --
 one of the real
 seven wonders of the world.  Forced to choose between
 Emacs and, say,
 any pyramid, I'd take Emacs.   
    -- Robert Boyer
 --
 DENX Software Engineering GmbH,      MD:
 Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich,  Office: Kirchenstr.5, D-82194
 Groebenzell, Germany
 Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email:
 d...@denx.de
 


  New Email addresses available on Yahoo!
Get the Email name you#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Saving environment variables in MMC

2010-03-31 Thread Nitin Mahajan

Hello,
--- On Wed, 31/3/10, Stefano Babic sba...@denx.de wrote:

 From: Stefano Babic sba...@denx.de
 Subject: Re: [U-Boot] Saving environment variables in MMC
 To: nitin...@yahoo.com
 Cc: Frans Meulenbroeks fransmeulenbro...@gmail.com, U-Boot user list 
 u-boot@lists.denx.de
 Date: Wednesday, 31 March, 2010, 4:17 PM
 Frans Meulenbroeks wrote:
  2010/3/30 Nitin Mahajan nitin...@yahoo.com:
 
 Hi,
 
  Found this in the past:
  http://bitshrine.org/gpp/u-boot-200910-cd77dd10-save-the-env-var-to-SDcard-and-SPI.patch
 
 You can take a look at this one, too:
 
 http://lists.denx.de/pipermail/u-boot/2009-November/063775.html
 

Thanks for the information. I just wanted to have a feedback, whether having a 
use-case of writing env variables from Linux User space is a good idea or is 
not recommended?

regards

-Nitin




  New Email addresses available on Yahoo!
Get the Email name you#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Saving environment variables in MMC

2010-03-31 Thread Nitin Mahajan
Thanks Detlev,

--- On Wed, 31/3/10, Detlev Zundel d...@denx.de wrote:

 From: Detlev Zundel d...@denx.de
 Subject: Re: [U-Boot] Saving environment variables in MMC
 To: nitin...@yahoo.com
 Cc: U-Boot user list u-boot@lists.denx.de
 Date: Wednesday, 31 March, 2010, 8:04 PM
 Hi Nitin,
 
  Thanks for the information. I just wanted to have a
 feedback, whether
  having a use-case of writing env variables from Linux
 User space is a
  good idea or is not recommended?
 
 You found tools/env/fw_env.c showing that this
 functionality is indeed
 foreseen and used.
 
 It is rather common to write to the U-Boot environment in
 projects for
 example to switch to a new set of kernel+file system after
 an update
 from within linux for the next boot.
 
My use case is exactly same, to switch to a new set of kernel+fs after an 
update for the next boot.

I also have another usecase of updating the env variable 'bootargs' if required 
in the field. So this use-case combined with fw_env, what is your feedback?

Could you give me some pointers on upgrading u-boot itself, but I don't have a 
spare partition for that. I would have to replace working copy itself?

I would wanted to have more info(in addition to what I have implemented) 
regarding the failsafe upgrade mechanisms for embedded-linux apps and kernel? 
Could you please point me to right forums regarding this. I understand that 
this is not specific to u-boot, but just give me some pointers.

regards
-Nitin


 


 Is this feedback enough?
 
 Cheers
   Detlev
 
 -- 
 The structure of a system reflects the structure of the
 organization
 that built it.
                
                
         -- Richard E. Fairley
 --
 DENX Software Engineering GmbH,      MD:
 Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich,  Office: Kirchenstr.5, D-82194
 Groebenzell, Germany
 Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email:
 d...@denx.de
 


  Get your new Email address!
Grab the Email name you#39;ve always wanted before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] U-boot env variables parsing

2010-03-31 Thread Nitin Mahajan
Hi!

I am doing env settings some thing like this,

ROOT1=/dev/mmcblk0p1
ROOT2=/dev/mmcblk0p2
ROOT=${ROOT1}
bootargs1=console=ttyS0,115200n8 mem=256M noinitrd rw rootdelay=1 ${ROOT}

when I say 'setenv bootargs ${bootargs1}', ${ROOT} gets resolved to 'ROOT1', it 
does not get completely resolved to '/dev/mmcblk0p1'. 

Is there something fundamentally wrong in setting the env variables this way?

What would be the right way to achieve this, as I want ROOT to be ${ROOT1} 
sometimes and ${ROOT2} some times?

regards

-Nitin




  Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Saving environment variables in MMC

2010-03-30 Thread Nitin Mahajan
Hello,

--- On Mon, 29/3/10, Mike Frysinger vap...@gentoo.org wrote:

 From: Mike Frysinger vap...@gentoo.org
 Subject: Re: [U-Boot] Saving environment variables in MMC
 To: u-boot@lists.denx.de, nitin...@yahoo.com
 Date: Monday, 29 March, 2010, 11:12 PM
 On Monday 29 March 2010 11:21:22
 Nitin Mahajan wrote:
  I want to save and retrieve environment variables from
 a file in MMC. Can I
  get some pointers towards this?
  
  Whether env_relocate_spec() and other such functions,
 has some
  implementation for MMC also?
 
 search the archives.  some people have posted some
 patches recently.
 -mike
 
I checked the mails and I would go through the patches. In addition to this, I 
need to modify the environment variables(stored in a file) from Linux userland.

Whether it is OK to follow such an approach?

For this whether tools\fw_env.c is the right option?

regards

-Nitin


  Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Saving environment variables in MMC

2010-03-29 Thread Nitin Mahajan
Hi!

I want to save and retrieve environment variables from a file in MMC. Can I get 
some pointers towards this?

Whether env_relocate_spec() and other such functions, has some implementation 
for MMC also? 

regards
-Nitin



  Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] bootcounter implementation for OMAP3

2010-03-09 Thread Nitin Mahajan
Hello,

--- On Tue, 9/3/10, Detlev Zundel d...@denx.de wrote:

 From: Detlev Zundel d...@denx.de
 Subject: Re: [U-Boot] bootcounter implementation for OMAP3
 To: nitin...@yahoo.com
 Cc: u-boot@lists.denx.de
 Date: Tuesday, 9 March, 2010, 2:03 PM
 Hi Nitin,
 
  I am trying to implement the bootcount_store and
 bootcount_load
  methods for the OMAP3503 processor based board which I
 am using.
 
  For this I decided to use the location at the end of
 scratchpad RAM,
  that is I am trying to write at location 0x480029BF.
 The code looks like 
  this, but the boot loader hags when it encounters
 bootcount_load.
 
 
  #ifdef CONFIG_BOOTCOUNT_LIMIT
  void bootcount_store(ulong a)
  {
      volatile ulong *save_addr = 
          (volatile ulong
 *)(0x480029BF);
      *save_addr = (BOOTCOUNT_MAGIC 
 0x) | (a  0x);
 
 You are writing a 32 bit entity to an non 32-bit aligned
 address.
 Although I do not know the omap too well, this can be a
 problem on any
 architecture.
 
 Can you write 32-bot to that exact address from within the
 U-Boot
 commandline with e.g. mm?

That was the basic mistake I think. I was trying to write to a non 32 bit 
aligned address. This got solved, but I have some new errors saying this

## Error: environment overflow, stdin deleted 
## Error: environment overflow, stdout deleted
## Error: environment overflow, stderr deleted
  
## Error: environment overflow, bootcount deleted 

Does that mean the size allocated for env is smaller compared to the actual 
contents in env file.
I am new to u-boot. Can you give some pointers on this?

regards

-Nitin

 
 Cheers
   Detlev
 
 -- 
 Q: What do you get when you cross an elephant and a
 banana?
 A: |elephant| * |banana| * sin(theta)
 --
 DENX Software Engineering GmbH,      MD:
 Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich,  Office: Kirchenstr.5, D-82194
 Groebenzell, Germany
 Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email:
 d...@denx.de
 


  New Email addresses available on Yahoo!
Get the Email name you#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] bootcounter implementation for OMAP3

2010-03-09 Thread Nitin Mahajan
Hello,

--- On Tue, 9/3/10, Detlev Zundel d...@denx.de wrote:

 From: Detlev Zundel d...@denx.de
 Subject: Re: [U-Boot] bootcounter implementation for OMAP3
 To: nitin...@yahoo.com
 Cc: u-boot@lists.denx.de
 Date: Tuesday, 9 March, 2010, 10:52 PM
 Hi Nitin,
 
  You are writing a 32 bit entity to an non 32-bit
 aligned address.
  Although I do not know the omap too well, this can
 be a problem on
  any architecture.
  
  Can you write 32-bot to that exact address from
 within the U-Boot
  commandline with e.g. mm?
 
  That was the basic mistake I think. I was trying to
 write to a non 32
  bit aligned address. This got solved, but I have some
 new errors
  saying this
 
 Ok, thanks for the confirmation.
 
  ## Error: environment overflow, stdin deleted 
                
            
    
  ## Error: environment overflow, stdout deleted 
                
               
  ## Error: environment overflow, stderr deleted
  ## Error: environment overflow, bootcount deleted 
 
 [...@pollux u-boot-testing (master)]$ git grep environment
 overflow
 common/cmd_nvedit.c:         
   printf (## Error: environment overflow, \%s\
 deleted\n, name);
 tools/env/fw_env.c:         
            Error:
 environment overflow, \%s\ deleted\n,
 
  Does that mean the size allocated for env is smaller
 compared to the
  actual contents in env file.  I am new to u-boot.
 Can you give some
  pointers on this?
 
I just increased the size in my board specific configuration file. Now this 
feature of bootlimit and altbootcmd works for me on OMAP3.

Thanks for your time. 

I was just wondering how to recover from errors such as bad CRC on uImage, 
where boot loader is not able to start booting the kernel for any reason.

In such case how to fallback to a different kernel.

-Nitin


 Only you can answer what you have defined for your
 configuration.
 
 Cheers
   Detlev
 
 -- 
 He who can properly define and divide is to be considered a
 god.
                
                
         -- Plato
 --
 DENX Software Engineering GmbH,      MD:
 Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich,  Office: Kirchenstr.5, D-82194
 Groebenzell, Germany
 Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email:
 d...@denx.de
 


  New Email names for you! 
Get the Email name you#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] bootcounter implementation for OMAP3

2010-03-08 Thread Nitin Mahajan
Hello, 

I am trying to implement the bootcount_store and bootcount_load
methods for the OMAP3503 processor based board which I am using.

For this I decided to use the location at the end of scratchpad RAM,
that is I am trying to write at location 0x480029BF. The code looks like 
this, but the boot loader hags when it encounters bootcount_load.


#ifdef CONFIG_BOOTCOUNT_LIMIT
void bootcount_store(ulong a)
{
volatile ulong *save_addr = 
(volatile ulong *)(0x480029BF);
*save_addr = (BOOTCOUNT_MAGIC  0x) | (a  0x);

}

ulong bootcount_load(void)
{

volatile ulong *save_addr = (volatile ulong *)(0x480029BF);

if ((*save_addr  0x) != (BOOTCOUNT_MAGIC  0x))
return 0;
else
return (*save_addr  0x);

}

#endif /* CONFIG_BOOTCOUNT_LIMIT */


Am I doing some thing wring fundamentally? Can I get some pointers towrads this?

Also this code I have put in cpu/arm_cortexa8/cpu.c. Is there a way I can put 
these functions in OMAP3 specific code and still have them called?

regards

-Nitin




  New Email names for you! 
Get the Email name you#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot