summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-11-17mtd-utils: Add flash read test utilityDavid Oberhollenzer
Basically a user space port of the mtd read test kernel module. In addition to the module parameters, the utility can scan only a sub-range of the flash erase block with a configurable stride. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17mtd-utils: Add nand flash bit errors testDavid Oberhollenzer
Basically a user space port of the mtd speed test kernel module. In addition to the module parameters, the utility can resture the block contents after test and allows setting the maxium writes for the test. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17mtd-utils: Add flash speed test utilityDavid Oberhollenzer
Basically a user space port of the mtd speed test kernel module. In addition to the block offset and count module parameters, the utility supports a block stride and can restore the block contents after test. Furthermore, a flag can be used to disable destructive tests (i.e. only perform read speed tests). Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17mtd-utils: Add flash stress test utilityDavid Oberhollenzer
Basically a user space port of the mtd stress test kernel module. In addition to the block offset and count module parameters, the utility supports a block stride and can restore the block contents after test. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17mtd-utils: Add flash torture test utilityDavid Oberhollenzer
Basically a user space port of the mtd torture test kernel module. In addition to the block offset and count module parameters, the utility supports a block stride and can restore the block contents after test. In contrast to the kernel module, the torture test is implemented by the libmtd mtd_toruture function and thus doesn't allow for similarly fine grained options on diagnostics. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17mtd-utils: Add multi-block erase functionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Add libmissingDavid Oberhollenzer
This patch adds a libmissing library to mtd-utils, containing implementations of functionality found in glibc but typically missing from embedded C libraries such as uclibc ot musl. For now, the library only contains stub implementations of the backtrace*() family of functions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Add -lrt for clock_gettime() in glibc < 2.17.David Gstir
Some tools use clock_gettime() which requires building with -lrt for versions of glibc before 2.17. Signed-off-by: David Gstir <david@sigma-star.at>
2016-11-17Fix make_a_release scriptDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Fix paths in .gitignore and add autotools generated filesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
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-17Integrate tests into autotools build systemDavid Oberhollenzer
Add automake files for the test binaries. If configured to do so, install the test binaries to libexec/mtd-utils and use autoconf to fix the paths in the test scripts. 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 feature-removal-schedule.txtDavid Oberhollenzer
This patch removes the old feature-removal-schedule.txt file from mtd-utils, mostly for reasons similar to the ones that lead to the decision of removing the feature-removal-schedule.txt from the kernel. Removing features by itself is rather problematic as there is no simple way of estimating whether something is being used widley or not at all. Thus, consensus usually tends towards not removing features at all. Even if there is a file anouncing feature removal, users in large won't read this file _if_ it is even included in distribution packages. People working on mtd-uils would end up removing features that _they_ find useless and users would start complaining once their setups break after they install a new version of mtd-utils. In conclusion, once introduced, features should not be removed to begin with and this file is entirely usless. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-11-17Remove duplicate copies of GPLv2 license textDavid Oberhollenzer
Some of the programs in the mtd-utils used to be seperate packages that were at some point merged into mtd-utils. As a result, some subdirectories contain their own README and COPYING files with copies of the GPLv2 license text. Since those programs are now part of mtd-utils that contains a copy of the GPLv2 in the file COPYING in the package root directory, those extra files can be removed, as there is no need for distributing an extra copy of the license text for each individual program in the bundle. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Remove RPM spec fileDavid Oberhollenzer
Building packages for distributions is typically something highly distribution specific. While there are widely used package formats like RPM, implementing a de-facto standard, the build process, list of files actually packaged, list of required dependencies, package grouping, package versioning, etc... is still _very_ distribution specific. In fact, this spec file completely fails to address some of these points. Actual RPM based distributions out there currently use their own, distribution specific, RPM spec files that were possibly _based_ on this one at some point (judging from similar descriptions). The spec file _may_ have worked at some point, but it definitely doesn't work with the new build system and there is no real reason to fix it (which, by definition, isn't possible for the reasons above) and drag it along for another decade or two. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Remove unused and broken mtd_write_img function from libmtdDavid Oberhollenzer
The function _tries_ to support short reads but doesn't adjust the pointer into the buffer. If a short read happens, we scrambles the flash contents. Interrupted reads aren't handled. Short or interrupted writes aren't handled at all. Either a write succeeds writing the entire buffer or the function gives up. During an attempt at fixing it, it was discovered, that no mtd-utils program uses this function. Furthermore, its highly specific nature makes it more of a "feature looking for use case". Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Remove unused legacy_libmtd_open internal libmtd functionDavid Oberhollenzer
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-11-17Eliminate warnings about implicit non-const casting in libmtdDavid Oberhollenzer
The mtd_get_dev_info1 function reads (among other things) name and type string into coresponding struct mtd_dev_info fields. The struct mtd_dev_info has the string fields marked const, requiring them to be cast to non-const version during initialization. This cast was previously omitted from the dev_read_data calls, triggering warnings during compilation. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17nanddump: check write function result for errorsRafał Miłecki
Errors may happen, it's e.g. easy on embedded devices to run out of space when dumping big partitions. This patch adds a helper function for writing. It deals with partial writes and just returns 0 on success or error number. The old code didn't check for errors at all which could result in incomplete dumps without exiting with an error. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> 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>
2016-08-25fs-tests: integrity: don't include header <bits/stdio_lim.h>Rahul Bedarkar
In commit ca7a5eda221d("integck.c: Fix buffer overflow in save_file") we started including header <bits/stdio_lim.h>. But with musl C library, we get following build error integck.c:37:28: fatal error: bits/stdio_lim.h: No such file or directory #include <bits/stdio_lim.h> ^ compilation terminated. make[2]: *** [integck] Error 1 Header <bits/stdio_lim.h> is not available in musl C library. However <stdio.h> has all definition that <bits/stdio_lim.h> supposed to be providing. Moreover <bits/stdio_lim.h> shouldn't be included directly instead we should be using <stdio.h>. Since we already include <stdio.h> and in case of uClibc or glibc <bits/stdio_lim.h> gets included internally, we can safely remove it. This build issue is found by Buildroot autobuilder http://autobuild.buildroot.net/results/175/1754861457af520480cc34d7d2d0edff2868ff66/ Fixes: ca7a5eda221d("integck.c: Fix buffer overflow in save_file") Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-08-25mtd-utils: fix wrong format specifiers on mips32Mathias Kresin
This patch fixes the follwing compiler warnings: flash_erase.c: In function 'show_progress': flash_erase.c:56:22: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'off_t {aka long long int}' [-Wformat=] bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ", ^ ./include/common.h:81:10: note: in definition of macro 'bareverbose' printf(fmt, ##__VA_ARGS__); which are linked to the following buggy numerical output: Erasing 128 Kibyte @ 0 -- 917504 % complete flash_erase: Cleanmarker written at 0 Erasing 128 Kibyte @ 0 -- 1048576 % complete flash_erase: Cleanmarker written at 0 Signed-off-by: Mathias Kresin <dev@kresin.me> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-08-25mtd-utils: mtd_debug: check amount of data read.Michal Suchanek
The kernel refuses to read more data from a MTD device than the device size. However, mtd_debug does not check the amount of data read as returned by read(2) and assumes the requested amount is always read when there is no error. Reading 8M data from a 4M flash chip results in 8M file containing the flash data at the start. Signed-off-by: Michal Suchanek <hramrach@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-08-25mtd-utils: nanddump: write requested length onlyGary Bisson
nanddump was always writing a whole page of data into the output discarding the length actually requested. This patch allows to write only the remaining length if oob is omitted. In case oob is needed, it makes sense to copy the entire page. Signed-off-by: Richard Weinberger <richard@nod.at>
2016-07-13libmtd: Fix return status in mtd_torture test functionDavid Oberhollenzer
This patch fixes the return status of the mtd_torture function in libmtd. The torture test function is currently only used by the ubiformat utility to check if a block is bad after a write fails (blocks are marked bad if the function returns an error status). However, the way the function was written, it ALWAYS returns an error value regardless of whether it failed or not. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-04-18fix build warnings w/newer glibc & _BSD_SOURCEMike Frysinger
The _BSD_SOURCE define has been deprecated for a while now. Instead, code should be defining _DEFAULT_SOURCE. By defining both, it'll work with both new & old versions warning-free. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-04-18include sys/sysmacros.h for major/minor/makedevMike Frysinger
These functions have always been defined in sys/sysmacros.h under Linux C libraries. For some, including sys/types.h implicitly includes that as well, but glibc wants to deprecate that, and some others already have. Include the header explicitly for the funcs. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-01-26Makefile: install: don't look for scripts in BUILDDIRBrian Norris
Our ${SCRIPTS} (e.g., flash_eraseall) are not found in the build directory; they should be found in their original location. This fixes a typo in the Makefile refactoring, which caused 'make install' to fail with messages like: make: *** No rule to make target '[...my source-build directory...]/armv7a-cros-linux-gnueabi/misc-utils/flash_eraseall'. Stop. because the install target is looking in the wrong place for flash_eraseall. Fixes: 7d81790ced34 ("mtd-utils: Restructure the mtd-utils source.") Signed-off-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
2016-01-24mkfs.ubifs: <sys/xattr.h>, not <attr/xattr.h>Brian Norris
To be consistent with mkfs.jffs2, and to get this to build on my machine, it looks like we should use <sys/xattr.h>, not <attr/xattr.h>. Fixes this error, seen on an Ubuntu 14.04 build system: ubifs-utils/mkfs.ubifs/mkfs.ubifs.c:30:24: fatal error: attr/xattr.h: No such file or directory #include <attr/xattr.h> ^ Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Marc Kleine-Budde <mkl@pengutronix.de> Reviewed-by: Richard Weinberger <richard@nod.at>
2015-12-09mkfs.ubifs: use gid from table instead 2x uidSebastian Andrzej Siewior
If the devtable is used then the tool uses uid twice and doesn't consider gid at all. This changes it to use gid & uid. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-17libmtd: mtd_read: Take the buffer offset into account when readingMarcus Prebble
Assuming the read() call does not return zero and the result is less than len, the current implementation will overwrite the data already read in buf which doesn't seem correct. With this patch, subsequent calls to read() within the loop will now no longer overwrite the existing contents of buf. Signed-off-by: Marcus Prebble <marcus.prebble@axis.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-12flashcp: Use %llu to print filestat.st_sizeFabien Proriol
filestat.st_size type is off_t. For some paltforms, off_t can be 32 or 64bit but there is no C99 format specifier for off_t. The best way to print it with printf is to cast it to long long and print with %llu Signed-off-by: Fabien Proriol <fabien.proriol@jdsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-12mkfs.ubifs: fix compiler warning for WITHOUT_LZODaniel Walter
Fix compiler warning about an unused variable. ubifs-utils/mkfs.ubifs/compr.c:41:27: warning: ‘c’ defined but not used [-Wunused-variable] static struct ubifs_info *c = &info_; Signed-off-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
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-12fix build when WITHOUT_LZO is setRolf Eike Beer
Make mkfs.ubifs honor the WITHOUT_LZO flag, too. Fixes this build error: mkfs.ubifs/compr.c:27:23: lzo/lzo1x.h: No such file or directory mkfs.ubifs/compr.c: In function `lzo_compress': mkfs.ubifs/compr.c:92: error: `lzo_uint' undeclared (first use in this function) mkfs.ubifs/compr.c:92: error: (Each undeclared identifier is reported only once mkfs.ubifs/compr.c:92: error: for each function it appears in.) mkfs.ubifs/compr.c:92: error: syntax error before "len" mkfs.ubifs/compr.c:95: error: `len' undeclared (first use in this function) mkfs.ubifs/compr.c:96: warning: implicit declaration of function `lzo1x_999_compress' mkfs.ubifs/compr.c:99: error: `LZO_E_OK' undeclared (first use in this function) mkfs.ubifs/compr.c: In function `init_compression': mkfs.ubifs/compr.c:201: error: `LZO1X_999_MEM_COMPRESS' undeclared (first use in this function) Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-12mkfs.ubifs: Optionally create extended attribute with inode numberSascha Hauer
This is done to allow creating images suitable for IMA directory appraisal. IMA creates a hash for directories and attaches this hash to the directory itself as an extended attribute. Among other things the inode numbers of the files are hashed. So, to create a valid hash in the UBIFS image the evmctl tool needs to know the inode numbers which the files in the UBIFS image will have. evmctl will read the inode numbers from the user.image-inode-number extended attribute. Since extended attributes are inodes themselves the inode numbers for the generated image will change when the extended attributes change, so to generate a correctly hashed UBIFS image, both evmctl and mkfs.ubifs must be run twice: 1) execute evmctl to iterate over the directory tree. This will create the security.ima and security.evm extended attributes. The existence of the attributes makes sure that subsequent calls to mkfs.ubifs will use the same inode numbers. evmctl will use the inode numbers from the host filesystem in this step which makes the resulting image unusable 2) execute mkfs.ubifs -a. This will create the user.image-inode-number extended attributes on files/directories added to the image. 3) execture evmctl again. This time evmctl will pick the inode numbers from the user.image-inode-number extended attribute instead of the ones from the host filesystem 4) execute mkfs.ubifs again. This will create the correct image. The now existing user.image-inode-number extended attributes are ignored and not added to the image. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-12mkfs.ubifs: Add extended attribute supportSascha Hauer
This adds extended attribute support to mkfs.ubifs. When creating an image from a directory tree the existing extended attributes are added to the UBIFS image. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-12mkfs.ubifs: simplify make_path with xasprintfSascha Hauer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-12mkfs.ubifs: use xmalloc/xzalloc for allocating memorySascha Hauer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-12mkfs.ubifs: change add_directory argument to 'existing'Sascha Hauer
A 'non_existing' argument which is only used with !non_existing is just too confusing. Change this to positive logic. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> 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>
2015-11-11flash_{un,}lock: document block count == -1Brian Norris
These utilities have accepted -1 as a block count to mean "all blocks." Let's document that. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-11flash_{un,}lock: don't allow "last byte + 1"Brian Norris
A lock/unlock/islocked ioctl() should be prevented from anything past the last byte, inclusive. But we were doing an exclusive check. This isn't a big deal, as the kernel MTD APIs would be guarding this anyway, but let's do this for completeness. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-11flash_{un,}lock: improve strtol() error handlingBrian Norris
Use the simple_* helpers to improve error checking. Also fixup brace style at the same time. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-11flash_{un,}lock: add MEMISLOCKED supportBrian Norris
With the -i / --islocked flags. Sample output: # flash_lock --islocked /dev/mtd0 Device: /dev/mtd0 Start: 0 Len: 0x400000 Lock status: unlocked Return code: 0 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-11flash_{un,}lock: support both lock/unlock in the same binaryBrian Norris
Add new --lock/--unlock flags, so we can do either with the same binary. This will prepare for the addition of other features, so we don't have to keep duplicating the same binary via #include "flash_unlock.c". The defaults still work as expected: flash_unlock will default to REQUEST_UNLOCK, and flash_lock will default to REQUEST_LOCK. Eventually, we might deprecate one of the two (flash_unlock, probably), so we only have to ship one flash_{un,}lock binary. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-11flash_{un,}lock: move args processing to its own functionBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-11-11flash_{un,}lock: abstract the argument positionsBrian Norris
Previously, there were no options (besides stand-alone --help and --version), so we just used fixed-position argv indexes. Let's change that. Also clean up the sanity checks a bit to make them more verbose and specific. Signed-off-by: Brian Norris <computersforpeace@gmail.com>