summaryrefslogtreecommitdiffstats
path: root/utils/sbtools/sbtoelf.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/sbtools/sbtoelf.c')
-rw-r--r--utils/sbtools/sbtoelf.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/utils/sbtools/sbtoelf.c b/utils/sbtools/sbtoelf.c
index f421f83848..d729357a56 100644
--- a/utils/sbtools/sbtoelf.c
+++ b/utils/sbtools/sbtoelf.c
@@ -339,7 +339,7 @@ static void extract_section(int data_sec, char name[5], byte *buf, int size, con
elf_release(&elf);
}
-void fill_section_name(char name[5], uint32_t identifier)
+static void fill_section_name(char name[5], uint32_t identifier)
{
name[0] = (identifier >> 24) & 0xff;
name[1] = (identifier >> 16) & 0xff;
@@ -351,6 +351,18 @@ void fill_section_name(char name[5], uint32_t identifier)
name[4] = 0;
}
+static uint16_t swap16(uint16_t t)
+{
+ return (t << 8) | (t >> 8);
+}
+
+static void fix_version(struct sb_version_t *ver)
+{
+ ver->major = swap16(ver->major);
+ ver->minor = swap16(ver->minor);
+ ver->revision = swap16(ver->revision);
+}
+
static void extract(unsigned long filesize)
{
struct sha_1_params_t sha_1_params;
@@ -433,16 +445,19 @@ static void extract(unsigned long filesize)
color(YELLOW);
printf("%s", asctime(time));
+ struct sb_version_t product_ver = sb_header->product_ver;
+ fix_version(&product_ver);
+ struct sb_version_t component_ver = sb_header->component_ver;
+ fix_version(&component_ver);
+
color(GREEN);
printf(" Product version = ");
color(YELLOW);
- printf("%X.%X.%X\n", sb_header->product_ver.major,
- sb_header->product_ver.minor, sb_header->product_ver.revision);
+ printf("%X.%X.%X\n", product_ver.major, product_ver.minor, product_ver.revision);
color(GREEN);
printf(" Component version = ");
color(YELLOW);
- printf("%X.%X.%X\n", sb_header->component_ver.major,
- sb_header->component_ver.minor, sb_header->component_ver.revision);
+ printf("%X.%X.%X\n", component_ver.major, component_ver.minor, component_ver.revision);
color(GREEN);
printf(" Drive tag = ");