]> www.infradead.org Git - mtd-utils.git/log
mtd-utils.git
14 years agomtd-utils: enable garbage collection of unused function/data sections
Mike Frysinger [Fri, 1 Oct 2010 05:37:14 +0000 (01:37 -0400)]
mtd-utils: enable garbage collection of unused function/data sections

On my default build, this cumulatively shaves off ~100KiB of unused
code and data from the mtd-utils programs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.jffs2: use new xasprintf() helper
Mike Frysinger [Wed, 29 Sep 2010 23:30:24 +0000 (19:30 -0400)]
mkfs.jffs2: use new xasprintf() helper

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: add xasprintf() helper
Mike Frysinger [Thu, 30 Sep 2010 05:28:11 +0000 (01:28 -0400)]
mtd-utils: add xasprintf() helper

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: new memory wrappers
Mike Frysinger [Thu, 30 Sep 2010 05:27:38 +0000 (01:27 -0400)]
mtd-utils: new memory wrappers

The mkfs.jffs2 program has local wrappers for memory related functions
that are useful beyond mkfs.jffs2, so break them out into a common header.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: remove old ubi-utils
Artem Bityutskiy [Tue, 28 Sep 2010 07:47:06 +0000 (10:47 +0300)]
ubi-utils: remove old ubi-utils

The utilities are unmaintained for long time, and many of them
do not even work, just compile, and no on complains about this.
This suggests they are unused and we can now safely kill them.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: Use $(CURDIR) in place of $(PWD)
Kevin Cernekee [Tue, 28 Sep 2010 00:22:04 +0000 (17:22 -0700)]
mtd-utils: Use $(CURDIR) in place of $(PWD)

$(PWD) comes from the shell and may cause unexpected side effects when
using "make -C".

$(CURDIR) is defined internally by GNU make.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: unify flash_erase and flash_eraseall
Mike Frysinger [Mon, 27 Sep 2010 06:50:58 +0000 (02:50 -0400)]
mtd-utils: unify flash_erase and flash_eraseall

These have overlapping functionality, and while flash_eraseall supports
newer 64bit ioctls, flash_erase does not.  So rather than graft support
onto flash_erase, merge the functionality of two into flash_erase so we
only have to support one util from now on.

A simple wrapper is provided to ease old flash_eraseall users into the
new combined flash_erase util.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: new strtoX helpers
Mike Frysinger [Mon, 27 Sep 2010 06:42:28 +0000 (02:42 -0400)]
mtd-utils: new strtoX helpers

Simply usage of converting strings to numbers by adding some wrappers
around the standard strtoX functions.  These helpers simplify the api
of these functions a bit by providing an optional "error" pointer and
automatic error message.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: common.h: clean up PROGRAM_NAME usage
Mike Frysinger [Mon, 27 Sep 2010 06:40:26 +0000 (02:40 -0400)]
mtd-utils: common.h: clean up PROGRAM_NAME usage

Make PROGRAM_NAME required in order to include common.h so we can rely
on it existing.

Further, stop embedding PROGRAM_NAME in every error message so that we
can save string space with it being declare only once.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agorecv_image: fix __USE_GNU hack
Mike Frysinger [Sun, 26 Sep 2010 21:42:29 +0000 (17:42 -0400)]
recv_image: fix __USE_GNU hack

The __USE_GNU define is an internal define that source code should never
be touching.  So switch it to the proper exported _BSD_SOURCE define.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: tweak const strings decls
Mike Frysinger [Sun, 26 Sep 2010 21:41:55 +0000 (17:41 -0400)]
ubi-utils: tweak const strings decls

Shrink the data size a little by declaring addresses of constant strings
instead of pointers to it.

Also slip in static & const on long_options missing them.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agocompr_rtime: fix unused warning
Mike Frysinger [Sun, 26 Sep 2010 21:29:47 +0000 (17:29 -0400)]
compr_rtime: fix unused warning

The rtime logic causes gcc to emit an unused warning about srclen, so
mark it with an unused attribute to shut it up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: standardize PROGRAM_NAME
Mike Frysinger [Sun, 26 Sep 2010 18:48:51 +0000 (14:48 -0400)]
mtd-utils: standardize PROGRAM_NAME

Make sure all the utils define PROGRAM_NAME and do so at the start of
the file so that sub-headers may assume it exists.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonandwrite: Remove redundant 'autoplace' check
Shinya Kuribayashi [Fri, 24 Sep 2010 09:22:53 +0000 (18:22 +0900)]
nandwrite: Remove redundant 'autoplace' check

We're already in 'if (autoplace) { }' block at ths moment.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: new bareverbose() helper
Mike Frysinger [Sat, 25 Sep 2010 06:05:25 +0000 (02:05 -0400)]
mtd-utils: new bareverbose() helper

