9
0
Fork 0
Commit Graph

515 Commits

Author SHA1 Message Date
Sascha Hauer 1d88c66977 ubiformat: Use mtd-peb API
This changes ubiformat from the libmtd API to the mtd-peb API. This
makes the libmtd API unnecessary and it can be removed in the next
step.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-06 10:17:52 +02:00
Sascha Hauer 30750ef990 mtd: rename mtd_all_ff -> mtd_buf_all_ff
To make clear this function checks a given buffer and not data on a mtd
device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-03-15 11:29:27 +01:00
Philipp Zabel 2b47e52795 process_escape_sequence: add support for \u
Expand the \u escape sequence to the user currently set in the
$global.user variable.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-17 13:50:45 +01:00
Sascha Hauer c073534880 Merge branch 'for-next/ratp' 2016-02-08 08:27:01 +01:00
Sascha Hauer 2660573374 barebox remote control
This adds the ability to control barebox over serial lines. The regular
console is designed for human input and is unsuitable for controlling
barebox from scripts since characters can be lost on both ends, the data
stream contains escape sequences and the prompt cannot be easily matched
upon.
This approach is based on the RATP protocol. RATP packages start with a
binary 0x01 which does not occur in normal console data. Whenever a
0x01 character is detected in the console barebox goes into RATP mode.
The RATP packets contain a simple structure with a command/respone
type and data for that type. Currently defined types are:

BB_RATP_TYPE_COMMAND (host->barebox):
	Execute a command in the shell
BB_RATP_TYPE_COMMAND_RETURN (barebox->host)
	Sends return value of the command back to the host, also means
	barebox is ready for the next command
BB_RATP_TYPE_CONSOLEMSG (barebox->host)
	Console message from barebox

Planned but not yet implemented are:

BB_RATP_TYPE_PING (host->barebox)
BB_RATP_TYPE_PONG (barebox->host)
	For testing purposes
BB_RATP_TYPE_GETENV (host->barebox)
BB_RATP_TYPE_GETENV_RETURN (barebox->host)
	Get values of environment variables

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Andrey Smirnov <andrew.smirnov@gmail.com>
2016-01-18 09:25:09 +01:00
Sascha Hauer bbdbda0a74 Add Reliable Asynchronous Transfer Protocol
This patch adds support for Reliable Asynchronous Transfer Protocol (RATP)
as described in RFC916.

Communication over RS232 is often unreliable as characters are lost or
misinterpreted. This protocol allows for a reliable packet based communication
over serial lines.

The implementation simply follows the state machine described in the RFC
text with one exception. RFC916 uses a plain checksum for the
transferred data. We decided to use CRC16 for greater robustness. Since
this is the only RFC916 implementation we currently know of interoperability
with other implementations should not matter.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Andrey Smirnov <andrew.smirnov@gmail.com>
2016-01-18 09:25:04 +01:00
Sascha Hauer 7f2e215fcf vsprintf: Add support for %pa
Add support for the %pa format specifier to print phys_addr_t,
dma_addr_t and resource_size_t.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-15 15:32:29 +01:00
Sascha Hauer 70ef1cef5c Merge branch 'for-next/pstore' 2016-01-11 13:11:07 +01:00
Sascha Hauer b9a2512aaa Merge branch 'for-next/misc' 2016-01-11 13:11:06 +01:00
Sascha Hauer 1cc4ba2aa1 readline: Fix potential buffer overflow in command history
Cursor up copies the last line into the buffer without checking if it
fits into the current buffer. Fix this using safe_strncpy.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:30:56 +01:00
Sascha Hauer e3ae12a418 readline: Fix potential buffer overflow
cread_add_char doesn't take the trailing '\0' into account, so adding
it at the end of readline can overflow the buffer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:30:56 +01:00
Trent Piepho a3544b162e bootstrap: constify strings
Various parameters for device names, etc.  should be const strings.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:30:55 +01:00
Trent Piepho 1d31baf145 bootstrap: Boot barebox with kernel calling convention
In commit 8e3ddc13eb the bootm code was
changed to boot barebox using the same calling convention as the
kernel.  Which on ARM is to pass three arguments which are zero, an
architecture code, and a params pointer.

A 2nd stage barebox can be booted using lib/bootstrap, which is
different code from bootm.  This code just leaves garbage in the first
three parameters and so doesn't follow the convention.

