aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-05-12 13:20:36 +0000
committerFlorian Fainelli <florian@openwrt.org>2009-05-12 13:20:36 +0000
commite5a836693e66a0edd0f35cf6a110b06142f3515b (patch)
tree0fdbb92a226c0dabfdf14a61121270f967b5ea65 /tools/firmware-utils
parentf27feec22f824ff2ab0041aebb3b45852f488929 (diff)
downloadupstream-e5a836693e66a0edd0f35cf6a110b06142f3515b.tar.gz
upstream-e5a836693e66a0edd0f35cf6a110b06142f3515b.tar.bz2
upstream-e5a836693e66a0edd0f35cf6a110b06142f3515b.zip
fix padding between end of the kernel and beginning of the rootfs in imagetag (#5108)
SVN-Revision: 15801
Diffstat (limited to 'tools/firmware-utils')
-rw-r--r--tools/firmware-utils/src/imagetag.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/firmware-utils/src/imagetag.c b/tools/firmware-utils/src/imagetag.c
index a5b7a93c68..31ba9b9c08 100644
--- a/tools/firmware-utils/src/imagetag.c
+++ b/tools/firmware-utils/src/imagetag.c
@@ -153,7 +153,7 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
struct imagetag tag;
struct kernelhdr khdr;
FILE *kernelfile = NULL, *rootfsfile = NULL, *binfile;
- size_t kerneloff, kernellen, rootfsoff, rootfslen, read, imagelen;
+ size_t kerneloff, kernellen, rootfsoff, rootfslen, read, imagelen, rootfsoffpadlen;
uint8_t readbuf[1024];
uint32_t crc = IMAGETAG_CRC_START;
const uint32_t deadcode = htonl(DEADCODE);
@@ -203,6 +203,7 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
rootfslen = getlen(rootfsfile);
rootfslen = (rootfslen % flash_bs) > 0 ? (((rootfslen / flash_bs) + 1) * flash_bs) : rootfslen;
imagelen = rootfsoff + rootfslen - kerneloff + sizeof(deadcode);
+ rootfsoffpadlen = rootfsoff - (kerneloff + kernellen);
/* Seek to the start of the kernel */
fseek(binfile, kerneloff - fwaddr, SEEK_SET);
@@ -260,7 +261,7 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
if (kernelfile) {
sprintf(tag.kernel.address, "%lu", kerneloff);
- sprintf(tag.kernel.len, "%lu", kernellen);
+ sprintf(tag.kernel.len, "%lu", kernellen + rootfsoffpadlen);
}
if (rootfsfile) {