From 1e7eb50f83d9a8594cecfdc77352a1288ba7f6a3 Mon Sep 17 00:00:00 2001 From: save Date: Thu, 10 Jun 2010 08:13:04 +0000 Subject: cleo/u-boot: print version string of each image on each boot, closes #1599 git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7185 017c9cb6-072f-447c-8318-d5b54f68fe89 --- cleopatre/u-boot-1.1.6/board/sdk300/flash.c | 2 +- cleopatre/u-boot-1.1.6/common/cmd_spidboot.c | 38 +++++++++++++++++++--------- cleopatre/u-boot-1.1.6/net/spidupd.c | 1 - 3 files changed, 27 insertions(+), 14 deletions(-) (limited to 'cleopatre') diff --git a/cleopatre/u-boot-1.1.6/board/sdk300/flash.c b/cleopatre/u-boot-1.1.6/board/sdk300/flash.c index 584a89fe18..1358ec29b4 100644 --- a/cleopatre/u-boot-1.1.6/board/sdk300/flash.c +++ b/cleopatre/u-boot-1.1.6/board/sdk300/flash.c @@ -338,7 +338,7 @@ ulong flash_init (void) flash_nb_blocks = sizeof (OrgSPIFlash) / sizeof (OrgDef); flash_info[i].sector_count = flash_number_sector_spi(pOrgDef, flash_nb_blocks); - flash_read_id_spi (&flash_info[i].flash_id); + flash_read_id_spi ((unsigned int *)&flash_info[i].flash_id); memset (flash_info[i].protect, 0, flash_info[i].sector_count); /* force unprotect for atmel flashs */ 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 2b150b8ef8..f80352d4a0 100644 --- a/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c +++ b/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c @@ -238,9 +238,9 @@ static int check_img(spidcom_image_desc_t *desc, char *addr) return IMAGE_NOT_VALID; } - /* Now check other flagas... */ + /* Now check other flags... */ - if ( strcmp(desc->magic, SPIDCOM_IMG_DESC_MAGIC) ) + if ( memcmp(desc->magic, SPIDCOM_IMG_DESC_MAGIC, sizeof(desc->magic)) ) { desc->is_valid = 0; /* Mark descriptor has changed to write this new value under flash */ @@ -341,6 +341,7 @@ static int select_image(int img_nb) spidcom_image_desc_t *desc; int img_state[MAX_IMG] = {0}; ulong max_index = 0; + char img_version[17]; int i; for (i=0; imagic, SPIDCOM_IMG_DESC_MAGIC, sizeof(desc->magic))) + { + strncpy(img_version, desc->version, sizeof(img_version)); + img_version[sizeof(img_version)-1] = '\0'; + } + else + { + strcpy(img_version, "Unknown"); + } + switch(img_state[i]) { case IMAGE_OK: - printf("IMG at address %#x is OK.\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is OK.\n", img_version, img_addr[i]); if (desc->index >= max_index) { max_index = desc->index; @@ -361,35 +372,35 @@ static int select_image(int img_nb) break; case IMAGE_OK_ORIGIN: - printf("IMG at address %#x is OK.\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is OK.\n", img_version, img_addr[i]); break; case BAD_MAGIC_NUMBER: - printf("IMG at address %#x is not OK (bad magic number).\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is not OK (bad magic number).\n", img_version, img_addr[i]); break; case WRONG_IMAGE_ARCH: - printf("IMG at address %#x is not OK (architecture error).\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is not OK (architecture error).\n", img_version, img_addr[i]); break; case WRONG_IMAGE_TYPE: - printf("IMG at address %#x is not OK (type error).\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is not OK (type error).\n", img_version, img_addr[i]); break; case UPD_NOT_FINISHED: - printf("IMG at address %#x is not OK (update error).\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is not OK (update error).\n", img_version, img_addr[i]); break; case INDEX_NOT_VALID: - printf("IMG at address %#x is not OK (index error).\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is not OK (index error).\n", img_version, img_addr[i]); break; case IMAGE_NOT_SUCCESS: - printf("IMG at address %#x is not OK (image error).\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is not OK (image error).\n", img_version, img_addr[i]); break; default: /* IMAGE_NOT_VALID */ - printf("IMG at address %#x is not OK (valid error).\n", img_addr[i]); + printf("IMG (%-16s) at address %#x is not OK (valid error).\n", img_version, img_addr[i]); } } @@ -450,6 +461,7 @@ int do_spidboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ulong img_0_addr; ulong img_max_size; int sel_img = -1; /* image selected for boot after all the checks */ + char img_version[17]; #ifdef CONFIG_CMDLINE_TAG char *commandline = getenv ("bootargs"); @@ -515,7 +527,9 @@ int do_spidboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * selected image => we will not check it's validity */ } - printf ("## Booting image at 0x%08lx ...\n", addr); + strncpy(img_version, hdr->version, sizeof(img_version)); + img_version[sizeof(img_version)-1] = '\0'; + printf ("## Booting image \"%s\" at 0x%08lx ...\n", img_version, addr); /* do the image transfer */ data = (int)addr + sizeof(spidcom_image_desc_t); diff --git a/cleopatre/u-boot-1.1.6/net/spidupd.c b/cleopatre/u-boot-1.1.6/net/spidupd.c index 5e32aa2dd6..9bd2fd9fd2 100644 --- a/cleopatre/u-boot-1.1.6/net/spidupd.c +++ b/cleopatre/u-boot-1.1.6/net/spidupd.c @@ -684,7 +684,6 @@ static void SpidupdSend(int rsp_type) */ static void SpidupdHandler(uchar *pkt, unsigned dest, unsigned src, unsigned len) { - int i; VSMS_MME_t *mme; VsUpdStartReq_t *vs_update_start_req; VsUpdTransfReq_t *vs_update_transfer_req; -- cgit v1.2.3