Change it to be compatible with the ARM kernel booting convention.
This just sends a zero for the architecture, since the code for
architectures depends on boot[zmu] and something using bootstrap
wouldn't have those too.  And it just passes NULL for the params since
we don't have a way to pass a device tree from the preloader.

All users of bootstrap are ARM based, but the code is in lib so a
non-ARM board might someday make use of it.  If the current code would
work for them, then the change here will be ok too.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-14 11:13:32 +01:00
Markus Pargmann 899b3822d2 lib: Import reed solomon code from kernel
reed solomon code is used by RAMOOPS to check and fix data stored in
volatile memory.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 647fba8ee3 vsprintf: Add scnprintf from kernel
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Sascha Hauer 24f1c994cc Merge branch 'for-next/misc' 2015-12-08 08:28:07 +01:00
Sascha Hauer 29ac6ac467 Merge branch 'for-next/imx' 2015-12-08 08:27:47 +01:00
Du Huanpeng ea682776db font: fbconsole: add custom font supports
Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 08:21:08 +01:00
Sergey Koshechkin 33060cc675 make_directory: fix warning: no previous prototype
Signed-off-by: Sergey Koshechkin <serge.koshechkin@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-18 08:31:18 +01:00
Du Huanpeng 405c6e09dd lib: readline support ctrl-l to clear screen
maybe it is easier to press ctrl-l to clear the screen than type
'clear' command.

Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-17 09:14:17 +01:00
Sascha Hauer 314b5402d9 fbconsole: register fonts dynamically
Instead of having a fixed array of fonts register the fonts dynamically.
This allows easier adding of fonts to the tree since only one file per
font has to be added and no other files modified.

Currently we have to register the fonts very early before the first
framebuffer is registered. This is because of our limited
dev_add_param_enum() which wants to know the number of elements when
called, so we can't add elements once after we've called
dev_add_param_enum(). Maybe a dev_add_param_array() has to be created
whithout this limitation, but that's left for a future exercise.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-13 09:14:48 +01:00
Sascha Hauer 92327f1f6e graphics_utils: check for valid framebuffer before creating a screen
Otherwise we crash later when we try to print on that screen.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-13 08:37:13 +01:00
Du Huanpeng 48608cfd3f lib: fix coding style
Signed-off-by: Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-09 07:20:29 +01:00
Sascha Hauer 92f8d5953b logo: Makefile: remove debug output
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-15 09:08:55 +02:00
Antony Pavlov c7b1012923 logo: Kconfig: make BAREBOX_LOGO_* depend on BAREBOX_LOGO
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-14 08:29:20 +02:00
Sascha Hauer b7ab2081b1 Merge branch 'for-next/param' 2015-09-01 09:43:55 +02:00
Sascha Hauer 69dccb494a Merge branch 'for-next/misc' 2015-09-01 09:43:54 +02:00
Sascha Hauer c170240d3e param_enum: protect against invalid values
Since dev_add_param_enum is passed a pointer containing the actual value
it can contain an invalid value. Protect against it so that we do not
access invalid array elements.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-26 12:52:19 +02:00
Sascha Hauer 546c5a9c78 param_enum: Make name strings const
Not only the array containing the pointers should be const but
also the strings themselves, so instead of using const char **
use const char * const *.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-26 12:52:12 +02:00
Sascha Hauer cabfe34ca7 gui: implement blitting screen areas
So far we only supported blitting the whole screen from the shadow
fb to the framebuffer. Add a function to blit areas.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 12:57:08 +02:00
Sascha Hauer 7c5937d245 gui: Use fb provided shadowfb for offscreen rendering
The fb core now has builtin support for offscreen rendering, use
this and drop offscreen handling in the gui code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 12:57:08 +02:00
Sascha Hauer eac28050d0 fb: return original fb_info in FBIOGET_SCREENINFO
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 12:57:07 +02:00
Andrey Smirnov c8a26925c9 lib: libfile: Do not ignore errors in close()
Some character devices may perform meaningful operations in their
implementation of close() -- a good example would be socfpga.c which
checks if the FPGA was programmed succesfully in it's close() method
-- so ignoring return value of this call may cause false positives in
checking exit status for success.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-19 16:23:54 +02:00
Sascha Hauer b32e327d3e Merge branch 'for-next/logo' 2015-08-06 12:33:13 +02:00
Sascha Hauer 3c92473a9e Merge branch 'for-next/fbcon' 2015-08-06 12:33:06 +02:00
Michael Olbrich 17e6044074 xfuncs: add wrapper for wchar strdup functions
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 16:46:14 +02:00
Michael Olbrich 773be2a168 xfuncs: add xasprintf() and xvasprintf()
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 16:46:14 +02:00
Sascha Hauer 4f8a7e916a Add new barebox logo to the tree
This adds the new barebox logo to the tree. This is added as svg
image which is converted to different png images during build time. The logo
can be found under /logo/barebox-logo-<width>.png in the running barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-20 07:28:30 +02:00
Sascha Hauer cfec57d898 graphics_utils: Let fb_open allocate the screen
Allocate the screen dynamically in fb_open. This opens the way to create
a fb_create_screen function which takes a struct fb_info * instead of a
filename. This is suitable for the framebuffer console which already has
a struct fb_info *.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-20 07:11:21 +02:00
Sascha Hauer dd09054276 fonts: Add 7x14 font
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-20 07:11:21 +02:00
Antony Pavlov b6b96ee6fd lib/fonts: add "MINI4x6" font
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:17:17 +02:00
Antony Pavlov e5138e2d3e import lib/fonts framework from linux kernel
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:17:17 +02:00
Sascha Hauer 322d8a509e graphics_utils: add function to create pixel from rgb triplet
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:17:17 +02:00
Sascha Hauer 3ea4dee7fd graphics_utils: Export get_pixel
get_pixel converts a 32bit trgb color into framebuffer format. This
is useful for other code aswell, so export it.
Other functions in the graphics utils code use the name get/set_pixel
aswell, but instead of converting data they get a pixel from the framebuffer
or set a pixel on the framebuffer. To separate from these rename the
function to gu_hex_to_pixel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:13:04 +02:00
Sascha Hauer 976ad2aea2 graphics_utils: Add function to invert an area
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:03:05 +02:00
Sascha Hauer ea532ddb86 gui: Fix typo in function name
It's a render buffer, not a redering buffer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-15 07:25:01 +02:00
Sascha Hauer 592ae690f5 graphic_utils: Add a common namespace to functions
This adds a common namespace to the graphic functions. We use
gu_ for graphic_utils.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-15 07:25:00 +02:00
Sascha Hauer 735c570e5a Merge branch 'for-next/state' 2015-07-03 08:38:20 +02:00
Sascha Hauer f2a2894c27 Merge branch 'for-next/misc' 2015-07-03 08:37:40 +02:00
Antony Pavlov 177cab00ce treewide: fix 'new blank line at EOF' formatting error
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-02 09:39:58 +02:00
Alexander Smirnov bcc6281e39 read_file_2(): drop unnecessary 'else'
Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-02 09:39:58 +02:00
Lucas Stach e9ed112082 parameter: always build MAC dev param functions
The MAC dev parameter functions would only be built when CONFIG_NET is
set. This was okay as long as only network devices were using MAC dev
params. This has changed with the merge of the state framework, so
always compile them in if CONFIG_PARAMETER is set.

Fixes:
common/built-in.o: In function `state_mac_create':
common/state.c:387: undefined reference to `dev_add_param_mac'

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-02 09:39:57 +02:00
Sascha Hauer 24867bac8a image_renderer: Use read_file_2
This returns a proper error code and allows us to print a proper
error message which might not always be -ENOMEM.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-26 11:56:24 +02:00
Sascha Hauer 8dee3145bf bmp support: Use unaligned accessors
Some fields in the bmp header are unaligned. Use unaligned accessor
functions to acces them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-23 17:00:39 +02:00
Marc Kleine-Budde daeb9d8d76 xfuncs: import xstrndup() from busybox
This function is needed for the fixed length string feature in the state
framework.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 10:58:58 +02:00
Marc Kleine-Budde 48751b1aa9 parameter: allow setting of string parameters of zero length
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 10:58:58 +02:00
Sascha Hauer 3b6a1db325 device parameters: sort alphabetically
With many parameters on the global device it becomes increasingly
annoying to find a parameter in the list. Sort it alphabetically
to make this easier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 08:59:32 +02:00
Sascha Hauer 7a429bfb3b Merge branch 'for-next/misc' 2015-06-09 09:26:44 +02:00
Sascha Hauer 34afdd06de xfuncs: remove debugging output
Adding debug statements to this code path does not make much sense
since when enabled it will massively spam the console.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:42 +02:00
Andrey Smirnov 435aaf6279 bootstrap: Warn if image size in BB header is zero
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:42 +02:00
Andrey Smirnov e5dda9d5e2 bootstrap_read_devfs(): Remove all partitions upon function completion
Bootstrap_read_devfs does not remove the devices it creates during the
course of its execution which might be considered as a resource
leak. Remedy that by adding the code to remove those devices upon
function completion.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:42 +02:00
Andrey Smirnov 835ffe76c4 bootstrap_read_devfs(): Check for errors from dev_add_bb_dev()
Check for errors returned by dev_add_bb_dev() and bail if there
are any.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:41 +02:00
Andrey Smirnov 065d75c341 bootstrap_read_devfs(): Fix potential memory leak
In case of a failure in one of the cdev_* functions original version
of bootstrap_read_devfs would not release memory allocated for barebox
header or memory allocated for the image. This commit fixes this by
adding resource deallocation code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:41 +02:00
Andrey Smirnov d26ed41fac bootstrap_read_devfs(): Close file after we are done with it
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:41 +02:00
Andrey Smirnov a11d0e04c8 bootstrap_read_devfs(): Check for errors from devfs_add_partition()
Check for errors returned by devfs_add_partition() and bail if there
are any.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:41 +02:00
Andrey Smirnov 49673cfc5f bootstrap: Fix potential memory leak in 'read_image_head'
Original version of 'read_image_head' would not free the memory
allocated for barebox header in cases of any failure. Fix this by
adding a dedicated resourse de-allocation code path.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-07 09:49:41 +02:00
Stefan Müller-Klieser 115bfd0009 lzo: check for length overrun in variable length encoding.
This corresponds to kernel commit 72cf90124e87d975d0b

