aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-09-29mtd: tests: Fix endian issue with CRC generation algorithmPaul McGougan
The calculation of the CRC in /tests/checkfs/makefiles.c was writing the CRC Into the produced files in host byte-order which would cause CRC validation to fail on big-endian systems as the validation is performed bytewise. Signed-off-by: Paul McGougan <pmcgougan AT topcon.com> [Brian: add endian.h] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-09-29mtd-utils: ubinize: Always return error code (at least -1) in case of an errorEnrico Jorns
ubinize should not fail silenty, this can be very annoying when using it from other tools that rely on the exit code for determining the success of their operation. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-08-31don't include system headers in dependency filesBrian Norris
System library headers are not strictly part of our build. If they are changing beneath our feet, then we probably have bigger problems. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Suggested-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-08-28autogenerated dependency files are not being utilized properlyBrian Norris
TL;DR Acked-by: Mike Frysinger <vapier@gentoo.org> ===== Auto-generated dependency rules are not being written correctly, so changes to dependent files (e.g., headers) do not actually trigger rebuilds. The problem =========== It appears that when a dependency generation flag is passed directly to the preprocessor (with '-Wp,...'), it loses information about the output path. So, it just makes up the output name as $(basename).o, with no path information. This yields .*.c.dep files that look like this: flash_lock.o: flash_lock.c /usr/include/stdc-predef.h flash_unlock.c \ (...) and nanddump.o: nanddump.c /usr/include/stdc-predef.h /usr/include/ctype.h \ (...) include/libmtd.h This is the case for both in-tree *and* out-of-tree builds. Naturally, this is a problem for out-of-tree builds. But it is also a problem for in-tree builds, because we use rules like this for builds: $(BUILDDIR)/%.o: %.c and make doesn't recognize $(BUILDDIR)/%.o as the same as %.o even when $(BUILDDIR) == $(PWD). Example failures ================ ## Rebuilding after touching common header doesn't recompile anything $ make (...) $ touch include/libmtd.h $ make CHK include/version.h ## Same for out-of-tree builds $ BUILDDIR=test make (...) $ touch include/libmtd.h $ BUILDDIR=test make CHK include/version.h I noticed this when seeing that flash_lock would not get rebuilt when modifying flash_unlock.c (where 99% of the source code lies): $ make (...) $ touch flash_unlock.c $ make CHK include/version.h CC flash_unlock.o LD flash_unlock The fix ======= Just pass -MD straight to the compiler, and make sure to specify the output file for the dependency info with -MF. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-08-19ubifs: correct the size of nnode in memsetDongsheng Yang
There is a typo in lpt to memset nnode by the size in sizeof(stuct ubifs_pnode). Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-08-03make_a_release.sh: fix MTD spellingBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-24Release mtd-utils-1.5.2v1.5.2Brian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-24.gitignore: add new mtdpart utilityBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-06mtd-utils: fix 'new blank line at EOF' problemsDongsheng Yang
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-06mtd-utils: fix 'space before tab in indent' problemDongsheng Yang
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-06mtd-utils: fix the trailing whitespace problemsDongsheng Yang
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-06mtd-utils: ubi-tests: fix a some overflowsDongsheng Yang
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-06mtd-utils: fs-tests: pass TEST_DIR to integck in run_all.shDongsheng Yang
Test integck requires a parameter but run_all.sh did no pass any to it. Then: integck: error!: test file-system was not specified (use -h for help) Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-28mtd-utils: Add mtdpart to add/delete partitionNam T. Nguyen
Add a simple utility to exercise BLKPG ioctl. Signed-off-by: Nam T. Nguyen <namnguyen@chromium.org> Acked-by: Mike Frysinger <vapier@chromium.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-28include/common.h: fix build against muslJörg Krause
Like uClibc version older than (not yet released) 0.9.34 musl does not have a rpmatch() implementation. uClibc defines both __UCLIBC__ and __GLIBC__. So first check for uCibc and its version and then for a non glibc implementation (like musl). Note, musl does not define __MUSL__. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-28recv_image: do not include error.hJörg Krause
recv_image does not use anything from it and it is not available with all C libraries, e.g. musl. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-28serve_image: do not include error.hJörg Krause
serve_image does not use anything from it and it is not available with all C libraries, e.g. musl. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-28libmtd: fix comment typoBaruch Siach
Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-28mtd-utils: libfec: use standard C type instead of u_longImre Kaloz
Fixes compilation on hosts with the musl C library. Also drops the unused u_short typedef. Signed-off-by: Imre Kaloz <kaloz@openwrt.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-28mkfs.ubifs: Fix build with gcc 5.1Bernhard Walle
In gcc 5.1, the default C standard which is used to compile a C file, has changed from gnu89 to gnu11. This changed the meaning of 'extern inline'. See https://gcc.gnu.org/gcc-5/porting_to.html. In mkfs.ubifs, this leads to multiple definitions of hashtable_iterator_key and -hashtable_iterator_value. I think the most pragmatic way to fix the issue is to replace 'extern inline' with 'static inline' here. Signed-off-by: Bernhard Walle <bernhard@bwalle.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2014-11-05mtd-utils: jffs2dump: XATTR and XREF support for endianess conversionTimo Warns
Add support for XATTR and XREF nodes to "convert image endianness" action of jffs2dump. Signed-off-by: Timo Warns <timo.warns@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-11-05mtd-utils: jffs2dump: XATTR and XREF support for content dumpTimo Warns
Add support for XATTR and XREF nodes to "dump image content" action of jffs2dump. Signed-off-by: Timo Warns <timo.warns@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-11-04libmtd: don't ignore "region index" parameter in mtd_regioninfo()Brian Norris
ioctl(MEMGETREGIONINFO) has one input parameter (regionindex) and three output parameters (info about the erase region). There are two problems in mtdinfo/libmtd here: 1. mtdinfo.c doesn't initialize its region_info_user struct, instead passing uninitialized data to mtd_regioninfo() 2. mtd_regioninfo() fails to utilize the 'regidx' parameter to fill out the regionindex parameter properly, so the garbage from mtdinfo.c is propagated to the ioctl() This means that mtdinfo will continuously probe the same (possibly out-of-range) erase region, instead of looping over the valid regions. Let's fix this in the mtd_regioninfo() helper, and at the same time, let's zero out the mtdinfo.c buffer, as an additional precaution to keep from using uninitialized data. Initial error report from Yang, when running "mtdinfo /dev/mtd0" on a Cavium 6100 board: root@CN61XX:~# mtdinfo /dev/mtd0 mtd0 Name: phys_mapped_flash Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 128 (8388608 bytes, 8.0 MiB) Minimum input/output unit size: 1 byte Sub-page size: 1 byte Additional erase regions: 0 Character device major/minor: 90:0 Bad blocks are allowed: false Device is writable: true libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 0 error 22 (Invalid argument) Eraseblock region 0: info is unavailable libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 1 error 22 (Invalid argument) Eraseblock region 1: info is unavailable Reported-by: Yang Wei <Wei.Yang@windriver.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2014-10-30ubifs-media.h: include "byteorder.h"Artem Bityutskiy
... in order to have definitions of things like __le16. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-10-30Move mkfs.ubifs/ubifs-media.h to include/mtdArtem Bityutskiy
This file will be shared with the ubidump tool in the future. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-10-20mkfs.ubifs: start using common codeArtem Bityutskiy
Several commonly used macros are now defined in 'common.h', let's start using them in mkfs.ubifs, instead of duplicating them. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-10-20mtd-utils: Add macros to include/common.hhujianyang
This patch adds four macros: ALIGN, __ALIGN_MASK, min_t and max_t to include/common.h. Signed-off-by: hujianyang <hujianyang@huawei.com>
2014-09-16ubiformat: fix the subpage size hint on the error pathArtem Bityutskiy
David Binderman <dcb314@hotmail.com> reports that the following piece of looks wrong: if (!args.subpage_size != mtd->min_io_size) normsg("may be sub-page size is incorrect?"); I totally agree with him and I believe that we actually meant to have no negation in fron to f 'args.subpage_size', so instead, the code should look like this: if (args.subpage_size != mtd->min_io_size) normsg("may be sub-page size is incorrect?"); Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-09-15libmtd: fix mtd_dev_present return value on legacy systemsGuido Martínez
On legacy systems, if "/proc/mtd" doesn't exist or gives a read error, mtd_dev_present returns -1 (since it calls legacy_dev_present), contrary to what's specified in the header file. This causes checks like if (mtd_dev_present(n)) { ... } to give false positives. Fix this by comparing the return value to 1. Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2014-09-08nandtest: fix --reads argumentGuido Martínez
The --reads option specifies the argument as optional, but doesn't check for a null optarg, which means that nandtest segfaults when run as "nandtest --reads". Fix this by making the argument required, and changing the help text to not specify it as optional. Argument -r already specifies the argument as required, so we fix this inconsistency too. Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-05-30nandtest: Introduce multiple reads & check iterationsEzequiel García
The current nandtest performs a simple test which consists of: 1. erase block 2. write data 3. read and verify In order to improve the nandtest strength, this commit adds a new parameter to increase the number of "read and verify" iterations. In other words, the test now consists of: 1. erase block 2. write data 3. read and verify (N times) This seem to apply more pressure on a NAND driver's ECC engine and has been used to discover stability problems with an old OMAP2. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2014-05-05nandtest: Move the "read and compare" code to a functionEzequiel Garcia
This commit makes no functionality change, and simply moves the read and compare code into a separate read_and_compare() function. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-05-05nandtest: Remove redundant checkEzequiel Garcia
This commit removes a redundant 'len' check, which is already performed just after the pread call. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-04-21include/common.h: fix build against recent 0.9.33 uClibcBaruch Siach
An implementation of rpmatch() was backported to the 0.9.33 branch of uClibc. So the uClibc version check introduced in commit 50c9e11f7e (include/common.h: fix build against current uClibc) is not enough. Rename the local rpmatch() implementation to avoid collision. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2014-04-15mtd-utils: integck: Use $(CC) and $(AR) instead of 'gcc' and 'ar' consistentlyMats Kärrman
Not using the macros may be a problem when cross-compiling. Signed-off-by: Mats Karrman <mats.karrman@tritech.se> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-04-15include/common.h: fix build against current uClibcBaruch Siach
Commit dbe0fd17f2 (mtd-utils: new prompt() helper for talking to the user) introduced a rpmatch() call. However, uClibc versions older than (not yet released) 0.9.34 don't have rpmatch() implementation. Add one. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
2014-04-07make_a_release.sh: suggest announcement e-mailArtem Bityutskiy
The 'make_a_release.sh' script appears to be extremely useful - I do not forget things as I used to anymore (amending Makefile, signing, uploading to the FTP server, etc). It is very useful that it suggest me exact commands which I may just copy-past to my command line. This patch improves the script and makes it suggest the e-mail announcement which I may just copy-paste to my command line and the announcement will be sent using 'git send-email' command. It will include all the interested parties in CC. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-04-07Release mtd-utils-1.5.1v1.5.1Artem Bityutskiy
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-04-07ubiformat: correct "non-ubifs" warning messageBrian Norris
UBI's raw flash scan actually scans for UBI data, not UBIFS data (there *are* UBI users that are not UBIFS!), so correct the warning message. This also matches the comment in libscan.h. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-03-31ubi-utils: Fix file descriptor leaks in libubiDaniel van Gerpen
Amended by Artem. Signed-off-by: Daniel van Gerpen <daniel@vangerpen.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-03-31mkfs.ubifs: correct and improve LEB size error printsBrian Norris
The error message is incorrect for "too small LEB size" -- we were printing the minimum I/O size instead of the LEB size. At the same time, let's print the max LEB size along with the message for "too large LEB size", to be consistent and more helpful. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-03-25ubi-utils: Add ubiblock toolEzequiel Garcia
With the addition of block device access to UBI volumes, we now add a simple userspace tool to access the new ioctls. Usage of this tool is as simple as it gets: $ ubiblock --create /dev/ubi0_0 will create a new block device /dev/ubiblock0_0, and $ ubiblock --remove /dev/ubi0_0 will remove the device. Artem: slightly changed the header comment. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-10-26mtd-utils: Makefile: add LDFLAGS_mkfs.ubifsAaron Sierra
The build rule for mkfs.ubifs was missing an LDFLAGS_* variable like mkfs.jffs2 had. This prevented mkfs.ubifs from being built against explicit external libraries which is needed when cross-compiling. This also adds UUIDCPPFLAGS and UUIDLDFLAGS variables to support the mkfs.ubifs build. Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
2013-10-24flash_erase: check the nand typeHuang Shijie
Now, the MTD_NANDFLASH stands for SLC nand, and the MTD_MLCNANDFLASH stands for the MLC nand. This patch includes the stdbool.h, and changes the "isNAND" to boolean type, and checks the right nand type for the MLC and SLC nand. If the user wants to format a MLC nand for JFFS2, we will print out a message to warn him, and exit right now. Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-22check the MLC nand typeHuang Shijie
In the current code, the MTD_NANDFLASH stands for both the SLC and MLC. In the kernel, the MTD_NANDFLASH only stands for the SLC now, so in order to keep the logic unchanged, we should also check the MLC NAND by MTD_MLCNANDFLASH. Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-22flash_otp_write: use helper to check the nandHuang Shijie
Use the mtd_type_is_nand_user() helper to check if it is a NAND (including SLC/MLC). Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-22mtd: mtd-abi: add a helper to detect the nand typeHuang Shijie
The helper is for user applications, and it is just a copy of the kernel helper: mtd_type_is_nand(); Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-22add the MTD_MLCNANDFLASH caseHuang Shijie
The MTD_MLCNANDFLASH case is missed in the current code. This patch adds it. Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-07-01ubiupdatevol: add a --skip optionMike Frysinger
This already has a --size option for controlling how many bytes to read from the input. Add a --skip option to control the offset into the input too. This way people don't have to do `dd | ubiupdatevol`. While we're here, I've fixed the types used with args.size and the read loop so that they can hold the right sizes (like setting a 32bit+ size). Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-07-01nandwrite: amendment to Mike's --input-* seriesArtem Bityutskiy
This is a delta between v1 and v2 of the patches. I pushed v1 instead of picking v2, and this is a fixup. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>