mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Fallback environment in barebox
@ 2011-02-27  6:19 Boaz Ben-David
  2011-02-27  9:50 ` Juergen Beisert
  0 siblings, 1 reply; 11+ messages in thread
From: Boaz Ben-David @ 2011-02-27  6:19 UTC (permalink / raw)
  To: barebox; +Cc: Itai Raab

Hi,

We want to implement a mechanism in barebox to use two environment
partitions.
i.e. when barebox boots it will go to the first by default and try to
use it. If for some reason it fails
it will boot with the second one.

What is the best way to implement this in barebox and did anyone do it
already?

Thanks,

Boaz.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-02-27  6:19 Fallback environment in barebox Boaz Ben-David
@ 2011-02-27  9:50 ` Juergen Beisert
  2011-02-27 10:09   ` Boaz Ben-David
  0 siblings, 1 reply; 11+ messages in thread
From: Juergen Beisert @ 2011-02-27  9:50 UTC (permalink / raw)
  To: barebox; +Cc: Itai Raab

Boaz Ben-David wrote:
> We want to implement a mechanism in barebox to use two environment
> partitions.
> i.e. when barebox boots it will go to the first by default and try to
> use it. If for some reason it fails
> it will boot with the second one.
>
> What is the best way to implement this in barebox and did anyone do it
> already?

AFAIR a mechanism like this is already present in barebox. It tries the first 
environment, checks its CRC and if it fails it tries the next, if one exists.
Just register env0, env1, .....

Regards,
Juergen

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-02-27  9:50 ` Juergen Beisert
@ 2011-02-27 10:09   ` Boaz Ben-David
  2011-02-28  5:50     ` Baruch Siach
  0 siblings, 1 reply; 11+ messages in thread
From: Boaz Ben-David @ 2011-02-27 10:09 UTC (permalink / raw)
  To: jbe; +Cc: barebox, Itai Raab

Sounds great.

Is there any documentation on how to "register" environments?

Thanks,

Boaz.

On Sun, 2011-02-27 at 10:50 +0100, Juergen Beisert wrote:
> Boaz Ben-David wrote:
> > We want to implement a mechanism in barebox to use two environment
> > partitions.
> > i.e. when barebox boots it will go to the first by default and try to
> > use it. If for some reason it fails
> > it will boot with the second one.
> >
> > What is the best way to implement this in barebox and did anyone do it
> > already?
> 
> AFAIR a mechanism like this is already present in barebox. It tries the first 
> environment, checks its CRC and if it fails it tries the next, if one exists.
> Just register env0, env1, .....
> 
> Regards,
> Juergen
> 
> -- 
> Pengutronix e.K.                              | Juergen Beisert             |
> Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
> Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-02-27 10:09   ` Boaz Ben-David
@ 2011-02-28  5:50     ` Baruch Siach
  2011-02-28  8:08       ` Boaz Ben-David
  2011-03-06 14:59       ` Itai Raab
  0 siblings, 2 replies; 11+ messages in thread
From: Baruch Siach @ 2011-02-28  5:50 UTC (permalink / raw)
  To: Boaz Ben-David; +Cc: barebox, Itai Raab

Hi Boaz,

On Sun, Feb 27, 2011 at 12:09:59PM +0200, Boaz Ben-David wrote:
> Sounds great.
> 
> Is there any documentation on how to "register" environments?

What Juergen meant to say is "register partitions named env0, env1, ...". The 
barebox startup code then automatically picks the first valid environment 
partition.

To register partitions (with bad blocks awareness) use devfs_add_partition() 
and then dev_add_bb_dev(). grep for "env0" under arch/ for many examples.

baruch

