summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <maz@misterjones.org>2008-08-02 19:12:23 +0200
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-08-02 18:36:10 +0100
commit85ebd00334099fd5d296bcae74a66c943d46686d (patch)
tree07f799155fd03f15606e7c49a7d6547fb6f18563
parentf1136d022af8f07a97f59c6d07483bdb82ffbd8e (diff)
downloadlinux-85ebd00334099fd5d296bcae74a66c943d46686d.tar.gz
linux-85ebd00334099fd5d296bcae74a66c943d46686d.tar.bz2
linux-85ebd00334099fd5d296bcae74a66c943d46686d.zip
Fix IHEX firmware generation/loading
Fix both the IHEX firmware generation (len field always null, and EOF marker a byte too short) and loading (struct ihex_binrec needs to be packed to reflect the on-disk structure). Signed-off-by: Marc Zyngier <maz@misterjones.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--firmware/ihex2fw.c6
-rw-r--r--include/linux/ihex.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/firmware/ihex2fw.c b/firmware/ihex2fw.c
index 660b191ed75e..8f7fdaa9e010 100644
--- a/firmware/ihex2fw.c
+++ b/firmware/ihex2fw.c
@@ -250,19 +250,19 @@ static void file_record(struct ihex_binrec *record)
static int output_records(int outfd)
{
- unsigned char zeroes[5] = {0, 0, 0, 0, 0};
+ unsigned char zeroes[6] = {0, 0, 0, 0, 0, 0};
struct ihex_binrec *p = records;
while (p) {
uint16_t writelen = (p->len + 9) & ~3;
p->addr = htonl(p->addr);
- p->len = htonl(p->len);
+ p->len = htons(p->len);
write(outfd, &p->addr, writelen);
p = p->next;
}
/* EOF record is zero length, since we don't bother to represent
the type field in the binary version */
- write(outfd, zeroes, 5);
+ write(outfd, zeroes, 6);
return 0;
}
diff --git a/include/linux/ihex.h b/include/linux/ihex.h
index 2baace2788a7..31d8629e75a1 100644
--- a/include/linux/ihex.h
+++ b/include/linux/ihex.h
@@ -18,7 +18,7 @@ struct ihex_binrec {
__be32 addr;
__be16 len;
uint8_t data[0];
-} __attribute__((aligned(4)));
+} __attribute__((packed));
/* Find the next record, taking into account the 4-byte alignment */
static inline const struct ihex_binrec *