aboutsummaryrefslogtreecommitdiff
path: root/jffsX-utils
AgeCommit message (Collapse)Author
2024-02-18Make zlib an optional dependencyDavid Oberhollenzer
Now that we have plumbing in place for both jffsX-utils and mkfs.ubifs, add the missing autoconf and automake changes to allow mtd-utils to be built without a hard dependency on zlib. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2024-02-18Make it possible to compile jffsX-utils without zlibDavid Oberhollenzer
The jffsX-utils already have a CONFIG_JFFS2_ZLIB define, but it is statically defined in a header and not used consistently. This patch first replaces it with a "WITH_ZLIB" define, provided via automake, to bring it in line with the already existing "WITH_LZO". Then, the missing checks and typedefs are added in jffs2reader.c. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2024-02-17Fix optional compilation of lzo compressorsDavid Oberhollenzer
- Simple fixup in autoconf.ac - Make compilation of jffsX-utils compr_lzo.c optional. Simply don't compile it if we built without LZO and remove the place holders. They are not used anyway if we build without LZO. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2024-02-15Cleanup handling of optional dependenciesDavid Oberhollenzer
Don't use super pedantic parsing of the argument and work with the generated variable instead of assigning it to our own and set it to "check" if not value is assigned. Then search for a dependency if the with variable is anything other than "no" and fail if it was set to "yes". In addition, the WITHOUT_xxx defines are replaced with WITH_xxx defines. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-02jffs2dump: check return value of lseekDavid Oberhollenzer
On error, lseek returns a negative value. We need to check for that and abort, instead of passing -1 to malloc and later on to read_nocheck. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-10-07Fix warning about unaligned pointer in jffs2readerFrederic Germain
gcc 9.3.0-17ubuntu1~20.04 warning on time_t ctime value is : Fix taking address of packed member of ‘struct jffs2_raw_inode’ may result in an unaligned pointer value [-Waddress-of-packed-member]. Signed-off-by: Frederic Germain <frederic.germain@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-09-27mkfs.jffs2: fix spelling of --compression-mode parameter in help textAlex Henrie
--compr-mode is not accepted as an alias of --compression-mode. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-01-05Fix: add missing new-line-escape in jffsX-utils Makemodule.amDavid Oberhollenzer
In commit a888044525, various header files that were added to the distribution tarball via EXTRA_DIST were instead added to the source lists of their respective programs instead. In the case of jffsX-utils, a missing escape for a new-line in the source list caused the include/linux/jffs2.h header to not be packged in the release tarball. This went undiscovered, as the system on which the release tarball was built, had the same header installed installed in the system include directory, so a `make distcheck` succeeded. Fixes: a888044525 Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-01-20Cleanup: Automake: remove single use variablesDavid Oberhollenzer
Throughout the Automake files, there is a consistent pattern somewhat like this: FOO_BINS = .... sbin_PROGRAMS += $(FOO_BINS) This commit all such patterns whenever the variable is not used anywhere else and appends to the target directly. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-01-20Remove headers from EXTRA_DISTDavid Oberhollenzer
This commit removes the C header files from the EXTRA_DIST variables and instead assigns them to the SOURCE variable of the respective components they belong to. This takes care of having them distributed in the release tar ball and helps with dependency tracking a little. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-09-11Fix typos found by Debian's lintian toolBastian Germann
Signed-off-by: Bastian Germann <bastiangermann@fishpost.de> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-07-31fix build of jffs2reader and jffs2dump if zlib or lzo headers are not in ↵Rolf Eike Beer
default paths Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-02-09mtd-utils: Add checks to code that copies strings into fixed sized buffersDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-02-09mtd-utils: Fix various TOCTOU issuesDavid Oberhollenzer
This patch restructures various code parts that follow the pattern of "stat(x, &sb) ... makes_sense(&sb) ... open(x)". Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-11-10mkfs.jffs2: don't leak temporary buffer if readlink failsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2018-10-02mtd-utils: Instead of doing preprocessor magic, just output off_t as long longThorsten Glaser
Fix warnings abot PRIdoff_t in libmtd.c, in mtd_read (and mtd_write): In file included from ../git/lib/libmtd.c:40:0: ../git/lib/libmtd.c: In function 'mtd_read': ../git/include/common.h:110:18: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'off_t {aka long long int}' [-Wformat=] ../git/include/common.h:120:2: note: in expansion of macro 'errmsg' errmsg(fmt, ##__VA_ARGS__); \ ^~~~~~ ../git/lib/libmtd.c:1082:10: note: in expansion of macro 'sys_errmsg' return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, ^~~~~~~~~~ /usr/lib/klibc/include/inttypes.h:28:17: note: format string is defined here #define PRId32 "d" Signed-off-by: Thorsten Glaser <tg@mirbsd.org> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-28Eliminate warnings about missing prototypesDavid Oberhollenzer
This patch eliminates warnings generated by the -Wmissing-prototypes option. With this flag set, we are now forced to have prototypes for all global, exported functions, that have to be made visible to the definitions and we are forced to mark all local functions as static. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-14jffsX-utils: Return error code if command line option is unknownDaniel Wagner
The tools in question will quit with an exit code 0 if the command line option was not recognized. By returning an error code a calling script has the possibility to distinguish between a real success and an invalid invocation. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-14Use defines for exit code valuesDaniel Wagner
Make the usage of exit consist. That is use the pre defined exit values. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-05-31mkfs.ubifs: Add support for symlinks in device tableDavid Engraf
It is not possible to change ownership for symlinks in the device table file. This patch adds support for symlinks equal to mkfs.jffs2 and updates the sample device table file. The permission entry for symlinks in the device table must be set to 0777. Signed-off-by: David Engraf <david.engraf@sysgo.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-03-02Fix build with muslKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-12-06common: Fix 'unchecked return code' warningsBoris Brezillon
Several tools are simply not checking return code of functions marked with 'warn_unused_result'. Provide wrappers for the read/write functions to avoid patching old code and providing proper error handling. Fix the remaining ones (calls to fgets() and system()). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-17Unify version string printingDavid Oberhollenzer
When a program does sophisticated enough command line processing (i.e. getopt), make sure it responds to -V and --version. When a program prints a version string, make sure it uses the common_print_version macro to print out its name, that it is part of mtd-utils and the mtd-utils version from the build system in a fashion similar to common program packages like the GNU coreutils. When a program responds to -V/--version or -h/--help, make sure it reports success exit status. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Change build system to autotoolsRichard Weinberger
This patch is largely based on Richards original RFC. The major differences to the RFC patch are: - Add missing sumtools & mtdpart targets - Fix name of mkfs.jffs2 target - Add missing subdir-objects option for non-recursive make - Move all automake options to configure.ac - Add manpages to install target - Make XATTR & LZO support configurable - Install binaries to sbin directory like in the old build system - Install flash_erase wrapper script - Add files missing from distribution target Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Remove jffs-dump.cDavid Oberhollenzer
This _entire_ file is dead code. The download packages on the FTP server contain it all the way back to mtd-utils 1.0, but it isn't built in any of them. The git history (which dates back to 2006) contains no instance where that file was ever used in a build process. A quick look at various distribution packages didn't reveal any that contained a jffs-dump utilty. There have been no major changes to this file since the initial commit. It won't even compile as it doesn't have a PROGRAM_NAME defined required by common.h at least since 2010. At this point, it can be safeley assumed that nobody will miss this. They had at least 10 years to do something about it. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-08-25mtd-utils: mkfs.jffs2: initialize lzo decompression buffer sizeDavid Oberhollenzer
This fix was initialially part of a patch submitted by Carsten Schlote in January 2009. It didn't get merged back then because of coding style issues and a proposed buffer size change guessed by shotgun debugging. I was unable to reproduce the claimed segfaults in the compression function that lead to the proposed buffer size change. Valgrind did not issue any errors or warnings about the code in question either, so I didn't include the proposed buffer size change. The original patch also added a call to lzo_init(), which (according to LZO documentation & source code) does not actually perform any initialization, but only checks at runtime that the data type sizes and endianness of the library code match those in the caller code and should be unnecessary. Other fixes from the original patch have already been added over the years. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-12Fix scanf() formatstring for modern C versionDaniel Walter
mkfs.jffs2 is using an old assignment-allocation modifier for scanf(). Add a check so this modifier does not get confused with a float formatstring on newer C standard (C99 onwards). Signed-off-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-11mtd-utils: Restructure the mtd-utils source.Dongsheng Yang
* There is no code modification in this commit, only moving * the files to proper place. The user tools looks a little messy as we place almost the all tools in the root directory of mtd-utils. To make it more clear, I propose to introduce the following structure for our source code. mtd-utils/ |-- lib |-- include |-- misc-utils |-- jffsX-utils |-- nand-utils |-- nor-utils |-- ubi-utils |-- ubifs-utils `-- tests Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>