aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2019-07-19 15:52:46 +0200
committerPetr Štetiar <ynezz@true.cz>2019-07-19 16:16:15 +0200
commit9401780c2c87dc78116eabe30b4eae987b05a921 (patch)
tree635195719087f8f28f6972e977334f0a43ec6901 /tools
parent83e60f0df6e1f80011d454103fd4156d27dc7d98 (diff)
downloadupstream-9401780c2c87dc78116eabe30b4eae987b05a921.tar.gz
upstream-9401780c2c87dc78116eabe30b4eae987b05a921.tar.bz2
upstream-9401780c2c87dc78116eabe30b4eae987b05a921.zip
firmware-utils: mkfwimage: provide human readable error
While looking at the ath25 build breakage of 19.07 images today I've encountered following error: mkfwimage -B XS5 -v [...] ath25-ubnt5-squashfs-sysupgrade.bin.new ERROR: Failed creating firmware layout description - error code: -2 Which is barely human readable and needs poking into the source code, so this patch makes the error more verbose and usable by mere mortals. Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'tools')
-rw-r--r--tools/firmware-utils/src/mkfwimage.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c
index c919a2a131..6f993d121d 100644
--- a/tools/firmware-utils/src/mkfwimage.c
+++ b/tools/firmware-utils/src/mkfwimage.c
@@ -297,6 +297,7 @@ static u_int32_t filelength(const char* file)
static int create_image_layout(const char* kernelfile, const char* rootfsfile, char* board_name, image_info_t* im)
{
+ uint32_t rootfs_len = 0;
part_data_t* kernel = &im->parts[0];
part_data_t* rootfs = &im->parts[1];
@@ -311,8 +312,13 @@ static int create_image_layout(const char* kernelfile, const char* rootfsfile, c
kernel->partition_entryaddr = p->kern_entry;
strncpy(kernel->filename, kernelfile, sizeof(kernel->filename));
- if (filelength(rootfsfile) + kernel->partition_length > p->firmware_max_length)
+ rootfs_len = filelength(rootfsfile);
+ if (rootfs_len + kernel->partition_length > p->firmware_max_length) {
+ ERROR("File '%s' too big (0x%08X) - max size: 0x%08X (exceeds %u bytes)\n",
+ rootfsfile, rootfs_len, p->firmware_max_length,
+ (rootfs_len + kernel->partition_length) - p->firmware_max_length);
return (-2);
+ }
strcpy(rootfs->partition_name, "rootfs");
rootfs->partition_index = 2;