This fix ensures that we never meet an integer overflow while adding
255 while parsing a variable length encoding. It works differently from
commit 206a81c ("lzo: properly check for overruns") because instead of
ensuring that we don't overrun the input, which is tricky to guarantee
due to many assumptions in the code, it simply checks that the cumulated
number of 255 read cannot overflow by bounding this number.

The MAX_255_COUNT is the maximum number of times we can add 255 to a base
count without overflowing an integer. The multiply will overflow when
multiplying 255 by more than MAXINT/255. The sum will overflow earlier
depending on the base count. Since the base count is taken from a u8
and a few bits, it is safe to assume that it will always be lower than
or equal to 2*255, thus we can always prevent any overflow by accepting
two less 255 steps.

This patch also reduces the CPU overhead and actually increases performance
by 1.1% compared to the initial code, while the previous fix costs 3.1%
(measured on x86_64).

The fix needs to be backported to all currently supported stable kernels.

Reported-by: Willem Pinckaers <willem@lekkertech.net>
Cc: "Don A. Bailey" <donb@securitymouse.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-25 09:47:51 +01:00
Stefan Müller-Klieser 69a6dcdc0e Revert "lzo: properly check for overruns"
This reverts barebox commit ecb1dc0b1e
This corresponds to kernel commit af958a38a60c7ca3d8

As analysed by Willem Pinckaers, this fix is still incomplete on
certain rare corner cases, and it is easier to restart from the
original code.

Reported-by: Willem Pinckaers <willem@lekkertech.net>
Cc: "Don A. Bailey" <donb@securitymouse.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-25 09:47:51 +01:00
Sascha Hauer 5dd5884801 lib: Add hex2bin and bin2hex implementations
Taken from the Kernel, put into the same place as in the kernel,
although the hexdump.c does not actually contain hexdum functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-13 08:22:27 +01:00
Sascha Hauer 55ab01c7ff Merge branch 'for-next/rockchip'
Conflicts:
	arch/arm/Kconfig
2015-03-09 08:30:35 +01:00
Andrey Panov 78d030226d lib: Add gcd() function
It calculates greatest common divisor.

Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-05 09:11:33 +01:00
Sascha Hauer e5c73e0fe1 cmndlinepart: skip devname if partstr already contains it
When the partition name already starts with "devname." skip this
when adding the partition.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:44 +01:00
Sascha Hauer c1156d841f cmdlinepart: add function to parse a cmdline partition string
This adds a function to parse a full cmdline partition string. The
addpart command is switched to use this function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 10a0aaabfe cmdlinepart: make argument types safer
The return size should be loff_t to support partitions bigger
than 4G. Also use const for the devname and endp.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer d397eb6162 cmdlinepart: Change SIZE_REMAINING to loff_t
For compatibility with devices > 4G.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer 39f6392d93 move cmdline partition parsing code to separate file
So it's no longer local to the addpart/delpart code and can be used
from other code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 09:33:43 +01:00
Sascha Hauer ce961e3412 Merge branch 'for-next/misc' 2015-02-04 19:09:15 +01:00
Masahiro Yamada 03dabc0fe4 param: add error check to __dev_add_param()
If strdup() fails with out-of-memory, __dev_add_param() should fail
with -ENOMEM.