Add a new helper that lets people do simple verbose output without any
implicit strings added around it.  Good for progress bars and such.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: add lock/unlock helpers
Mike Frysinger [Fri, 24 Sep 2010 01:53:38 +0000 (21:53 -0400)]
libmtd: add lock/unlock helpers

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: use common ARRAY_SIZE
Mike Frysinger [Fri, 24 Sep 2010 01:52:42 +0000 (21:52 -0400)]
mkfs.ubifs: use common ARRAY_SIZE

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: punt duplicate normsg_cont define
Mike Frysinger [Fri, 24 Sep 2010 01:52:38 +0000 (21:52 -0400)]
mtd-utils: punt duplicate normsg_cont define

Looks like someone copied & pasted it twice by accident.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: convert to common.h/min
Mike Frysinger [Fri, 24 Sep 2010 01:52:17 +0000 (21:52 -0400)]
mtd-utils: convert to common.h/min

Kill off duplicated min() defines and convert to the common.h one.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: unify erase block argument checking
Mike Frysinger [Fri, 24 Sep 2010 01:51:53 +0000 (21:51 -0400)]
libmtd: unify erase block argument checking

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonandwrite: add --skipbad to write bad blocks
Mike Frysinger [Thu, 23 Sep 2010 20:04:15 +0000 (16:04 -0400)]
nandwrite: add --skipbad to write bad blocks

Sometimes dumping bad blocks is useful, like when the block isn't actually
bad but the OOB layout isn't what the kernel is expecting or is otherwise
screwed up.  The --skipbad option allows just that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: Fix --squash-rino-perm / --nosquash-rino-perm
Kevin Cernekee [Thu, 23 Sep 2010 22:58:48 +0000 (15:58 -0700)]
mkfs.ubifs: Fix --squash-rino-perm / --nosquash-rino-perm

This addresses a couple of issues:

1) Code was only allowing these options if --root was NOT specified (the
opposite of the documented usage)

2) -q / -Q short options did not work

3) Spacing fixes in the error/warning strings

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibfec: fix up pointer warnings in fec magic computation
Mike Frysinger [Thu, 23 Sep 2010 03:08:03 +0000 (23:08 -0400)]
libfec: fix up pointer warnings in fec magic computation

The current fec code casts a pointer to an int which causes warnings on
64bit systems.  So create a macro for the duplicate/complicated magic
computation, and add an unsigned long cast in it to fix the original
problem.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: compr: drop unused model argument
Mike Frysinger [Thu, 23 Sep 2010 02:53:47 +0000 (22:53 -0400)]
mtd-utils: compr: drop unused model argument

The jffs2 compression framework provides a "model" argument when
compressing and decompressing, but the caller always passes in NULL
and the callees never use it.  So punt this useless overhead.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agocompr_zlib: mark local functions as static
Mike Frysinger [Thu, 23 Sep 2010 02:34:24 +0000 (22:34 -0400)]
compr_zlib: mark local functions as static

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoftl_check: drop unused verbose flag
Mike Frysinger [Thu, 23 Sep 2010 02:33:32 +0000 (22:33 -0400)]
ftl_check: drop unused verbose flag

The verbose flag isn't actually checked anywhere, so punt it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: clean up zlib.h usage a bit
Mike Frysinger [Thu, 23 Sep 2010 02:32:56 +0000 (22:32 -0400)]
mtd-utils: clean up zlib.h usage a bit

Hide zlib's crc32 in compr_zlib.c and mkfs.ubifs/compr.c.

jffs2reader.c and mkfs.jffs2.c don't actually use zlib, so punt the
include from the file.

mkfs.jffs2.c is implicitly using crc32 from zlib.h instead of the
local mtd_crc32, so fix the local usage.  otherwise we get warnings
about undefined crc32 because the file was redirecting the prototype.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agorbtree: avoid redefining offsetof
Mike Frysinger [Thu, 23 Sep 2010 02:13:40 +0000 (22:13 -0400)]
rbtree: avoid redefining offsetof

Newer versions of gcc will define & export offsetof, so we don't
want to unconditionally define it.  Otherwise we hit:
In file included from mkfs.jffs2.c:76:0:
rbtree.h:134:0: warning: "offsetof" redefined
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1/include/stddef.h:411:0: note:
this is the location of the previous definition

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: Fix heap corruption on LEB overrun
Kevin Cernekee [Wed, 22 Sep 2010 23:01:59 +0000 (16:01 -0700)]
mkfs.ubifs: Fix heap corruption on LEB overrun

If max_leb_cnt (-c option) is set too low, set_lprops() will corrupt
the heap and may result in a scary looking crash:

