[U-Boot] start a second kernel/filesystem if first one is corrupted

Wolfgang Denk wd at denx.de
Thu Jan 14 10:39:09 CET 2010


Dear Arno Steffen,

In message <804f0d21001140104o3543921cx2b4422fbc8a9e6b at mail.gmail.com> you wrote:
>
> Ok, it normaly executes commands after each other. But in case the rootfs is
> invalid in boots kernel and ends up with kernel panic which causes a reboot.
> In this way the second command will not be executed
> bootcmd=run boot_fs1; run boot_fs2

Right, this method can only detect when the boot command fails, for
example because of corrupted images. It cannot handle situations where
the kernel crashes, or where the application does not start up
successfully.  To handle such situations you have to use the bootcount
feature, usually combined with a hardware watchdog which will reset
your board in cases where it just hangs.

> Bootcount is a great idea, but don't know right now how to do this. Also it

Hire an expert, then.

> will stress the flash, as it has to change the environment every time it
> boots.

No, this is wrong. Nothing neds to get written to flash when booting.
The boot counter is NOT stored in the environment, but in some
hardware register or other storage that is known not to change it's
value during a reset.

> Although I add hush to my config file
> #define CONFIG_HUSH_PARSER    1 /* use "hush" command parser */
> 
> and it compiles hush.c to hush.o I get
> 
> Unknown command 'if'

Can you please provide the full log, including all your input and all
output?  Please include the same (full input and output) for running
this command:

=> echo foo || echo bar

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
After Goliath's defeat, giants ceased to command respect.
- Freeman Dyson


More information about the U-Boot mailing list