(Note strdup() is always given with a non-NULL pointer.  If the
argument name is given with NULL, the system would already have
crashed in the get_param_by_name() function.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-02 11:46:31 +01:00
Masahiro Yamada 31cbf0880d param: add error check to dev_param_set_generic()
The function dev_param_set_generic() may fail because of
out of memory.  If so, return -ENOMEM.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-02 11:46:31 +01:00
Masahiro Yamada 13a1b45058 lib: decompress: remove redundant INT_MAX define
lib/decompress_bunzip2.c includes <common.h> and INT_MAX is already
defined there.  The definition in this file is redundant.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-21 14:58:07 +01:00
Sascha Hauer 39c6c3480a Merge branch 'for-next/mxs' 2015-01-09 17:38:26 +01:00
Sascha Hauer ff6383c8e4 Merge branch 'for-next/misc' 2015-01-09 17:38:26 +01:00
Sascha Hauer cc843dadfd Merge branch 'for-next/efi' 2015-01-09 17:38:26 +01:00
Masahiro Yamada d8753571b2 sizes.h: move include/sizes.h to include/linux/sizes.h
This file originates in Linux.  Linux has it under include/linux/
directory since commit dccd2304cc90.
Let's move it to the same place as well in barebox.

This commit was generated by the following commands:

  find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:'
  git mv include/sizes.h include/linux/

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-08 14:00:26 +01:00
Jean-Christophe PLAGNIOL-VILLARD 461710b119 graphic_utils: set_pixel only write 16bit in 16bit mode
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:36:40 +01:00
Sascha Hauer a9d7b3d00e Add PBL console support
This adds simple console support to the PBL which makes it
possible to print more complex messages in the PBL than just
strings or hex numbers. For now puts_ll is used to print the
messages, so it depends on CONFIG_DEBUG_LL which makes it
more a debugging option. However, this could be extended later
to get regular output from the PBL if desired.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:59 +01:00
Sascha Hauer 017da2273a printf: use local isdigit/isalnum implementation
To be independent of the _ctype array. This makes it possible
to add printf support to the PBL without adding _ctype aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:58 +01:00
Sascha Hauer 8a7335f8b5 printf: move simple_strto*() functions to separate file
These are not needed in the PBL, so move them to a separate file.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:58 +01:00
Sascha Hauer ce5299b0bf printf: move panic() to common/misc.c
panic() is not really a printf like function, so move it to common/misc.c.
This is done because we want to have printf support in the PBL, but PBL
has it's own panic() implementation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:58 +01:00
Lucas Stach 42c8b4589a lib: add wchar strdup
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:10 +01:00
Sascha Hauer b01bc4c810 Merge branch 'for-next/randconfig-1' 2014-12-08 14:54:11 +01:00
Sascha Hauer 3eade89c75 Merge branch 'for-next/persistent-vars'
Conflicts:
	arch/arm/boards/efika-mx-smartbook/defaultenv-efikasb/config
2014-12-08 14:54:09 +01:00
Sascha Hauer c2b5a7015b Merge branch 'for-next/misc' 2014-12-08 14:53:59 +01:00
Jan Luebbe 0d752cb78c stringlist: the string argument should be const
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-04 08:24:05 +01:00
Sascha Hauer 0d5c1b9e97 param: make string arguments to dev_add_param_fixed const
dev_add_param_fixed does not modify the strings, so make them
const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-28 15:21:26 +01:00
Lucas Stach 93b7459e1c lib: decompress_xz: fix function header to match prototype
Fixes:
lib/uncompress.c:124:10: warning: assignment from incompatible pointer type

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-24 14:04:11 +01:00
Jan Luebbe 7dc430e612 stringlist: string_list_contains can use a const string
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-20 14:36:19 +01:00
Jan Weitzel 8e2c7b3de3 xymodem: select CRC16 from lib
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-12 09:22:22 +01:00
Sascha Hauer 9f11887009 libfile: Add copy_recursive
To recursively copy a directory tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:55 +01:00
Sascha Hauer 592d35a47c Merge branch 'for-next/xz' 2014-11-05 15:47:39 +01:00