$ bin/mkfs.ubifs -U -r romfs -o ubifs.img -m 512 -e 15360 -c 39
Error: max_leb_cnt too low (241 needed)
*** glibc detected *** bin/mkfs.ubifs: double free or corruption (!prev): 0x088fe070 ***
======= Backtrace: =========
/lib32/libc.so.6(+0x6c231)[0xf75fb231]
/lib32/libc.so.6(+0x6dab8)[0xf75fcab8]
/lib32/libc.so.6(cfree+0x6d)[0xf75ffb9d]
bin/mkfs.ubifs[0x804e801]
bin/mkfs.ubifs[0x804e94b]
bin/mkfs.ubifs[0x804e99d]
/lib32/libc.so.6(__libc_start_main+0xe6)[0xf75a5bd6]
bin/mkfs.ubifs(__fxstat64+0x55)[0x80491e1]
======= Memory map: ========
08048000-0805d000 r-xp 00000000 08:08 10012045                           /work/bin/mkfs.ubifs
0805d000-0805e000 rwxp 00015000 08:08 10012045                           /work/bin/mkfs.ubifs
088fe000-08945000 rwxp 00000000 00:00 0                                  [heap]
f73e1000-f73fe000 r-xp 00000000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
f73fe000-f73ff000 r-xp 0001c000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
f73ff000-f7400000 rwxp 0001d000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
f7400000-f7421000 rwxp 00000000 00:00 0
f7421000-f7500000 ---p 00000000 00:00 0
f751c000-f758f000 rwxp 00000000 00:00 0
f758f000-f76e2000 r-xp 00000000 08:05 426288                             /lib32/libc-2.11.1.so
f76e2000-f76e3000 ---p 00153000 08:05 426288                             /lib32/libc-2.11.1.so
f76e3000-f76e5000 r-xp 00153000 08:05 426288                             /lib32/libc-2.11.1.so
f76e5000-f76e6000 rwxp 00155000 08:05 426288                             /lib32/libc-2.11.1.so
f76e6000-f76e9000 rwxp 00000000 00:00 0
f76e9000-f770d000 r-xp 00000000 08:05 426296                             /lib32/libm-2.11.1.so
f770d000-f770e000 r-xp 00023000 08:05 426296                             /lib32/libm-2.11.1.so
f770e000-f770f000 rwxp 00024000 08:05 426296                             /lib32/libm-2.11.1.so
f772a000-f772c000 rwxp 00000000 00:00 0
f772c000-f772d000 r-xp 00000000 00:00 0                                  [vdso]
f772d000-f7749000 r-xp 00000000 08:05 6062081                            /lib32/ld-2.11.1.so
f7749000-f774a000 r-xp 0001b000 08:05 6062081                            /lib32/ld-2.11.1.so
f774a000-f774b000 rwxp 0001c000 08:05 6062081                            /lib32/ld-2.11.1.so
ffb58000-ffb6d000 rwxp 00000000 00:00 0                                  [stack]
Aborted

New code aborts cleanly, and still calculates the number of LEBs
required:

$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 39
Error: max_leb_cnt too low (241 needed)
$ echo $?
255
$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 240
Error: max_leb_cnt too low (241 needed)
$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 241
$

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomkfs.ubifs: do not override root inode permissions
Artem Bityutskiy [Wed, 8 Sep 2010 08:18:48 +0000 (11:18 +0300)]
mkfs.ubifs: do not override root inode permissions

When mkfs.ubifs is used with -r dir, it does not make the root UBIFS
inode uid/gid/permissions to be equivalent to dir's permissions, but
it makes root inode permissions to be equivalent to uid = git = 0
(root) and permissions = u+rwx go+rx.

Unfortunately, we cannot simply fix this bug, because mkfs.ubifs is
already used in production. Thus, we have introduce --squash-rino-perm
option which is the default and it preserves the old mkfs.ubifs
behavior. We also introduce --nosquash-rino-perm option which fixes
mkfs.ubifs behavior. If none of these options is used, we print a
warning. The plan is to make everyone use one of these options, then
make --nosquash-rino-perm to be the default and remove the warning,
and then eventually deprecate and remove both options.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: rename --nobad to --noskipbad v1.4.0
Wolfram Sang [Mon, 13 Sep 2010 07:15:13 +0000 (09:15 +0200)]
nanddump: rename --nobad to --noskipbad

"nobad" might lead to the assumption that bad blocks are skipped, but this
option does exactly the opposite. Use a more descriptive name.

Reported-by: Jon Povey <Jon.Povey@racelogic.co.uk>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: add --nobad to read bad blocks
Mike Frysinger [Sun, 12 Sep 2010 03:50:27 +0000 (23:50 -0400)]
nanddump: add --nobad to read bad blocks

Sometimes dumping bad blocks is useful, like when the data isn't actually
bad but the OOB layout isn't what the kernel is expecting or is otherwise
screwed up.  The --nobad option allows just that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: drop unused --ignoreerrors option
Mike Frysinger [Sun, 12 Sep 2010 03:50:26 +0000 (23:50 -0400)]
nanddump: drop unused --ignoreerrors option

Nowhere in the nanddump code is the "ignoreerrors" variable used.  So
drop the option completely.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: drop -Werror in old utils
Mike Frysinger [Sun, 12 Sep 2010 03:48:13 +0000 (23:48 -0400)]
ubi-utils: drop -Werror in old utils

