Skip to contentSkip to conversation

Failsafe bootloader

DISCUSSION Sam Ravnborg 3 participants 4 messages Jun 3, 2003

lore
Share & tools
lore
#0 lore raw

Hi all.

We are developing an application for an embedded target that will be located in some rural areas. We foresee a need to update the target with a new version of the application or a new kernel from time to time.

A few of the added requirements on top of that are:
1) The target shall boot up in the old kernel, if a bogus kernel is loaded
2) The target shall boot up in the old application, if a bogus application is loaded
3) On the management side an update shall be handled as a single file, the target may decide to 'unpack' it when received.

We have looked all over the net, but none of the bootloaders found so far could meet the above demands.
The boot loaders usually have an interactive mode used to select between different configurations - and there are no feedback from the application side if the reboot actually went well. The interactiviness does not fit well with an embedded target.

Do you know of a boot loader that partially or fully meets the above requirements?

Background information
Today we are using VxWorks - for which we have made our own boot loader. The boot laoder allows the boot loader itself, and the application part to be upgraded - and if a restart is failed the old version will be activated on a subsequent build.
I want the same behaviour in the Linux based target.

Thanks in advance,

Sam

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#1 lore raw

A bit off topic, but I'll jump in. (The comments are based on experience designing items for myself, and also information from looking at commercial product designs. i.e. hacking things like my TiVo.)

Quoted 6 lines · Sam Ravnborg

Hi all.

We are developing an application for an embedded target that will be located in some rural areas. We foresee a need to update the target with a new version of the application or a new kernel from time to time.

First thing, make sure you have some mechanism for checksuming and possibly signing updates. The first assumption is the update made it over properly if that stuff passes.. (and your company did QA it..) ;)

Quoted 2 lines

A few of the added requirements on top of that are:
1) The target shall boot up in the old kernel, if a bogus kernel is loaded

This will require a watchdog timer, and modification to a bootloader to do counting and other items to instruct it to go to the backup kernel.

Quoted 2 lines

2) The target shall boot up in the old application, if a bogus application is loaded

A simple application daemon (init?) can do similar.

Quoted 3 lines

3) On the management side an update shall be handled as a single file, the target may decide to 'unpack' it when received.

cpio, tar, even RPM have been used for this. These are standard field-upgrade techniques.. the key is that every product is unique.

What _I_ personally would do is have two sets of "partitions" (memory, disk doesn't matter) one set for two kernels, current and "updates" and one set for userspace current and "updates". Then you have magic values that tell the bootloader what matches with what. On an initial update, you make this magic value "temporary" until the boot (application run) has succeeded and then you make it perminant.

But all in all this will require you to make changes to an existing bootloader or write your own.

--Mark

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 3 lines · In message <[email protected]> you wrote:

But all in all this will require you to make changes to an existing bootloader or write your own.

This is not correct. U-Boot can perform all these things without modification. It can be easily adjusted even to more complicated requirements - if necessary, write a shell script :-)

Best regards,

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] Perl already has an IDE. It's called Unix.
-- Tom Christiansen in [email protected]

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#3 lore raw
In reply to Sam Ravnborg
Quoted 3 lines · In message <[email protected]> you wrote:

A few of the added requirements on top of that are:
1) The target shall boot up in the old kernel, if a bogus kernel is loaded

Define "bogus kernel"! Depending if you mean one which was corrupted during download/installation you can use a checkum; if you mean one which fails to start the application you can use a watchdog.

Both is trivial and supporeted by several bootloaders.

Quoted 2 lines

2) The target shall boot up in the old application, if a bogus application is loaded

Same as above. Here it comes handy if you don't have to bundle the application with the kernel into one image.

Quoted 2 lines

3) On the management side an update shall be handled as a single file, the target may decide to 'unpack' it when received.

OK, not too difficult.

Quoted 2 lines

We have looked all over the net, but none of the bootloaders found so far could meet the above demands.

Ummm... how comes you missed to look into U-Boot? It easily performs all your reqirements. Without modifying a single line of code.

Quoted 4 lines

The boot loaders usually have an interactive mode used to select between different configurations - and there are no feedback from the application side if the reboot actually went well. The interactiviness does not fit well with an embedded target.

U-Boot allows for canned command sequences and even shell scripts.

Quoted 2 lines

Do you know of a boot loader that partially or fully meets the above requirements?

U-Boot meets your rrequirements fully (and some more :-)

Quoted 5 lines

Today we are using VxWorks - for which we have made our own boot loader. The boot laoder allows the boot loader itself, and the application part to be upgraded - and if a restart is failed the old version will be activated on a subsequent build.
I want the same behaviour in the Linux based target.

==> http://sourceforge.net/projects/u-boot

See also: http://www.denx.de/re/DPLG.html

If you have questions, send an email to the u-boot-users mailing list (or to me).

Best regards,

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] Bus error -- please leave by the rear door.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/