> On Sun, 2011-02-27 at 10:50 +0100, Juergen Beisert wrote:
> > Boaz Ben-David wrote:
> > > We want to implement a mechanism in barebox to use two environment
> > > partitions.
> > > i.e. when barebox boots it will go to the first by default and try to
> > > use it. If for some reason it fails
> > > it will boot with the second one.
> > >
> > > What is the best way to implement this in barebox and did anyone do it
> > > already?
> > 
> > AFAIR a mechanism like this is already present in barebox. It tries the first 
> > environment, checks its CRC and if it fails it tries the next, if one exists.
> > Just register env0, env1, .....

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-02-28  5:50     ` Baruch Siach
@ 2011-02-28  8:08       ` Boaz Ben-David
  2011-03-06 14:59       ` Itai Raab
  1 sibling, 0 replies; 11+ messages in thread
From: Boaz Ben-David @ 2011-02-28  8:08 UTC (permalink / raw)
  To: baruch; +Cc: Udi Ron, Itai Raab, barebox

Great, thanks!

Boaz.

On Mon, 2011-02-28 at 07:50 +0200, Baruch Siach wrote:
> Hi Boaz,
> 
> On Sun, Feb 27, 2011 at 12:09:59PM +0200, Boaz Ben-David wrote:
> > Sounds great.
> > 
> > Is there any documentation on how to "register" environments?
> 
> What Juergen meant to say is "register partitions named env0, env1, ...". The 
> barebox startup code then automatically picks the first valid environment 
> partition.
> 
> To register partitions (with bad blocks awareness) use devfs_add_partition() 
> and then dev_add_bb_dev(). grep for "env0" under arch/ for many examples.
> 
> baruch
> 
> > On Sun, 2011-02-27 at 10:50 +0100, Juergen Beisert wrote:
> > > Boaz Ben-David wrote:
> > > > We want to implement a mechanism in barebox to use two environment
> > > > partitions.
> > > > i.e. when barebox boots it will go to the first by default and try to
> > > > use it. If for some reason it fails
> > > > it will boot with the second one.
> > > >
> > > > What is the best way to implement this in barebox and did anyone do it
> > > > already?
> > > 
> > > AFAIR a mechanism like this is already present in barebox. It tries the first 
> > > environment, checks its CRC and if it fails it tries the next, if one exists.
> > > Just register env0, env1, .....
> 
> -- 
>                                                      ~. .~   Tk Open Systems
> =}------------------------------------------------ooO--U--Ooo------------{=
>    - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Fallback environment in barebox
  2011-02-28  5:50     ` Baruch Siach
  2011-02-28  8:08       ` Boaz Ben-David
@ 2011-03-06 14:59       ` Itai Raab
  2011-03-06 18:26         ` Baruch Siach
  1 sibling, 1 reply; 11+ messages in thread
From: Itai Raab @ 2011-03-06 14:59 UTC (permalink / raw)
  To: Baruch Siach, Boaz Ben-David; +Cc: barebox, Udi Ron

Hi Baruch,
I tried doing what you explained, but it seems like Barebox startup code didn't load the environment from env1 when env0 was corrupted.

In barebox shell I could find /dev/env1 with all the data, but when the Barebox started I got:
	no valid environment found on /dev/env0. Using default environment

Looking at the startup code (common/startup.c - is this the place?) I don't see any mechanism to load env1 when env0 fails.

Is it the right place to add the support or am I missing something?

Thanks,
Itai	



-----Original Message-----
From: Baruch Siach [mailto:baruch@tkos.co.il] 
Sent: Monday, February 28, 2011 7:51 AM
To: Boaz Ben-David
Cc: jbe@pengutronix.de; barebox@lists.infradead.org; Itai Raab
Subject: Re: Fallback environment in barebox

Hi Boaz,

On Sun, Feb 27, 2011 at 12:09:59PM +0200, Boaz Ben-David wrote:
> Sounds great.
> 
> Is there any documentation on how to "register" environments?

What Juergen meant to say is "register partitions named env0, env1, ...". The 
barebox startup code then automatically picks the first valid environment 
partition.

To register partitions (with bad blocks awareness) use devfs_add_partition() 
and then dev_add_bb_dev(). grep for "env0" under arch/ for many examples.

baruch

> On Sun, 2011-02-27 at 10:50 +0100, Juergen Beisert wrote:
> > Boaz Ben-David wrote:
> > > We want to implement a mechanism in barebox to use two environment
> > > partitions.
> > > i.e. when barebox boots it will go to the first by default and try to
> > > use it. If for some reason it fails
> > > it will boot with the second one.
> > >
> > > What is the best way to implement this in barebox and did anyone do it
> > > already?
> > 
> > AFAIR a mechanism like this is already present in barebox. It tries the first 
> > environment, checks its CRC and if it fails it tries the next, if one exists.
> > Just register env0, env1, .....

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-03-06 14:59       ` Itai Raab
@ 2011-03-06 18:26         ` Baruch Siach
  2011-03-08 15:37           ` Juergen Beisert
  0 siblings, 1 reply; 11+ messages in thread
From: Baruch Siach @ 2011-03-06 18:26 UTC (permalink / raw)
  To: Itai Raab; +Cc: barebox, Udi Ron

Hi Itai,

On Sun, Mar 06, 2011 at 04:59:02PM +0200, Itai Raab wrote:
> I tried doing what you explained, but it seems like Barebox startup code 
> didn't load the environment from env1 when env0 was corrupted.
>
> In barebox shell I could find /dev/env1 with all the data, but when the 
> Barebox started I got:
> 	no valid environment found on /dev/env0. Using default environment
> 
> Looking at the startup code (common/startup.c - is this the place?) I don't 
> see any mechanism to load env1 when env0 fails.

You seem to be right. Juergen, can you explain what you meant?

> Is it the right place to add the support or am I missing something?

An alternative solution might be to use the defaultenv mechanism, and put 
there a fall-back init script which contains the following (untested):

loadenv /dev/env1

Since the defaultenv init runs only when environment load from /dev/env0 fails 
(i.e. the env0 partition is corrupted), this is actually equivalent.

baruch