Considering this is marked as "old" which is synonymous with "dead",
having the dir cause build failures because of warnings makes no
sense.  So drop the -Werror usage.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: reformat help text to fit in 80 columns
Jon Povey [Thu, 2 Sep 2010 02:48:30 +0000 (11:48 +0900)]
ubi-utils: reformat help text to fit in 80 columns

Reformat the help text of ubiattach and ubidetach to display nicely on
80 column terminals, also fix a couple of bits that did not make sense.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoubi-utils: provide default value for /dev/ubi_ctrl
Jon Povey [Thu, 2 Sep 2010 02:47:53 +0000 (11:47 +0900)]
ubi-utils: provide default value for /dev/ubi_ctrl

Modify ubiattach and ubidetach to default to /dev/ubi_ctrl if not supplied
rather than requiring the user to type it in every time.

Also bump version from 1.0 to 1.1

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolib: fix libcrc32 generation
Artem Bityutskiy [Wed, 1 Sep 2010 11:32:55 +0000 (14:32 +0300)]
lib: fix libcrc32 generation

libcrc32.a was generated without external symbols: nm -g libcrc32.a shoed
nothing. This patch fixes it to make libcrc32.a build to be the same as
libmtd.a. Frankly, I do not know why this happened and why this patch fixes
the issue, sorry for my ignorance. But this works.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agorename crc32 to mtd_crc32
Artem Bityutskiy [Wed, 1 Sep 2010 11:10:21 +0000 (14:10 +0300)]
rename crc32 to mtd_crc32

Because of namespace collisions mkfs.ubifs uses crc32() implementation from
/lib/libz.so.1, which generates incompatible CRC and later on the kernel reports
many CRC errors.

Fix this by re-naming mtd-utils' crc32 function to mtd_crc32.

Reported-by: Jon Povey <Jon.Povey@racelogic.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoflash_eraseall: tweaks to make binary size smaller
Ladislav Michl [Fri, 20 Aug 2010 13:03:13 +0000 (15:03 +0200)]
flash_eraseall: tweaks to make binary size smaller

Returning from main() instead of using exit() makes code more readable
and smaller (ARM EABI binary sizes)

   text    data     bss     dec     hex filename
  28882     436      44   29362    72b2 flash_eraseall
  28827     432      44   29303    7277 flash_eraseall.noexit

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agonanddump: Fix hexdump nybble ordering
Jon Povey [Fri, 20 Aug 2010 08:11:19 +0000 (17:11 +0900)]
nanddump: Fix hexdump nybble ordering

Hex dumps were being printed with the nybbles reversed since
commit 6ff458433ba15b8a7cb258ce64e64e98982df26e
Fix.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
CC: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: fix compiler warnings
Brian Norris [Wed, 18 Aug 2010 16:01:45 +0000 (09:01 -0700)]
mtd-utils: fix compiler warnings

Fixed several compiler warnings, mainly when compiling on 64-bit
architectures (where "size_t"-related types are not necessarily
32-bit).

Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: fix spelling error
Brian Norris [Wed, 18 Aug 2010 16:01:44 +0000 (09:01 -0700)]
mtd-utils: fix spelling error

"fileds" is "fields"

Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd-utils: clean up compile warnings
Kevin Cernekee [Mon, 26 Jul 2010 18:37:19 +0000 (11:37 -0700)]
mtd-utils: clean up compile warnings

gcc 4.4.3 on x86_64:

libcrc32.c:42: warning: ‘static’ is not at beginning of declaration

libfec.c:120: warning: initialization discards qualifiers from pointer target type
libfec.c:121: warning: initialization discards qualifiers from pointer target type

libfec.c:417: warning: passing argument 2 of ‘my_malloc’ discards qualifiers from pointer target type

recv_image.c:164: warning: comparison of unsigned expression < 0 is always false
recv_image.c:170: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
recv_image.c:170: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘long unsigned int’

And many more along the same lines.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agomtd: change flash_eraseall to use libmtd-wrapped ioctls
Kevin Cernekee [Sat, 24 Jul 2010 00:46:15 +0000 (17:46 -0700)]
mtd: change flash_eraseall to use libmtd-wrapped ioctls

ERASE/ERASE64 were tested on 2.6.18 and 2.6.31. OOB is untested.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: add OOB read and write interfaces
Artem Bityutskiy [Sun, 18 Jul 2010 04:26:59 +0000 (07:26 +0300)]
libmtd: add OOB read and write interfaces

This patch is based on Kevin Cernekee's patch posted to the MTD mailing
list. It adds 'mtd_read_oob()' and 'mtd_write_oob()' interfaces support.

The interfaces use MEMREADOOB64/MEMWRITEOOB64 MTD ioctls if possible, and
fall-back to MEMREADOOB/MEMWRITEOOB if the 64-bit versions are not supported.
The information about ioctls support is then cashed in 'offs64_ioctls'
libmtd flag.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agolibmtd: support MEMERASE64
Artem Bityutskiy [Sat, 17 Jul 2010 17:08:33 +0000 (20:08 +0300)]
libmtd: support MEMERASE64

