execute_command is the single point where commands are executed and thus a new
getopt context is needed. currently we call getopt_reset here to reset the
context. This breaks though when a command tries to run a command itself by
calling execute_command or run_command. In this case we have to store the
context and restore it afterwards. The same is necessary in builtin_getopt.
Currently noone does this so this one shouldn't fix a bug, but merely allows
us to do such things later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When copying in verbose mode from a tftp server we might
not know the size of the file being transfered. In this
case print one progress item per 16k instead of one for
each single byte.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
At least ARM allows us to dump the stack, but we currently
have no prototype for this. Add a dump_stack prototype and
provide a static inline function for architectures without
stack dump support. Also, call dump_stack() in panic() to
provide more information in the case of a panic.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
kfifo currently only works with dynamically allocated fifos.
Change the currently unused kfifo_init to take a preallocated
fifo. This allows for statically initialized fifos.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The next limit with the current code will probably 2GiB.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add bit reversing utility, taken from the linux kernel.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
As flash memories need BCH correcting codes, add the BCH
library, taken from the linux kernel.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add sorted insert in stringlist functions.
Also added function to checked if string is already
in string list.
Signed-off-by: Alexander Aring <a.aring@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
uncompress_buf is used each time uncompress is called, so
make sure it is initialized correctly so that we do not
call free() on an already free pointer.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
uncompress() has the same prototype as the various kernel decompress
functions. It automatically detects the compression type and selects
the correct uncompress function.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Allow the user to manually select the uncompression support
he wants to have so that we have a single point where a user
can see which uncompression support will be compiled in.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The kernel uncompression functions have a unified API. Switch
to the kernel implementation to unify the different uncompression
APIs. As a bonus the kernel implementation is much smaller.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Update to commit:
6df16cb readkey: force return from while true
Use ARRAY_SIZE instead of hardcoded value
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
If read_key is feeded by STRG + KEY_LEFT you run into the while(1)
loop and corrupt memory through esc array.
Force return if index gets too high.
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
unlzo support is broken for files > 256k (more than one block)
since commit a3463cc128
(lib/decompress_unlzo: use fill and full to read and write data)
This patch updates unlzo support to the latest version of the kernel
plus a small buffer free fix.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds basic device tree command support. So far we can
parse a flat device tree (-p), which also stores the tree
in memory, dump it (-d) and free (-f) the internally stored tree.
The chosen node can be updated with barebox bootargs, no other
device tree manipulation is implemented yet.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
vanilla libfdt 1.3.0 from the dtc git:
git://git.jdl.com/software/dtc.git
Only small adjustments to compile with barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We might want to add real resource tracking later. Also
The first resource may not be a IORESOURCE_MEM at all.
For these reasons introduce a wrapper function for
driver so that they do not have to fiddle with resources
directly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
and add multi resource per device support
for now we keep the old map_base and size temporary but will switch all of
the used step by step to them resource way
and mirror the first resource to the map_base and size if available
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>