* [U-Boot] How to use multiple env variables.
@ 2010-01-28 7:00 Shashi Kumar M.S
2010-01-28 9:43 ` Ladislav Michl
2010-01-28 9:44 ` Wolfgang Denk
0 siblings, 2 replies; 5+ messages in thread
From: Shashi Kumar M.S @ 2010-01-28 7:00 UTC (permalink / raw)
To: u-boot
Hi,
Is there any option for multiple env variables so that when i upgrade the kernel and rootfile system if not working properly so that i can fall back to the previous kernel and ramdisk considering i have a sufficiently big nand with required number of partition.
thanks and regard
Shashi
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] How to use multiple env variables.
2010-01-28 7:00 [U-Boot] How to use multiple env variables Shashi Kumar M.S
@ 2010-01-28 9:43 ` Ladislav Michl
2010-01-28 15:49 ` Shashi Kumar M.S
2010-01-28 9:44 ` Wolfgang Denk
1 sibling, 1 reply; 5+ messages in thread
From: Ladislav Michl @ 2010-01-28 9:43 UTC (permalink / raw)
To: u-boot
On Thu, Jan 28, 2010 at 12:30:54PM +0530, Shashi Kumar M.S wrote:
> Is there any option for multiple env variables so that when i upgrade the
> kernel and rootfile system if not working properly so that i can fall back to
> the previous kernel and ramdisk considering i have a sufficiently big nand
> with required number of partition.
Something like this works for me:
Two env variables controls from where to boot: 'ospart' indicating partition
number and 'swapos' saying that there is new firmware pending.
Consider NAND partitions kernel0, rootfs0, kernel1 and rootfs1. System is
running from kernel1 and rootfs1 (ospart=1). Now write new system to kernel0
and rootfs0 and set variable 'swapos', then reboot system. U-Boot then
executes
if test -n $swapos; then
setenv swapos; saveenv;
if test $ospart -eq 0; then
setenv ospart 1;
else
setenv ospart 0;
fi;
fi
and constructs kernel cmdline "root=mtd:rootfs$ospart"
and then loads kernel with "nboot kernel$ospart"
Inside some OS boot script it is then discovered that system is running
from diferent partition than saved in environment (we cleared 'swapos'
env variable, but new 'ospart' was to saved to permanent storage) and
after finding itself in sane state (based on self check or user's
interaction) it sets 'ospart' in environment accordingly. Otherwise
reboot is performed (based on watchdog, user's interaction...) and
original OS version is loaded (as 'ospart' remains intact).
Best regards,
ladis
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] How to use multiple env variables.
2010-01-28 7:00 [U-Boot] How to use multiple env variables Shashi Kumar M.S
2010-01-28 9:43 ` Ladislav Michl
@ 2010-01-28 9:44 ` Wolfgang Denk
1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2010-01-28 9:44 UTC (permalink / raw)
To: u-boot
Dear "Shashi Kumar M.S",
In message <00f001ca9fe8$011da6f0$a5206c6b@semco> you wrote:
>
> Is there any option for multiple env variables so that when i upgrade the kernel and rootfile system if not working properly so that i can fall back to the previous kernel and ramdisk considering i have a sufficiently big nand with required number of pa
> rtition.
Yes, this can be trivially done. See the manual (DULG) for examples.
BTW: please make sure to use a line length of not more than 70
characters or so. Your lines are way too long!
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Marriage is the sole cause of divorce.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] How to use multiple env variables.
2010-01-28 9:43 ` Ladislav Michl
@ 2010-01-28 15:49 ` Shashi Kumar M.S
2010-01-28 17:11 ` Ladislav Michl
0 siblings, 1 reply; 5+ messages in thread
From: Shashi Kumar M.S @ 2010-01-28 15:49 UTC (permalink / raw)
To: u-boot
Hi,
Thanks for the reply at the earliest.
One doubt.
Where should this variable swapos should be.
1. should this "swapos" be in one of the separate partition of the nand
flash
so that can be set by the kernel.
2. or is it a u-boot environment variable set by the kernel (reading the
u-boot env
from the kernel and updating the "swapos" env) after the copy of new
kernel and ramdisk done.
Thanks and Regards
Shashi.
----- Original Message -----
From: "Ladislav Michl" <Ladislav.Michl@seznam.cz>
To: "Shashi Kumar M.S" <shashi.ms@samsung.com>
Cc: <u-boot@lists.denx.de>
Sent: Thursday, January 28, 2010 3:13 PM
Subject: Re: [U-Boot] How to use multiple env variables.
> On Thu, Jan 28, 2010 at 12:30:54PM +0530, Shashi Kumar M.S wrote:
>> Is there any option for multiple env variables so that when i upgrade the
>> kernel and rootfile system if not working properly so that i can fall
>> back to
>> the previous kernel and ramdisk considering i have a sufficiently big
>> nand
>> with required number of partition.
>
> Something like this works for me:
> Two env variables controls from where to boot: 'ospart' indicating
> partition
> number and 'swapos' saying that there is new firmware pending.
> Consider NAND partitions kernel0, rootfs0, kernel1 and rootfs1. System is
> running from kernel1 and rootfs1 (ospart=1). Now write new system to
> kernel0
> and rootfs0 and set variable 'swapos', then reboot system. U-Boot then
> executes
> if test -n $swapos; then
> setenv swapos; saveenv;
> if test $ospart -eq 0; then
> setenv ospart 1;
> else
> setenv ospart 0;
> fi;
> fi
> and constructs kernel cmdline "root=mtd:rootfs$ospart"
> and then loads kernel with "nboot kernel$ospart"
>
> Inside some OS boot script it is then discovered that system is running
> from diferent partition than saved in environment (we cleared 'swapos'
> env variable, but new 'ospart' was to saved to permanent storage) and
> after finding itself in sane state (based on self check or user's
> interaction) it sets 'ospart' in environment accordingly. Otherwise
> reboot is performed (based on watchdog, user's interaction...) and
> original OS version is loaded (as 'ospart' remains intact).
>
> Best regards,
> ladis
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] How to use multiple env variables.
2010-01-28 15:49 ` Shashi Kumar M.S
@ 2010-01-28 17:11 ` Ladislav Michl
0 siblings, 0 replies; 5+ messages in thread
From: Ladislav Michl @ 2010-01-28 17:11 UTC (permalink / raw)
To: u-boot
On Thu, Jan 28, 2010 at 09:19:37PM +0530, Shashi Kumar M.S wrote:
> Where should this variable swapos should be.
Both 'ospart' and 'swapos' are ordinary u-boot environment variables.
> 1. should this "swapos" be in one of the separate partition of the nand
> flash so that can be set by the kernel.
Kernel itself doesn't keep any concept of envinronment variables, however
MTD drivers live in kernel space and are used by fw_setenv (see
u-boot/tools/env/README) program to alter envinroment variables stored
in flash.
> 2. or is it a u-boot environment variable set by the kernel (reading the
> u-boot env from the kernel and updating the "swapos" env) after the
> copy of new kernel and ramdisk done.
Sorry, I cannot parse that.
Basic idea is just to write new kernel and rootfs and execute
$ fw_setenv swapos yes
then reboot board and U-Boot scripts I described earlier do the rest.
Best regards,
ladis
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-28 17:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28 7:00 [U-Boot] How to use multiple env variables Shashi Kumar M.S
2010-01-28 9:43 ` Ladislav Michl
2010-01-28 15:49 ` Shashi Kumar M.S
2010-01-28 17:11 ` Ladislav Michl
2010-01-28 9:44 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox