Commit Graph

18 Commits

Author SHA1 Message Date
Rafał Miłecki
36a92274a8 otrx: fix memory leak in otrx_create_append_zeros
A "free" call was missing after allocating a buffer.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-11-17 11:32:51 +01:00
Rafał Miłecki
70837168ef otrx: bump buffer size in otrx_create_append_file
Usually this function is called for appending some small files only
(like fs marks) but let's just make it more generic and capable of
handling bigger files easily. Increasing buffer to 1 KiB shouldn't hurt.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-11-17 11:30:31 +01:00
Rafał Miłecki
ab8f20c18d otrx: drop unused otrx_create_parse_options function
It was there in case of adding some "create" command options that should
be parsed before actually creating the output image. It seems we don't
need any at this point so let's drop this function for now.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-11-17 11:30:31 +01:00
Rafał Miłecki
b15c563929 otrx: always align image to 0x1000
This seems to match what the original trx tool and mjn3's replacement
do.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-11-16 09:33:56 +01:00
Rafał Miłecki
3f96e57aed otrx: add support for -A (append) and -a (align) options
They are inspired and compatible with the original and mjn3's trx tool.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-11-14 22:33:19 +01:00
Rafał Miłecki
6d283b8029 otrx: optimize memory usage when creating TRX image
There is no need to allocate buffer as big as the whole image in order
to calculate CRC32. It's enough to use small buffer and just read file
content block by block.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-11-14 22:33:19 +01:00
Rafał Miłecki
c6761e7c8e otrx: use helper function when checking image's CRC32
This requires changing this helper to accept initial/current CRC32
value as argument but it allows dropping duplicated (complex?) code
calculating the CRC32.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-11-14 22:33:19 +01:00
Rafał Miłecki
e0a3d9d115 otrx: add extra compilation check before using __BYTE_ORDER
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 46106
2015-06-22 07:51:00 +00:00
Rafał Miłecki
0e5c445df6 otrx: include endian.h to make __BYTE_ORDER work with musl
Without this the condition
if __BYTE_ORDER == __BIG_ENDIAN
was always true.

Thanks Szabolcs.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 46105
2015-06-22 06:45:56 +00:00
Rafał Miłecki
1e6643ff15 otrx: optimize memory usage by function checking TRX CRC
Allocating huge buffer for the whole TRX wasn't too optimal.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 46078
2015-06-20 21:12:01 +00:00
Rafał Miłecki
c13dede6b1 otrx: make crc32 table global for further optimizations
So far we got only one generic function accessing this table, but
implementing optimizations will require calculating crc32 in other code
parts as well.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 46077
2015-06-20 21:11:56 +00:00
Rafał Miłecki
8b1b857948 otrx: support for creating simple TRX files
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45444
2015-04-14 20:50:53 +00:00
Rafał Miłecki
3cb8bf44e6 otrx: change command line API to start with a mode
This will allow adding more modes without options conflict.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45443
2015-04-14 20:50:46 +00:00
Rafał Miłecki
0bd2710512 otrx: use %zd to fix printf format warnings
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45436
2015-04-14 16:16:11 +00:00
Rafał Miłecki
834e60c4f1 otrx: check TRX length read from header to avoid Segmentation fault
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45433
2015-04-14 12:18:57 +00:00
Rafał Miłecki
cd4fd05648 otrx: include byteswap.h to fix compilation with musl
Fixes #19470

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45430
2015-04-14 11:10:14 +00:00
Rafał Miłecki
ab6462dd56 otrx: support for extracting partitions
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45390
2015-04-12 11:46:11 +00:00
Rafał Miłecki
71e6325ab8 otrx: new package with tiny app verifying TRX images
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45315
2015-04-09 05:21:55 +00:00