Commit Graph

10 Commits

Author SHA1 Message Date
Tom Rini
1341533778 cmd/ubi.c: Fix format warning
On 64bit platforms we would otherwise see:
../cmd/ubi.c: In function 'ubi_volume_read':
../cmd/ubi.c:359:16: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'size_t {aka long unsigned int}' [-Wformat=]

Fixes: 68c7025d99 ("cmd: ubi: print load size after establishing volume size")
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-07-26 11:43:30 -04:00
Stefan Roese
4a94e53b23 cmd: ubi: Add additional message upon UBI attach error
When trying to attach an UBI MTD partition via "ubi part", it may happen
that the MTD partition defined in U-Boot (via mtdparts) is not big
enough than the one, where the UBI device has been created on. This
may lead to errors, which are not really descriptive to debug and
solve this issue, like:

ubi0 error: vtbl_check: too large reserved_pebs 1982, good PEBs 1020
ubi0 error: vtbl_check: volume table check failed: record 0, error 9

or:

ubi0 error: init_volumes: not enough PEBs, required 1738, available 1020
ubi0 error: ubi_wl_init: no enough physical eraseblocks (-718, need 1)
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -12

Lets add an additional message upon attach failure, to aid the U-Boot
user to solve this problem.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
2018-07-12 07:26:18 +02:00
Stefan Agner
68c7025d99 cmd: ubi: print load size after establishing volume size
When using static volumes, the file size stored in the volume is
determined at runtime. Currently the ubi command prints the file
size specified on the console, which leads to a rather confusing
series of messages:
  # ubi read ${fdt_addr_r} testvol
  Read 0 bytes from volume testvol to 82000000
  No size specified -> Using max size (179924992)

Make sure to print the actual size read in any case:
  # ubi read ${fdt_addr_r} testvol
  No size specified -> Using max size (179924992)
  Read 179924992 bytes from volume testvol to 82000000

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
2018-07-12 07:25:32 +02:00
Holger Dengler
985fa93e61 cmd: set filesize variable in ubi read
After a successful read of a UBI volume, the variable filesize is set
to the number of read bytes. To boot linux with a raw initramfs/initrd,
you must specify the exact size of the initramfs/initrd image in boot
command. If the initramfs/inird is read from UBI volume, $filesize is
required to access the number of read bytes.

Example:
  ubi read ${loadaddr} kernelvol
  ubi read ${fdtaddr} dtbvol
  ubi read ${initrd_addr} initrdvol
  bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}

Signed-off-by: Holger Dengler <dengler@linutronix.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
2017-09-12 10:08:05 +02:00
xypron.glpk@gmx.de
18f41f2fa2 cmd: ubi: remove unnecessary logical constraint
A size_t variable can never be negative.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2017-04-18 06:08:32 +02:00
Ladislav Michl
f59f07ece5 cmd: ubi: allow '-' to specify maximum volume size
Currently maximum volume size can be specified only if no other
arguments are used. Use '-' placeholder as volume size to allow
maximum volume size to be specified together with volume id and
type.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
2017-01-26 07:00:25 +01:00
Ladislav Michl
0061242236 cmd: ubi: add option to specify volume id
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
2016-09-27 07:00:12 +02:00
Masahiro Yamada
1221ce459d treewide: replace #include <asm/errno.h> with <linux/errno.h>
Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content.  (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23 17:55:42 -04:00
Heiko Schocher
cddfc97d1f ubi: add new ubi command "ubi detach"
simple detachs ubi from the mtd partition.

Signed-off-by: Heiko Schocher <hs@denx.de>
2016-06-09 13:53:11 -04:00
Simon Glass
2e192b245e Remove the cmd_ prefix from command files
Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
2016-01-25 10:39:43 -05:00