This patch is base on Kevin Cernekee's patch posted to the MTD mailing
list. It adds MEMERASE64 support to the 'mtd_erase()' call. Now it
first tries to use MEMERASE64, and if that is not supported, falls
back to the old MEMERASE ioctl.

This patch also introduces an 'offs64_ioctl' flag to the libmtd
descriptor. However, we cannot initialize it in 'libmtd_open()',
because we need an MTD device node, which we do not have in
'libmtd_open()'. Thus, we firs mark this flag as "uninitialized",
and at the first invocation of 'mtd_erase()' we initialize it.

This also means that we have to pass the limbtd descriptor to
'mtd_erase()', to save the flag value. This, in turn, requires
tweaking 'mtd_erase()' users.

This is not very nice, but good enough so far.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agofix parallel build between ubi-utils and mkfs.ubifs
Mike Frysinger [Tue, 20 Jul 2010 21:27:50 +0000 (17:27 -0400)]
fix parallel build between ubi-utils and mkfs.ubifs

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agonanddump: add "forcebinary" flag
Brian Norris [Mon, 19 Jul 2010 17:33:16 +0000 (10:33 -0700)]
nanddump: add "forcebinary" flag

Restrict binary dumping so that by default, binary garbage is not
printed directly to a terminal. Output redicted to files or piped to
other commands should not be affected (as judged by "isatty(ofd)").
A new flag "-a" or "--forcebinary" is included so that users can
override this behavior if necessary.

Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agonanddump: add canonical (hex+ascii) flag
Brian Norris [Mon, 19 Jul 2010 17:33:15 +0000 (10:33 -0700)]
nanddump: add canonical (hex+ascii) flag

Added the "-c" or "--canonicalprint" flag (modelled off 'hexdump -C')
so that users can choose to print ASCII output next to the prettyprint
output. This is really an extension to the prettyprint option, so the two
options do not conflict if they are both included in the same execution.

Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agonanddump: robust pretty hexdump
Brian Norris [Mon, 19 Jul 2010 17:33:14 +0000 (10:33 -0700)]
nanddump: robust pretty hexdump

Adapted code from the linux kernel hex_dump_to_buffer() (lib/hexdump.c)
to provide a more robust hexdump for the pretty option. Now, nanddump
can print out any size of OOB (or page for that matter...) without
having to worry about non-multiples of 16.

This also provides ability to dump ASCII format next to the hex output
once additional command-line flags are added.

Tested with Samsung K9GAG08U0D

Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agonandtest: Fixed indentation
Brian Norris [Thu, 8 Jul 2010 20:50:08 +0000 (13:50 -0700)]
nandtest: Fixed indentation

Replaced tabs with spaces in the help message for nandtest to
fix problems with varying indentation and to provide consistency
with other utils in the set.

Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agomkfs.jffs2: fixed warnings
Brian Norris [Thu, 8 Jul 2010 20:50:07 +0000 (13:50 -0700)]
mkfs.jffs2: fixed warnings

Changed "char*" to "const char*" in certain function argument lists
to prevent compiler warnings for passing a hard-coded string.

Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agonanddump: increase max OOB size
Brian Norris [Thu, 8 Jul 2010 20:50:04 +0000 (13:50 -0700)]
nanddump: increase max OOB size

Supported OOB and page sizes can now be changed more easily by a
macro constant. NAND_MAX_OOBSIZE needed increased to support 218
and 224 byte OOB.

Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agomkfs.jffs2: fix integer underflow in jffs2_rtime_compress()
Enrico Scholz [Thu, 24 Jun 2010 13:02:40 +0000 (15:02 +0200)]
mkfs.jffs2: fix integer underflow in jffs2_rtime_compress()

When '*dstlen' is 0 or 1, comparison will return wrong result.  Reported
by valgrind as

==5919== Invalid write of size 1
==5919==    at 0x40564E: jffs2_rtime_compress (compr_rtime.c:51)
==5919==    by 0x40676B: jffs2_compress (compr.c:246)
==5919==    by 0x403EE4: recursive_populate_directory (mkfs.jffs2.c:884)
==5919==  Address 0x4e1bdb1 is 0 bytes after a block of size 1 alloc'd
==5919==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==5919==    by 0x40671C: jffs2_compress (compr.c:229)
==5919==    by 0x403EE4: recursive_populate_directory (mkfs.jffs2.c:884)

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibs: remove ubiutils-specific stuff from common.h
Artem Bityutskiy [Sat, 17 Jul 2010 07:04:56 +0000 (10:04 +0300)]
libs: remove ubiutils-specific stuff from common.h

Now include/common.h contains things that really everyone can use.
And all the stuff specific to ubi-utils is in ubi-utils/include/ubiutils-common.h

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agomkfs.ubifs: fix compilation warning
Artem Bityutskiy [Sat, 17 Jul 2010 06:45:03 +0000 (09:45 +0300)]
mkfs.ubifs: fix compilation warning

Fix the following warning:
mkfs.ubifs.c: In function ‘add_dent_node’:
mkfs.ubifs.c:1172: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘ino_t’
mkfs.ubifs.c:1172: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 6 has type ‘ino_t’

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibs: make crc32 and fec to be libraries
Artem Bityutskiy [Sat, 17 Jul 2010 06:43:08 +0000 (09:43 +0300)]
libs: make crc32 and fec to be libraries

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoAdd forgotten Makefile
Artem Bityutskiy [Sat, 17 Jul 2010 06:32:19 +0000 (09:32 +0300)]
Add forgotten Makefile

My fault, forgot to run git add.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agomtd-utils: update to latest mtd-abi.h from kernel.org
Kevin Cernekee [Thu, 8 Jul 2010 00:30:12 +0000 (17:30 -0700)]
mtd-utils: update to latest mtd-abi.h from kernel.org

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agomtd-utils: move libmtd source files to lib/ subdirectory
Kevin Cernekee [Thu, 8 Jul 2010 00:30:10 +0000 (17:30 -0700)]
mtd-utils: move libmtd source files to lib/ subdirectory

Source files for libmtd, crc32, and fec are scattered throughout the
tree.  Move them to a central location so they can be built into a
common "libmtd.a" library used by all mtd-utils programs.

This patch only renames/deletes files and does not change the content.

Also modify the build system and source code so that libmtd.a can be built
from a "common" location (lib/).  Statically link all utilities at the top
level with libmtd.a . Minor changes to mkfs.ubifs to allow using the common
crc32 implementation.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibscan: rename hdr to ech
Artem Bityutskiy [Wed, 16 Jun 2010 06:47:27 +0000 (09:47 +0300)]
libscan: rename hdr to ech

... to make it clear that this is EC header, not VID header.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubi-test: seed the random genrator in tests
Artem Bityutskiy [Tue, 15 Jun 2010 11:01:31 +0000 (14:01 +0300)]
ubi-test: seed the random genrator in tests

Add a common seed_random_generator() and make tests use it
for seeding the random generator.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubi-tests: use rand instead of random in io_paral
Artem Bityutskiy [Tue, 15 Jun 2010 10:31:16 +0000 (13:31 +0300)]
ubi-tests: use rand instead of random in io_paral

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubi-tests: remove some junk from the integ test
Artem Bityutskiy [Tue, 15 Jun 2010 10:30:46 +0000 (13:30 +0300)]
ubi-tests: remove some junk from the integ test

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubi-utils: harmonize mtd device node variables
Artem Bityutskiy [Tue, 15 Jun 2010 10:03:14 +0000 (13:03 +0300)]
ubi-utils: harmonize mtd device node variables

Consistently use 'mtd_dev_node' to name variables consining
MTD device node path.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubi-utils: harmonize libmtd interface a bit
Artem Bityutskiy [Tue, 15 Jun 2010 09:53:00 +0000 (12:53 +0300)]
ubi-utils: harmonize libmtd interface a bit

Let's consistently use 'mtd_num' name for MTD device number. At the
moment some code uses 'mtd_num', other 'dev_num'. Harmonize that.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibubigen: make init_vid_hdr externally visible
Artem Bityutskiy [Mon, 14 Jun 2010 12:19:12 +0000 (15:19 +0300)]
libubigen: make init_vid_hdr externally visible

ubi-tests need it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibubigen: move header comments
Artem Bityutskiy [Mon, 14 Jun 2010 10:40:46 +0000 (13:40 +0300)]
libubigen: move header comments

To be consistent with other ubi libraries, move header comments
to the .h file.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibubigen: do not create huge arrays on stack
Artem Bityutskiy [Mon, 14 Jun 2010 10:33:39 +0000 (13:33 +0300)]
libubigen: do not create huge arrays on stack

Stop creating 128KiB and larger arrays on stack - allocate RAM
using malloc() instead.

This patch also teaches libubigen to always set errno.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibmtd: add mtd_write_img
Artem Bityutskiy [Mon, 14 Jun 2010 10:25:07 +0000 (13:25 +0300)]
libmtd: add mtd_write_img

Add another helper interface which can be used to write an image
to an mtd device.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubi-tests: add normsg
Artem Bityutskiy [Mon, 14 Jun 2010 08:35:26 +0000 (11:35 +0300)]
ubi-tests: add normsg

Just like we have in ubi-utils.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubi-tests: teach errmsg and failed return error code
Artem Bityutskiy [Mon, 14 Jun 2010 07:06:05 +0000 (10:06 +0300)]
ubi-tests: teach errmsg and failed return error code

Just like we do in ubi-utils.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubi-tests: rename err_msg to errmsg
Artem Bityutskiy [Mon, 14 Jun 2010 07:03:34 +0000 (10:03 +0300)]
ubi-tests: rename err_msg to errmsg

