summaryrefslogtreecommitdiff
path: root/ubi-utils
AgeCommit message (Collapse)Author
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-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-18UBI: add ubirename utilityRichard Titmuss
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-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-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-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-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-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-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-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-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-09-24ubinize: allow an absent 'image' in the ubinize configuration.Richard Titmuss
Some recent changes to ubinize prevent the 'image' parameter from being absent in the configuration file. The following patch fixes that. Signed-off-by: Richard Titmuss <richard.titmuss@logitech.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-09-05ubiupdatevol: remove non-existing option from help messageArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-09-03ubirmvol: learn to remove volume by nameArtem Bityutskiy
Add -N option to ubirmvol to support deleting volumes by name. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-09-02ubi-utils: minor renameArtem Bityutskiy
We use term "volume ID", not "volume number". So change few vol_num variables to vol_id to be consistent. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-09-02ubimkvol: check for free LEBsArtem Bityutskiy
Check for free LEBs before trying to create a volume. This fixes the following issue: $ ubimkvol /dev/ubi0 -n 0 -N test_fs -m ubimkvol: error!: cannot UBI create volume error 22 (Invalid argument) Error: cannot create UBI volume "Invalid argument" ? Not understandable. But the thing is that -m makes ubimkvol use available space, which is zero, then it passes zero to the ioctl, which fails in request validation code, because 0 invalid volume size. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-09-02ubiattach: minor help text fixArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-08-26ubi-utils: added missing linefeed in 'ubinfo'Enrico Scholz
Trivial patch to add a missing linefeed in static volume info: | Data bytes: 113112 bytes (110.5 KiB)State: OK Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-08-26ubi-utils: allow 'ubiformat' to read from stdinEnrico Scholz
This patch allows to read the image from stdin and adds an '--image-size' option to specify its size. 'upiupdatevol' has this feature already and it is useful for 'ubiformat' too. It adds a read_all() function which reads a block of data. Plain 'read(2)' can fail on nc -l -p 1234 | ubiformat -f - -S 25427968 else. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-08-26ubi-utils: fixed and enhanced '--flash-image' optionEnrico Scholz
The '--flash-image' option of 'ubiformat' requires an argument and '.has_arg' must not be 0 hence. The patch adds this option to the commandline synopsis too. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-08-25ubi-utils: use 'stat(2)' instead of 'lstat(2)'Enrico Scholz
The UBI tools refuse to work with symlinks like '/dev/ubi/bootloader -> ../ubi0_2' because they use 'lstat(2)' and get information about the symlink but not about the device. This is unwanted and fixed by this patch. This patch renames 'struct stat stat' variables to 'st' to avoid compilation errors. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-08-21use $(MAKE) rather than makeMike Frysinger
If you execute straight `make`, this prevents the active make env from being passed on to sub children. This prevents parallel building as well as build flag passing. I also dropped the recursive make in ubi-utils/Makefile for the all target as this causes problems when building in parallel. All of the targets that we actually care about are handled by the $(NTARGETS) target anyways. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-08-20mtd-utils: enable parallel build processSebastian Siewior
-j 2 build was not possible without this patch. Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-07-28ubinize: fix static volumes generationArtem Bityutskiy
When static volumes is generated, the 'used_ebs' field of VID header has to be calculated based on image file size, not on the volume size. Fix this. This patch also improves error reporting a little and re-arrages the code so that all the validation is done in 'read_section()' Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-07-08uninize: add more ini-file validationArtem Bityutskiy
Check that volume names and IDs are unique Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-07-08ubinize: validate number of sectionsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-06-27ubiupdatevol: minor tweakv1.2.0Artem Bityutskiy
Undo my weird change which slipped accidentally to the commit. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-06-27ubiupdate: support reading from stdioHamish Moffatt
1. Adds -s/--size switch; 2. Allows the image file to be specified as '-', meaning stdin; if used, the size must be specified. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-06-25ubiformat: reverse question about vid offset changeBernard Blackham
Users can pass the -O option to ubiformat to override the VID header offset on the command-line. If for some reason, the new offset does not match what is on flash, ubiformat currently prompts the user if they'd rather use the *old* offsets. This means that calling ubiformat with --yes will not do what was requested on the command-line. This patch reverses the question so --yes is actually useful for running in batch-mode. Signed-off-by: Bernard Blackham <bernard@largestprime.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-06-18respect CFLAGS/CPPFLAGS from build environmentMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Josh Boyer <jwboyer@gmail.com>
2008-05-29ubi-utils: fix typo in ubiformatArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-05-16ubi-utils: remove unnecessary ubinize warningArtem Bityutskiy
... and fix help message. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-05-16ubi-utils: add ubiformat to MakefileArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-05-13ubi-utils: fixe ubiupdatevolArtem Bityutskiy
-t option does not require image file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-23ubi-utils: fix long optionsArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-23ubi-utils: make sure only one volume is auto-resizeArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-23ubi-utils: improve input parameters checksArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-23mtd-utils: fix input parameter checksArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-21ubi-utils: fix percent output in ubiformatArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-21ubi-utils: fix the output printArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>