diff options
author | Wadim Egorov <w.egorov@phytec.de> | 2015-06-15 10:29:33 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-06-17 07:46:48 +0200 |
commit | cb50b4ed51d2164de2dd5ce98d61ab900a11df50 (patch) | |
tree | 000e670f9fa11a9cb235e2fc8de21a2748144ca1 | |
parent | cfadaca3953e2af2ef36a6d25fb5aea196841d1e (diff) | |
download | barebox-cb50b4ed51d2164de2dd5ce98d61ab900a11df50.tar.gz barebox-cb50b4ed51d2164de2dd5ce98d61ab900a11df50.tar.xz |
scripts/omap_signGP: Fix image size in GP header
The size field in the GP header has to include its own size.
This can be easily misread in the TRM.
Sometimes, when the gp_header size is not included, the ROM code
will not copy the complete MLO into the SRAM. This happens when the MLO file
size is 98823 bytes (and the value of GP header size field is 98303 bytes).
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | scripts/omap_signGP.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/omap_signGP.c b/scripts/omap_signGP.c index 482cfac925..ac47fdf089 100644 --- a/scripts/omap_signGP.c +++ b/scripts/omap_signGP.c @@ -317,8 +317,15 @@ int main(int argc, char *argv[]) if (fwrite(&config_header, 1, 512, ofile) <= 0) pdie("fwrite"); + /* The size field in the header needs to include the + * size of the gp_header */ + len += sizeof(struct gp_header); + if (fwrite(&len, 1, 4, ofile) <= 0) pdie("fwrite"); + + len -= sizeof(struct gp_header); + if (fwrite(&loadaddr, 1, 4, ofile) <= 0) pdie("fwrite"); for (i = 0; i < len; i++) { |