For consistency with ubi-utils.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibubi: provide mtd number in UBI device information
Artem Bityutskiy [Mon, 14 Jun 2010 04:55:14 +0000 (07:55 +0300)]
libubi: provide mtd number in UBI device information

Add an 'mtd_num' field to the UBI device information structure.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibubi: remove few fields from volume info
Artem Bityutskiy [Mon, 14 Jun 2010 05:00:18 +0000 (08:00 +0300)]
libubi: remove few fields from volume info

Remove the 'dev_major' and 'dev_minor' fields from the volume
information structure, because these fields should be provided
by the device information structure.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agomtd-utils: support 4096+64 page sizes
Enric Balletbo i Serra [Tue, 18 May 2010 09:53:59 +0000 (11:53 +0200)]
mtd-utils: support 4096+64 page sizes

Add support for oobsize 64 and writesize 4096 in nanddump & nandwrite.

Artem: some more info from further e-mail exchange:

> Are there flashes with the 4096 page / 64 spare combination? Could you
> refer to one? May be any URL? I thought 4096 comes with 128.

Much to my regret I can't provide a URL because is not public. IGEP v2
board has a Onenand with two dice of 2048/64 spare combination but mtd
views 4096/64. The minimal write page is 4K (2K from first dice and 2K
from second dice).

Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agonandwrite: check if the start address is page-aligned
Stanley.Miao [Tue, 18 May 2010 12:23:10 +0000 (20:23 +0800)]
nandwrite: check if the start address is page-aligned

Only page-aligned address is permitted in NAND subsystem.

Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agonandwrite: fix the bug of writing a yaffs2 image to NAND
Stanley.Miao [Tue, 18 May 2010 12:23:09 +0000 (20:23 +0800)]
nandwrite: fix the bug of writing a yaffs2 image to NAND

The tool mkyaffs2image doesn't know the oob layout of a NAND flash, so it
puts the yaffs2 tags at the offset 0 of oob area, as a result, the image
generated by mkyaffs2image is different with the image dumped by nanddump.
Now adding a parameter "-r" for nandwrite to differentiate these images.

Write a image generated by mkyaffs2image:
$> nandwrite -a -o /dev/mtd3 yaffs2.bin

Write a image dumped by nanddump:
$> nandwrite -a -r /dev/mtd3 image.bin

Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoMerge branch 'master' of git://git.infradead.org/mtd-utils
Artem Bityutskiy [Sat, 22 May 2010 05:32:23 +0000 (08:32 +0300)]
Merge branch 'master' of git://git.infradead.org/mtd-utils

15 years agonanddump: Support 4096+218 and 4096+224 page sizes
Kevin Cernekee [Tue, 4 May 2010 04:14:39 +0000 (21:14 -0700)]
nanddump: Support 4096+218 and 4096+224 page sizes

Tested with Samsung K9GAG08U0D.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoMerge branch 'master' of ssh://git.infradead.org/srv/git/mtd-utils
Artem Bityutskiy [Wed, 5 May 2010 11:15:43 +0000 (14:15 +0300)]
Merge branch 'master' of ssh://git.infradead.org/srv/git/mtd-utils

15 years agoRevert "UBI: sync ubi-user.h with the lates kernel verion"
Artem Bityutskiy [Tue, 27 Apr 2010 07:32:42 +0000 (10:32 +0300)]
Revert "UBI: sync ubi-user.h with the lates kernel verion"

This reverts commit 13b77ef356e876f42f489f6a08840e12847135c5.

We do not support block devices. This patch was pushed by accident.

15 years agoubiattach/ubidetach: add support to attach/detach by path
Mika Westerberg [Mon, 1 Feb 2010 09:03:48 +0000 (10:03 +0100)]
ubiattach/ubidetach: add support to attach/detach by path

Now there is a new option '-p' (or '--dev-path') that can be used to pass path
to a MTD device node.

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibubi: add support to attach/detach by MTD device path
Mika Westerberg [Mon, 1 Feb 2010 09:03:47 +0000 (10:03 +0100)]
libubi: add support to attach/detach by MTD device path

struct ubi_attach_request now has additional field 'dev' that can contain path
to the MTD device node in the filesystem. Also there are two new functions that
are able to handle path to the MTD device node:

ubi_attach() - attach MTD device by number or by path
ubi_detach() - detach MTD device by path

ubi_attach() works like ubi_attach_mtd() when it is passed empty req->dev,
otherwise it looks up correct MTD device number based on the given device node
path.

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoUBI: sync ubi-user.h with the lates kernel verion
Mika Westerberg [Thu, 28 Jan 2010 13:26:57 +0000 (15:26 +0200)]
UBI: sync ubi-user.h with the lates kernel verion

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubinfo: document the new -N option
Artem Bityutskiy [Thu, 8 Apr 2010 08:48:08 +0000 (11:48 +0300)]
ubinfo: document the new -N option

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubinfo: add -N option to get info by name of ubi volume
Jon Ringle [Tue, 23 Mar 2010 15:16:12 +0000 (11:16 -0400)]
ubinfo: add -N option to get info by name of ubi volume

Signed-off-by: Jon Ringle <jon@ringle.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agomtd_debug: fix creation mode parameter
Ferenc Wagner [Sun, 7 Mar 2010 21:15:58 +0000 (22:15 +0100)]
mtd_debug: fix creation mode parameter

creat(2) expects a creation mode parameter, not an open flag.

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agonandtest: fix --keep argument
Radoslav Kolev [Thu, 25 Feb 2010 13:58:10 +0000 (15:58 +0200)]
nandtest: fix --keep argument

When called with the --keep argument nandtest is supposed to restore the
original content after testing, but currently it doesn't. The patch
below fixes the problem.

Signed-off-by: Radoslav Kolev <radoslav.kolev@rnd.bg>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agomkfs.jffs2: fix --enable-compressor
Adrian Bunk [Wed, 24 Feb 2010 13:32:29 +0000 (15:32 +0200)]
mkfs.jffs2: fix --enable-compressor

The short option -X was working, but the documented long option
--enable-compressor was missing.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubiattach/ubidetach: add support to attach/detach by path
Mika Westerberg [Mon, 1 Feb 2010 09:03:48 +0000 (10:03 +0100)]
ubiattach/ubidetach: add support to attach/detach by path

Now there is a new option '-p' (or '--dev-path') that can be used to pass path
to a MTD device node.

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agolibubi: add support to attach/detach by MTD device path
Mika Westerberg [Mon, 1 Feb 2010 09:03:47 +0000 (10:03 +0100)]
libubi: add support to attach/detach by MTD device path

struct ubi_attach_request now has additional field 'dev' that can contain path
to the MTD device node in the filesystem. Also there are two new functions that
are able to handle path to the MTD device node:

ubi_attach() - attach MTD device by number or by path
ubi_detach() - detach MTD device by path

ubi_attach() works like ubi_attach_mtd() when it is passed empty req->dev,
otherwise it looks up correct MTD device number based on the given device node
path.

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agobuild: add option to not force largefile support
Peter Korsgaard [Wed, 3 Feb 2010 09:18:46 +0000 (10:18 +0100)]
build: add option to not force largefile support

Not all systems have largefile support (E.G. uClibc depending on config),
so unconditionally enforcing largefile breaks the build.

Work around it by adding a WITHOUT_LARGEFILE flag, similar to the existing
WITHOUT_XATTR.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubiformat: boost version to 1.5 v1.3.1
Artem Bityutskiy [Fri, 15 Jan 2010 17:04:21 +0000 (19:04 +0200)]
ubiformat: boost version to 1.5

We fixed the sequence numbers bug, which is quite serious.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubiformat: be consistent with sequence numbers
Artem Bityutskiy [Sat, 9 Jan 2010 23:39:24 +0000 (01:39 +0200)]
ubiformat: be consistent with sequence numbers

This commit fixes a stupid an nasty bug. When we flash an UBI image,
we do not change its sequence numbers. But when we format the rest
of the PEBs (beyond the flashed image), we use a random (or specified
via cmdline) sequence number. As a result, we have a broken flash
format and UBI refuses it, because half of it has one sequence number,
another half has a different one.

What we have to do instead, we have to substitute image's sequence
number with ours.

Reported-by: Jeff Angielski <jeff@theptrgroup.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tested-by: Jeff Angielski <jeff@theptrgroup.com>
15 years agoubiformat: always initialize seq number
Artem Bityutskiy [Sat, 9 Jan 2010 23:33:31 +0000 (01:33 +0200)]
ubiformat: always initialize seq number

For some reasons sequence number was set to 0 in some case, which
is wrong.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubiformat: be consistent with sequence numbers
Artem Bityutskiy [Sat, 9 Jan 2010 23:39:24 +0000 (01:39 +0200)]
ubiformat: be consistent with sequence numbers

This commit fixes a stupid an nasty bug. When we flash an UBI image,
we do not change its sequence numbers. But when we format the rest
of the PEBs (beyond the flashed image), we use a random (or specified
via cmdline) sequence number. As a result, we have a broken flash
format and UBI refuses it, because half of it has one sequence number,
another half has a different one.

What we have to do instead, we have to substitute image's sequence
number with ours.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubiformat: always initialize seq number
Artem Bityutskiy [Sat, 9 Jan 2010 23:33:31 +0000 (01:33 +0200)]
ubiformat: always initialize seq number

For some reasons sequence number was set to 0 in some case, which
is wrong.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubiformat: fix error message v1.3.0
Artem Bityutskiy [Wed, 9 Dec 2009 14:42:59 +0000 (16:42 +0200)]
ubiformat: fix error message

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
15 years agoubiformat: check that min IO size is power of 2
Artem Bityutskiy [Wed, 9 Dec 2009 14:31:41 +0000 (16:31 +0200)]
ubiformat: check that min IO size is power of 2

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>