Copy over the latest version from u-boot which handles bigger sizes now
and does arithmetic with shifts instead of divisions.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Since this is the 'official' notation, we should support it.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch provides a global cleanup barebox Kconfig files. This includes
replacing spaces to tabs, formatting in accordance format, removing
extraneous lines and spaces. No functional changes.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Pass the buffer size to the file detection code. This makes sure we do not
read past the buffer. This is especially useful for ext filesystem detection
as the magic is at byte offset 1080. Also introduce a FILE_TYPE_SAFE_BUFSIZE
define which is set to the minimum bufsize the detection code needs to detect
all known filetypes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixes:
lib/xymodem.c:558: warning: no previous prototype for ‘do_load_serial_xmodem’
lib/xymodem.c:572: warning: no previous prototype for ‘do_load_serial_ymodem’
lib/xymodem.c:586: warning: no previous prototype for ‘do_load_serial_ymodemg’
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The current Y-Modem implementation has some limitations:
- Y-Modem/G protocol is not supported
- Multiple files (aka. batch) transfers are not supported
- Transfer speed over fast lines (USB console) is slow
- Code is not trivial to maintain (personnal opinion)
This implementation tries to address all these points by
introducing loady2 command.
The effects are :
- transfer speed for Y-Modem over USB jumps from 2kBytes/s
to 180kBytes/s
- transfer speed for Y-Modem/G jumps to 200kBytes/s
- multiple file transfers are possible
This command was tested on a USB console and UART 9600bps
serial line :
- NAKs (and retransmissions) were tested for faulty
serial lines
- multiple file transfers were tested
- Y-Modem, Y-Modem/G and X-Modem transfers were tested
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Use stringify in format string for HASH_PER_LINE.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In __dev_add_param, the name string is allocated using strdup.
Free it when removing the parameter.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Do not blit the surface everytime we write an image
As we want to able to render multiple image this will cause 1 blit per image;
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
To open, memmap, get the fb_info and if needed allocate the offscreen buffer
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of passing hundreds of parameter, just pass the right structure.
struct screen represent the screen with a without double buffering.
struct surface represent the part of the screen we want to render.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is needed if the image is bigger than the screen.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
/opt/work/barebox/lib/image_renderer.c: In function 'image_renderer_open':
/opt/work/barebox/lib/image_renderer.c:37:2: warning: passing argument 2 of 'read_file' from incompatible pointer type [enabled by default]
In file included from /opt/work/barebox/lib/image_renderer.c:11:0:
/opt/work/barebox/include/fs.h:167:7: note: expected 'size_t *' but argument is of type 'int *'
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is an alternative to LodePNG take from http://forge.voodooprojects.org/
which is base on picoPNG C++ wrote by Lode Vandevenne. The same author as
LodePNG.
PicoPNG only support RGBA PNG8
The source code of picopng.c was just adapted to be compliant with C89 and drop
the internal ZLIB support. Coding style untouched.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
use LodePNG version 20120729 from http://lodev.org/lodepng/
The original coding style is keeped to simplify update.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
this will allow to render rgba image with or without hw support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This will allow to support bmp and png
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
So we can add other format support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
As uncompress_size is a static and will set if call uncompress_size multiple
time.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
len is checked instead of num so when num is zero, we get a
division by zero a few lines later
Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This allows for creating a pre-bootloader binary for
- nand boot
- mmc boot
- compressed image
Currently on the compressed image is implemented the boot really on current lowlevel
init support. In a second step this could be move to the pbl c code with generic framework.
The pbl will be incharge of the lowlevel init if needed.
The barebox will skip it.
The decompressor support lzo and gzip and allow to add easly more.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQG6WuAAoJEOrjwV5ZMRf2UwEP/RVtYzL3/5tYgkYtE7ro7tu4
bByT4UmZunrkLnqcSSfoan9G1ruiElDVJHIDgGMoYo2z29iOkwb2ui6EYq14kaWv
rkkKDxZmxGis9plMlRO0ySNRgqbC061lnGuUe9XnZ6XBrGCAXCKm67LunNCV61Bm
PRCSfK2yhO6bAYYW7jWFzdzCwH9DmEgMZBwOXsq/qzZUgJNfqauqRrOLA1Ot/R8E
jUhSncOkVTezqJA7CnY2pAsBP+tXeNNaE5IVCO0WvC8l3zFHFRTnjAwOb4+xizNp
kjjFh8NPSPGDphn6j9y2xbz5mPOqgZuQoIuYgPcYTgHLmhXKZGXa1Cr5MVHKhw1L
923YUBGMop5SIMjACIzTByL6/toExRwldXyH3HC4fmr1uw/9gmExgmBujtMgt/Jc
x9YAwkACEQoZ7BYo0oppkEsWmPsrDUgAoUMnN5RLDxKPeJCCPiOZwug21PrV8tUu
053bfXLMKoEdpzAz5WkS1Ci1Qq0awv+8HZtOaVdRzkyGZaseAxeZ0vvLaBxnxHHJ
asQRyGj373//KBeTFeVQVYTJyokd1KvbvhHz/kR5rAXfIU2+cNGaiWMVt5i9tWPY
CV12tocse+E1f3zmuVh9WmO5gX+lNq2ZqUa/OaMYif83uXH2WbfqCvVbx1qTYOOq
NmBxmE5f5e0Le9FPdpD1
=t0vB
-----END PGP SIGNATURE-----
Merge tag 'pbl' of git://git.jcrosoft.org/barebox into for-next/pbl
Add pre-bootloader (pbl) image support
This allows for creating a pre-bootloader binary for
- nand boot
- mmc boot
- compressed image
Currently on the compressed image is implemented the boot really on current lowlevel
init support. In a second step this could be move to the pbl c code with generic framework.
The pbl will be incharge of the lowlevel init if needed.
The barebox will skip it.
The decompressor support lzo and gzip and allow to add easly more.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
The arguments to collated_compare are actually pointers to
pointers to char, not pointers to char.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
so we can use decompress in the decompressor
this will simplify multi decompress support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Files "modules.builtin" probably have been copied from kernel tree.
This files not used by barebox and can be removed safely.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Normally errno contains a positive error value. A certain unnamed developer
mixed this up while implementing U-Boot-v2. Also, normally errno is never
set to zero by any library function.
This patch fixes this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently we return NULL for unset parameters. As we can't set them
back to NULL once set this is not very consistent. Return an empty
string instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The following patch serie improve the complete support
by adding a complete framework to aalow commands complete support.
The add also car complete support for eval and setting and executable
file support
This also include an update of the stringlist API to support asprintf
API
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJPnohsAAoJEOrjwV5ZMRf2qeIQAIC7WrIao0mB2pIB+51MqeU+
sof7GLxUl0MWXFFc3OFEHDcY5grC867mBmB9+uDG1mvcxa/bUpw+jMRMrki5j4Kg
mjaHQ2UCvDjMHqQi7ISc/WTyJb09mtduFIceP0EftAmG8Mb5n9XOMaKwL9r/UQHB
ps9MijnI/QeFqbrmBZcuaCp59QsPvipYw8NMJITBu2VvWrpKTIox33qPfNATDuEV
SzMoLwz+uD7W7dEAM/A1uFdo4K5fLyZruDVGQoQ8CRS+zW3E6rr/EakpN5mhr/66
dVZYO1xWppBaefIJQ1RD6bvwlFvesuuvQmMtDxsCsp07fyBolEWfFzblrwdkbueY
NPwWExV5nzbRdAKKSyhU/nHiQ2edOQQZtHDAbnM4zh5e6lK7YLrzVklzT4Dfhzn0
GRdnjCmiQiaZdmAEHe8wte2nr3Lc01fTsj/EFVA+LYP3a9by1iG2Zn3/ChieVcN4
R+o/2lMBdhxsTszcmwMOemdqVPlt/0VmEXrKGtjTIZEViuQyyhY8ZtEaf4C0zeln
Jf60t0ZvkehAJc0Lo4UOygjzvErqcKoHMk7utAjP+bi1KcMgF3Q+HmtCnJJs2FHw
c40FZj1WcLPStEiS1way7miBakxOy2zPumKi1OXx+140L25C1nvQPYu8ilOZHEyU
opNlo+wQ8h5sG/054kYL
=rYfw
-----END PGP SIGNATURE-----
Merge tag 'complete_update_support' of git://git.jcrosoft.org/barebox into next
improve complete support
The following patch serie improve the complete support
by adding a complete framework to allow commands complete support.
The add also car complete support for eval and setting and executable
file support
This also include an update of the stringlist API to support asprintf
API
Useful for allocating a string list entry on the fly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Allocate the string in string list seperately instead of
embedding a zero length string into struct stringlist.
Besides looking cleaner this allows us to implement a
string_list_asprintf.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
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>
With this kallsyms finally start working at least on ARM. This
enables us resolving addresses into symbols which is particularly
useful in combination with stack unwinding support. As kallsyms
now compile and work we can remove the depends on BROKEN.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
this will all to simplify the sync with the kernel and later easly add the
self decompression support to barebox
as example with a lzo compression will reduce barebox from 180224 to 99863
bytes so 55.41%
-rwxr-xr-x 1 root root 99863 Jan 28 02:17 build/versatilepb/barebox.bin.lzo
we also reduce the binary size by 224 bytes
Old version
# ls -al build/versatilepb/barebox.bin
-rwxr-xr-x 1 root root 180468 Jan 28 02:14 build/versatilepb/barebox.bin
New version
# ls -al build/versatilepb/barebox*
-rwxr-xr-x 1 root root 180244 Jan 28 02:13 build/versatilepb/barebox.bin
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The idea is to panic() when there is no memory available for normal
operation. Exception: code which can consume arbitrary amount of RAM
(example: files allocated in ramfs) must report error instead of panic().
This patch also fixes code which didn't check for NULL from malloc() etc.
Usage: malloc(), memalign() return NULL when out of RAM.
xmalloc(), xmemalign() always return non-NULL or panic().
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The do_devinfo_subtree() function is only used if devinfo is compiled
in, so put it under the same ifdef. This avoids the following warning
when built with allnoconfig:
lib/driver.c:247: warning: 'do_devinfo_subtree' defined but not used
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Silence this warning:
lib/parameter.c:85: Warning: argument `value' of command @param is not found in the argument list of dev_set_param(struct device_d *dev, const char *name, const char *val)
lib/parameter.c:85: Warning: The following parameters of dev_set_param(struct device_d *dev, const char *name, const char *val) are not documented:
parameter val
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
before if you specify id = 0 the next available id will be taken
otherwise fail if already registered now as in linux we use -1
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
dev_name is supposed to return the name of the device plus the id
currently we use %s%d format where in the kernel the use %s.%d
we may think to switch to this format for the device name and keeping the %s%d
for the devfs
this will be usefull to not modify the clock device name as example
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
if you specify id = 0 the next available id will be taken
otherwise fail if already registered
before if you specify one it will have use the next free id anyway
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Change device parameters so that the memory management is in generic
code. This also removes the need of storing statically initialized
parameters as they are stored in a struct list_head for each device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Unsure if this is the/a correct fix, but without it, my build fails.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We accidently have two list implementations in the tree:
include/list.h and include/linux/list.h. This patch moves
the latter (newer one) to include/linux/list.h.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
No need to check for maximum argument counts. The commands are
safe to be called with more arguments, so lets safe some bytes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some devices, especially the ones doing DMA should be disabled before
giving control to an OS. We take the simple approach here: Just shutdown
the devices in the reverse order they were activated.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Proven to be useful in linux kernel, U-Boot should have such a thing
aswell. We do not distinguish between the various print levels others
than debug and not debug.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Use a pointer to an ip address instead of the return value in string_to_ip
and use the return value for error indication only. 0.0.0.0 can be a valid
ip address
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This introduces selected generic bitop files from
kernel. We don't need minix, ext2, sched or lock
based bitops. Those have been dropped.
Signed-off-by: Nishanth Menon <x0nishan@ti.com>
[Patch 08/17] U-Boot-V2:Commands Unbreak loadb support
This patch provides support for loadb and loady and enables the broken feature
Signed-off-by: Nishanth Menon<x0nishan@ti.com>
For practical reasons I changed all string literals assumed to be constant
to reside in .rodata subsection at end of .text section.
Signed-off-by: Carsten Schlote <schlote@vahanus.net>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
- Use device tree structure to implement partitions
- Let devinfo print a nice tree
- Introduce 'fixed' partitions which are not removable
- Fix mount: It was not possible to mount on a relative path.
- No need to handle strings where only size or end is given. This
form is confusing and does not give real benefit.
- Fix start-end form. The calculation was wrong.
- Return an error if end < start.
- Add function description.
With this function we can get a pointer to directly memory mapped
devices like nor flash or RAM. Useful for bootm where we save one
memcopy when the image is mappable