> -----Original Message-----
> From: Baruch Siach [mailto:baruch@tkos.co.il] 
> Sent: Monday, February 28, 2011 7:51 AM
> To: Boaz Ben-David
> Cc: jbe@pengutronix.de; barebox@lists.infradead.org; Itai Raab
> Subject: Re: Fallback environment in barebox
> 
> Hi Boaz,
> 
> On Sun, Feb 27, 2011 at 12:09:59PM +0200, Boaz Ben-David wrote:
> > Sounds great.
> > 
> > Is there any documentation on how to "register" environments?
> 
> What Juergen meant to say is "register partitions named env0, env1, ...". The 
> barebox startup code then automatically picks the first valid environment 
> partition.
> 
> To register partitions (with bad blocks awareness) use devfs_add_partition() 
> and then dev_add_bb_dev(). grep for "env0" under arch/ for many examples.
> 
> baruch
> 
> > On Sun, 2011-02-27 at 10:50 +0100, Juergen Beisert wrote:
> > > Boaz Ben-David wrote:
> > > > We want to implement a mechanism in barebox to use two environment
> > > > partitions.
> > > > i.e. when barebox boots it will go to the first by default and try to
> > > > use it. If for some reason it fails
> > > > it will boot with the second one.
> > > >
> > > > What is the best way to implement this in barebox and did anyone do it
> > > > already?
> > > 
> > > AFAIR a mechanism like this is already present in barebox. It tries the first 
> > > environment, checks its CRC and if it fails it tries the next, if one exists.
> > > Just register env0, env1, .....

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-03-06 18:26         ` Baruch Siach
@ 2011-03-08 15:37           ` Juergen Beisert
  2011-03-09 11:00             ` Juergen Beisert
  0 siblings, 1 reply; 11+ messages in thread
From: Juergen Beisert @ 2011-03-08 15:37 UTC (permalink / raw)
  To: barebox; +Cc: Udi Ron, Itai Raab

Baruch Siach wrote:
> On Sun, Mar 06, 2011 at 04:59:02PM +0200, Itai Raab wrote:
> > I tried doing what you explained, but it seems like Barebox startup code
> > didn't load the environment from env1 when env0 was corrupted.
> >
> > In barebox shell I could find /dev/env1 with all the data, but when the
> > Barebox started I got:
> > 	no valid environment found on /dev/env0. Using default environment
> >
> > Looking at the startup code (common/startup.c - is this the place?) I
> > don't see any mechanism to load env1 when env0 fails.
>
> You seem to be right. Juergen, can you explain what you meant?

It seems the patches to add this feature are forgotten in one of our BSPs. :-(

I will search for them and resend them to this list. Please be patient.

Regards,
Juergen

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-03-08 15:37           ` Juergen Beisert
@ 2011-03-09 11:00             ` Juergen Beisert
  2011-03-27  8:58               ` Boaz Ben-David
  0 siblings, 1 reply; 11+ messages in thread
From: Juergen Beisert @ 2011-03-09 11:00 UTC (permalink / raw)
  To: barebox; +Cc: Udi Ron, Itai Raab

Juergen Beisert wrote:
> I will search for them and resend them to this list. Please be patient.

Found them. But they need some re-work, as they are from March 2010...

Regards,
Juergen

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-03-09 11:00             ` Juergen Beisert
@ 2011-03-27  8:58               ` Boaz Ben-David
  2011-04-08  7:03                 ` Sascha Hauer
  0 siblings, 1 reply; 11+ messages in thread
From: Boaz Ben-David @ 2011-03-27  8:58 UTC (permalink / raw)
  To: jbe; +Cc: Udi Ron, barebox

Hi,

A general question regarding environment but not limited to.
If we have an environment partition on a NAND device which has 4 blocks
of 512K, and a block becomes bad when writing to it, does barebox handle
it and writes to the next block?

Thanks,

Boaz

On Wed, 2011-03-09 at 12:00 +0100, Juergen Beisert wrote:
> Juergen Beisert wrote:
> > I will search for them and resend them to this list. Please be patient.
> 
> Found them. But they need some re-work, as they are from March 2010...
> 
> Regards,
> Juergen
> 
> -- 
> Pengutronix e.K.                              | Juergen Beisert             |
> Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
> Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fallback environment in barebox
  2011-03-27  8:58               ` Boaz Ben-David
@ 2011-04-08  7:03                 ` Sascha Hauer
  0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2011-04-08  7:03 UTC (permalink / raw)
  To: Boaz Ben-David; +Cc: Udi Ron, barebox

On Sun, Mar 27, 2011 at 10:58:05AM +0200, Boaz Ben-David wrote:
> Hi,
> 
> A general question regarding environment but not limited to.
> If we have an environment partition on a NAND device which has 4 blocks
> of 512K, and a block becomes bad when writing to it, does barebox handle
> it and writes to the next block?

No barebox currently does not do this. You would have to do this
manually on the command line (which of course is not very convenient in
production).

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-04-08  7:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-27  6:19 Fallback environment in barebox Boaz Ben-David
2011-02-27  9:50 ` Juergen Beisert
2011-02-27 10:09   ` Boaz Ben-David
2011-02-28  5:50     ` Baruch Siach
2011-02-28  8:08       ` Boaz Ben-David
2011-03-06 14:59       ` Itai Raab
2011-03-06 18:26         ` Baruch Siach
2011-03-08 15:37           ` Juergen Beisert
2011-03-09 11:00             ` Juergen Beisert
2011-03-27  8:58               ` Boaz Ben-David
2011-04-08  7:03                 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox