From 3da5c74ed893b9419669c7838d61405d9f837051 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 12 May 2009 13:20:36 +0000 Subject: [tools] fix padding between end of the kernel and beginning of the rootfs in imagetag (#5108) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@15801 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/firmware-utils/src/imagetag.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/firmware-utils/src/imagetag.c b/tools/firmware-utils/src/imagetag.c index a5b7a93c6..31ba9b9c0 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) { -- cgit v1.2.3