summaryrefslogtreecommitdiff
path: root/cleopatre/u-boot-1.1.6/common
diff options
context:
space:
mode:
authorCyril Jourdan2013-02-20 14:29:34 +0100
committerCyril Jourdan2013-02-21 08:55:47 +0100
commita0c4278c9c64a4c162c1d460fb73fe9be9497d1c (patch)
treec8326d4683956d2a2deabc9b9f7eae21b6a7e40d /cleopatre/u-boot-1.1.6/common
parentf37eeb21dbde84560ce256553d3ed2a59a657e05 (diff)
cleo/uboot/cmd_spidboot: update origin index on autoswitch boot, closes #3783
Diffstat (limited to 'cleopatre/u-boot-1.1.6/common')
-rw-r--r--cleopatre/u-boot-1.1.6/common/cmd_spidboot.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c b/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
index 763104a1df..ca3a61a49b 100644
--- a/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
+++ b/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
@@ -563,6 +563,22 @@ static int select_image(int img_nb)
(char *)img_addr[autoswitch_data->slot]);
if (state == IMAGE_OK || state == IMAGE_OK_ORIGIN)
{
+ if (state == IMAGE_OK_ORIGIN)
+ {
+ /* Update origin index. If we are here, we can be sure
+ * that alternate image exists and is OK. That is why
+ * we allow ourselves to use its index without checks. */
+ int new_index, alt_img_slot;
+ if (autoswitch_data->slot == 0)
+ alt_img_slot = 1;
+ else
+ alt_img_slot = 0;
+ load_header (&img_desc[alt_img_slot], (char *)img_addr[alt_img_slot]);
+ new_index = img_desc[alt_img_slot].img_common.index + 1;
+ update_origin_index (&img_desc[autoswitch_data->slot],
+ (char*) img_addr[autoswitch_data->slot],
+ new_index);
+ }
autoswitch_en = 1;
return autoswitch_data->slot;
}