aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2009-04-18ubiformat: fix segfault and messagesArtem Bityutskiy
ubiformat segfaults like this: ubiformat: mtd0 (NAND), size 134217728 bytes (128.0 MiB), 16384 eraseblocks of 16384 bytes (16.0 KiB), min. I/O size 512 bytes libscan: scanning eraseblock 8191 -- 100 % complete ubiformat: 8190 eraseblocks have valid erase counter, mean value is 9 ubiformat: 2 eraseblocks are supposedly empty ubiformat: warning!: VID header and data offsets on flash are 512 and 1024, which is different to calculated offsets 256 and 512 ubiformat: use new offsets 512 and 1024? (yes/no) no Segmentation fault The reason is that volume table size is calculated for 256/512 layout, and when user chooses 512/1024 - it is not re-calculated which leads to segfault in 'ubigen_write_layout_vol()'. This patch also fixes the message - in the above output new offsets are 256/512, not 512/1024. Also, this patch adds explicit printing of the selected positions. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libmtd: amend interfaceArtem Bityutskiy
Remove the fd field from the mtd information data structure, because libmtd does not really know the device node file name, and serves only as a place to save the descriptor. The callers should find a better place. This patch improves code readability and prepares for further changes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: remove unnecessary header filesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: amend included header filesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: remove useless variableArtem Bityutskiy
We know that sysfs is always at /sys, so we do not have to store it in lib->sysfs. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: remove incorrect commentArtem Bityutskiy
sysfs if guaranteed to be in /sys. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libubi: spelling fixesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-04-18libmtd: move comments to headersArtem Bityutskiy
Just for the sake of being consistent with libubi, move the comments for API functions to the header file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-31ubi-utils: tweak vpath handlingMike Frysinger
Building out of tree currently fails with ubi-utils because make gets confused and can't figure out the vpathed .c files. Using VPATH rather than vpath seems to work around it. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-03-30libubigen: don't define large array on stacksonic zhang
On nommu arch, local stack size is very limited and can't be enlarged on demand. So, don't define large array on local stack. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
2009-03-27libmtd: fix mtd_is_bad return codeRoger Quadros
Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-26ubiformat: mark faulty blocks as badRoger Quadros
Few minor amendments by Artem. And increase the utility version number. Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-03-17ubi-utils: re-arrange directory layoutArtem Bityutskiy
Move new-utils to ubi-utils and old ones to ubi-utils/old-utils. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-27make sure compiler supports warning flagsMike Frysinger
Some compilers (like gcc-3.3) don't support all the newer -W flags that we are using. So import the compiler check found in the kernel and test each flag we add. The := is important so we only do the compiler tests once per `make` rather than every time we compile a file. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-26Add generated binaries to gitignoreMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-24mkfs.jffs2: fix lzo usage on 64bit systemsSebastian Andrzej Siewior
the compress size parameter in lzo is defined in the header file as lzo_uint. This looks very much like uint32_t, I know, but is defined as unsigned long. So on 64bit LE systems we zero some bytes near by and on BE systems we get a size of zero. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: add ubirename utilityRichard Titmuss
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: add forgotten ubi-media.hArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: update ubi-header.hArtem Bityutskiy
Take the latest version from the kernel, where it was renamed to ubi-media.h. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-18UBI: update ubi-user.hArtem Bityutskiy
Just take the latest version from the kernel. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-17mtd-utils: handle non-power-of-2 erase sizePeter Korsgaard
E.g., this is needed for DataFlash. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-12mkfs.ubifs: eliminate compiler warningsAdrian Hunter
The warnings were: lpt.c: In function ‘create_lpt’: lpt.c:552: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long int’ mkfs.ubifs.c: In function ‘do_openat’: mkfs.ubifs.c:251: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result mkfs.ubifs.c: In function ‘get_options’: mkfs.ubifs.c:542: warning: format not a string literal and no format arguments Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-11Artem Bityutskiy said once:linux-mtd-owner@lists.infradead.org
|I mean, IMO most of these warnings are not really sane, and cleaning |that up just adds mess - you stop understanding why is something signed |or unsigned :-) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-02-11I have here a mtd part which is 3 GiB with a flash page size of 256KiB.linux-mtd-owner@lists.infradead.org
The 2GiB limit is at erase block 8192. In mtd_is_bad() the computation for the MEMGETBADBLOCK ioctl() looks like the following: | seek = eb * mtd->eb_size; with both eb and mtd->eb_size being a signed int results in seek being a signed result. The _FILE_OFFSET_BITS=64 define is required to switch off_t from 32bit to 64bit an 32bit systems. This is required in order to keep using lseek() as lseek64 on 32bit system. Without this change lseek() in mtd_read() is called with a 32bit value with most significat bit set and the kernel performs a sign extension for the 64bit value which is used in the mtd layer. The last change also changes the size of the parameter which is passed to the MEMGETBADBLOCK ioctl() from 32 to 64bit. The counter part in kernel is also defined as loff_t which is of type __kernel_loff_t and this is "long long". So this must have been broken for a while unless I missed something. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-28mkfs.ubifs: update program version to 1.2Artem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-28mkfs.ubifs: support reserved space allocationArtem Bityutskiy
UBIFS may reserve some amount of flash space for the super-user, ant this amount is stored in the superblock. Currently mkfs.ubifs always puts 0 there. This patch adds -R option which may be used to specify size of the reserved space. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-20ubiupdatevol: fix -t parameterSebastian Andrzej Siewior
The execution of |./ubiupdatevol /dev/ubi0 -t will fail because 'argv[optind + 1]' is undefined and the later executed 'strcmp(args.img, "-")' will segfault. So I can hack around and supply a dummy image or fix it that way. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-16ubi-tests: fix build and some warningsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-16mkfs.ubifs: fix various warningsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-16ubi-utils: fix compilation warningsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-16ubiformat: nicify error messagesArtem Bityutskiy
In case of error, ubiformat prints error messages at the same line as the previous messages. Fix this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-15ubi-utils: minor printing fixArtem Bityutskiy
Add missing whitespace in ubimkvol help output Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-14fs-tests: fix remounting in integckArtem Bityutskiy
Teach integck properly save original mount options. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-13common.mk: tweak rules to workaround make-3.80 bugsMike Frysinger
I got some reports from people who use make-3.80 that mtd-utils wasn't building correctly the first time. Turns out that older versions of make misbehave with pattern rules and full paths. So I've tweaked the code a little to work with make-3.80 and make-3.81 (the latest release). Also, I added a small optimization to avoid running `mkdir` when building in-tree. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2009-01-13ubi-utils: fix warning in fprintf() codeMike Frysinger
When building with gcc security warnings enabled, the ubimirror.c code triggers this warning: ./src/ubimirror.c: In function 'main': ./src/ubimirror.c:206: error: format not a string literal and no format arguments Since the buffer in question should be a straight string anyways, avoid ugly printf exploits by outputting the string indirectly: printf("%s", buffer) Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-27mkfs.jffs2: fix dir creation in /Mike Frysinger
With older mtd-utils, creating a directory in the root worked fine. With current git, the parent dir search algo breaks this. For example, just take the current git tree, build it up, and then run: $ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null mkfs.jffs2: skipping device_table entry '/dev': no parent directory! mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory! ... Doing `mkdir ./dev` first works around the issue, but where's the fun in that. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-26nandwrite: correct data readingArtem Bityutskiy
The "read" syscall does not necessarily return all the requested data, in which case the caller has to try again and read more. Take this into account when reading input data. This patch is an improved vestion of the original patch sent by Hai Zaar. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Tested-by: Hai Zaar <haizaar@codefidence.com>
2008-12-22Unify all common build system partsMike Frysinger
Rather than duplicating the same thing over and over in every Makefile, move it all to common.mk. Other things fixed here: - doing subdirs in parallel - fix src!=build compiling in subdirs Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-16libubi: remove some too verbose messagesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-10libubi: be more verbose about errorsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-10ubi-utils: fix up build systemMike Frysinger
The previous change with CFLAGS handling was not entirely correct. So fix CFLAGS/CPPFLAGS/LDFLAGS to work like standard build systems (i.e. autotools) and change `ranlib` to $(RANLIB) to fix cross-compiling. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-09mkfs.ubifs: fix "smal" typoMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-09ubiformat.c: fix printf(%d, size_t) warningMike Frysinger
A size_t should be printed using %zu (unsigned size_t) rather than %d. This fixes the following warning on my system: gcc -O2 -Werror -Wall -Iinclude -Isrc -I../../include src/ubiformat.c -c -o ubiformat.o cc1: warnings being treated as errors src/ubiformat.c: In function ‘read_all’: src/ubiformat.c:345: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’ src/ubiformat.c:352: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’ make: *** [ubiformat.o] Error 1 Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-08ubi-utils: various fixesTom Rini
gcc-4.3.x introduces a number of new warnings (and we use -Werror) for things like not checking scanf return values and not using explicit formatting. Finally, it caught that we were overflowing our own buffer in unubi.c, so increate the variable size as we want to declare and clear PATH_MAX + 1, then use only PATH_MAX of the variable. Signed-off-by: Tom Rini <trini@embeddedalley.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-05mkfs.ubifs: clean the hashtable target as wellSebastian Andrzej Siewior
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-12-02Separate '-m' and the mode with a space when invoking 'install'Enrico Scholz
Some 'install' versions (e.g. this of OpenEmbedded) require the mode to be a separate argument and don't understand the '-m0755' syntax: .../staging/x86_64-linux/usr/bin/install-sh: ./-m0755 does not exist. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-11-21ubi-utils: fix CFLAGS handling wrt cross compilationNicolas Pitre
Let's have the "new ubi-utils" makefile handle CFLAGS like the other makefiles. This is important when cross compiling and CFLAGS is externally provided. Without this, local include files are not found due to the various -I arguments which are then lost. Signed-off-by: Nicolas Pitre <nico@marvell.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-11-21flash_eraseall reports incorrect percentageLadislav Michl
Fix flash_eraseall percentage reporting: # flash_eraseall /dev/mtd4 Erasing 128 Kibyte @ 2800000 -- 100 % complete. flash_eraseall * fix percentage reporting * exit()ing from main() is overkill, just return Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-11-06ubinize: correct subpage_size print and initialise vol_info to zeroAdrian Hunter
J. Scott Merritt wrote: > Dear list, > > I believe that I have stumbled upon two problems with the latest version > of ubinize.c in mtd-utils - one serious, and one not so serious. > > - First, the easy one: At line 457, I believe that we should be printing > args.subpage_size rather than ui.min_io_size. > > - More seriously, I believe that the "flags" field in the ubigen_vol_info > structures is not being properly initialized. Line 494 allocates memory > for these structures with malloc, so they are not cleared to zero. The > read_section function updates the flag field if the AUTO-RESIZE flag is > specified, but does not otherwise initialize or clear it. > > I reckon the latter problem could be repaired either with calloc, or by > modifying read_section to more directly set/clear the flag. > > Thanks, Scott. Reported-by: J. Scott Merritt <merrij3@rpi.edu> Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-10-23mkfs.ubifs: make program version 1.1.Artem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>