summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/ratp'Sascha Hauer2020-07-271-0/+2
|\
| * ratp: Fix closing connectionsSascha Hauer2020-06-161-0/+2
| | | | | | | | | | | | | | | | | | | | When entering the LAST_ACK state we have to set the saved SN to the received SN of the current packet. With this we properly accept the final incoming packet and close the connection. Without this we interpret the final incoming packet as a duplicate of the previous packet and close the connection only after a timeout. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/ramfs'Sascha Hauer2020-07-271-9/+16
|\ \
| * | libfile: copy_file: explicitly truncate to final sizeSascha Hauer2020-07-051-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | When possible truncate the destination file to the final size explicitly. This allows for example ramfs to put the resulting file contiguously into memory. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | libfile: copy_file: Fix calling discard_rangeSascha Hauer2020-07-051-5/+6
| |/ | | | | | | | | | | | | | | | | discard range is called with unitialized size argument. Call it after stat() on the source filedescriptor. Also there's no point in continuing when stat() on the source filedescriptor fails, so bail out in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-07-271-149/+0
|\ \
| * | lib: list_sort: delete dead codeAhmad Fatoum2020-07-141-149/+0
| |/ | | | | | | | | | | | | | | | | | | list_sort.c's core code should only change on sync with Linux, so we don't really need separate testing code. The code doesn't compile as we neither have a CONFIG_TEST_LIST_SORT symbol nor do we have a <linux/random.h> header. Remove it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / fs: fat: extend for in-PBL supportAhmad Fatoum2020-07-111-1/+1
|/ | | | | | | | | | | The AT91 BootROM loads a boot.bin file from the first FAT partition into SRAM, when booting from MMC. To avoid the need for two barebox configurations for each of the bootloader stages, add PBL support for reading from FAT. This way each stage need only have a different PBL entry point. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ratp'Sascha Hauer2020-06-111-0/+2
|\
| * ratp: Free buffersSascha Hauer2020-05-201-0/+2
| | | | | | | | | | | | recvbuf and sendbuf are never freed, free them to avoid memory holes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-06-111-6/+13
|\ \
| * | logo: Makefile: make it possible to use inkscape 1.0Antony Pavlov2020-06-031-6/+13
| |/ | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / kbuild: rename pbl object pbl-*.o to *.pbl.oMasahiro Yamada2020-05-201-3/+2
|/ | | | | | | | | | | | | | | | | | Currently, pbl objects are output to: <directory-path>/pbl-<basename>.o This commit changes as follows: <directory-path>/<basename>.pbl.o The motivation is not only to get rid of the ugly code introduced by commit 257abdaa36c8 ("Do not rm the path from pbl-y target"), but also to make it easier to remove obj-dtb-y, pbl-dtb-y, lwl-dtb-y syntax in the next commit. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-05-1416-48/+0
|\
| * treewide: remove references to CREDITSUwe Kleine-König2020-04-2716-48/+0
| | | | | | | | | | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/kconfig'Sascha Hauer2020-05-141-0/+3
|\ \
| * | lib: bch: define referenced but undefined Kconfig optionAhmad Fatoum2020-04-291-0/+3
| |/ | | | | | | | | | | | | | | BCH_CONST_PARAMS is used, but undefined. Defining it would change MACH_MIOA701 behavior, so define it but remove the select Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / drivers: add COMPILE_TEST prompts for some off-by-default optionsAhmad Fatoum2020-05-081-1/+1
|/ | | | | | | | | | | Some Kconfig options we have are promptless and off-by-default and instead can only be enabled by being selected from platform options. For some of those that aren't compile testable, add a new COMPILE_TEST-only prompt. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/block'Sascha Hauer2020-03-181-0/+2
|\
| * copy_file: call discard_range on destination fileSascha Hauer2020-02-141-0/+2
| | | | | | | | | | | | discard the range in the output file we are going to overwrite anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ubsan: use a big if block in KconfigUwe Kleine-König2020-02-101-2/+4
|/ | | | | | | | | A side effect (which was the motivation for this change) is that the config item CONFIG_UBSAN_ALIGNMENT doesn't appear in configurations that have CONFIG_UBSAN disabled. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/watchdog'Sascha Hauer2019-12-101-0/+22
|\
| * param: add dev_add_param_tristate(_ro) helpersAhmad Fatoum2019-12-051-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is can be considered an extension to the dev_add_param_bool interfaces with a third value that's "unknown". This can be used for cases, where barebox can flip a bit somewhere, but it has no way of knowing what the initial state of the bit was, e.g. turn on/off the watchdog, but no watchdog status. Turn on/off a co-processor, but no co-processor online status. And so on. Not providing a way to customize the "unknown" string is a deliberate choice, so future device parameters follow the same naming scheme. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gui: picopng: declare locally used functions as staticLucas Stach2019-12-021-30/+30
| | | | | | | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: zstd: declare locally used functions as staticLucas Stach2019-12-021-5/+5
| | | | | | | | | | | | | | | | Fixes "no previous prototype for...) warnings in the zstd code. Fixes: 1a39d4dcbffc (lib: Add zstd decompression module) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ratp: add more build dependenciesLucas Stach2019-12-021-0/+5
|/ | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* parameter: strip leading and trailing whitespacesMarco Felsch2019-11-041-1/+4
| | | | | | | | | | | | | | | | | My initial bug was the following: I set the global.boot.default="boot1 boot2 " and executed the 'boot' command. If both targets are not bootable barebox starts to execute the boot scripts found under /env/boot. This is because of the command/boot.c implementation and the leading whitespace. Without the whitespace only the two desired boot targets are tried. IMHO leading and trailing whitespaces are error-prone in many cases. If someone wants to concatenate strings he/she should add spaces on purpose. So I fixed the bug above globally by always stripping leading and trailing whitespaces. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* libfile: copy_file: fix error handlingRobert Karszniewicz2019-10-231-5/+12
| | | | | | | | Before this, ret was falsely polluted, which caused a misleading error message if the function bailed out at a later point. Signed-off-by: Robert Karszniewicz <r.karszniewicz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* readline: make ctrl-u to work like linux consoleDU HUANPENG2019-10-181-0/+8
| | | | | | | | | currtly, the ctrl-u discards the whole line, in most linux boxes, ctrl-u just erase characters before cursor to the begginning of the line. this patch make ctrl-u to do this. Signed-off-by: DU HUANPENG <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: ubsan: ignore shifting one into sign bitAhmad Fatoum2019-10-141-0/+20
| | | | | | | | | | | | | The __ubsan_handle_shift_out_of_bounds handler would be called for code shifting a one into the sign bit like (1 << 31), which is all too common in barebox. It's technically UB, but it's so prevalent that it's highly unlikely to be treated by a compiler as anything else than the standard-compliant (1U << 31). Check for this case here and ignore it selectively. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* trivial: fix typo lenght -> lengthUwe Kleine-König2019-10-141-8/+8
| | | | | | | | | | | | Generated by perl -p -i -e 's/lenghte?/length/' arch/arm/boards/chumby_falconwing/falconwing.c arch/arm/mach-samsung/mem-s3c64xx.c fs/ext4/ext_common.h lib/gui/lodepng.c include/jtag.h There is another instance in dts/Bindings/usb/s3c2410-usb.txt, this is fixed in Linux v5.3-rc1 so supposed to be fixed soon in barebox, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Convert latin1 files to utf-8Uwe Kleine-König2019-10-143-384/+384
| | | | | | | | | | | The source files are parsed by $(make docs). Currently this is done using python2 (actually 'python' which is still python2 on most machines). When using python3 however (which has a stricter encoding handling) it is easier if all input is in utf-8 encoding. So convert the few remaining latin1 encoded files to utf-8. This only affects code comments. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* libfile: Document that read_file() returns a terminated bufferSascha Hauer2019-10-141-1/+3
| | | | | | | | read_file() and read_file_2() return a '\0' terminated buffer to make sure the buffer is usable as a string. Other code like read_file_line() depends on this behaviour, so document it explicitly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/qemu'Sascha Hauer2019-09-129-0/+26
|\
| * Compile libfdt for bareboxSascha Hauer2019-08-199-0/+27
| | | | | | | | | | | | | | | | | | libfdt can be useful for very early device tree parsing, so compile it for barobox aswell. This is done the same way as done in the Kernel: we put C files with the same name as in libfdt into lib/ and just include the libfdt files from there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-09-122-10/+12
|\ \
| * | libfile: fix typosMichael Tretter2019-09-061-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | libfile: have write_full return a descriptive error codeAhmad Fatoum2019-08-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far (p|)write_full has been returning -1 on error. Some callers of write_full like imx_bbu_write_device print out the function's return value on error, effectively rendering every printed error message to be due to EPERM. On the other hand, some callers like do_memcpy, use it correctly and use errno. Sidestep the issue by having the function return -errno on errors as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | gui: png_lode: fix freeing of uninitialized pointerAhmad Fatoum2019-08-301-6/+7
| |/ | | | | | | | | | | | | | | | | If either calloc or png_uncompress_init fails, free(png) will free the uninitialized png pointer. Avoid this and while at it postpone the img allocation till after the early exit. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: add generic CONFIG_UBSAN plumbingAhmad Fatoum2019-09-094-0/+569
| | | | | | | | | | | | | | | | | | | | | | | | | | | | -fsanitize=undefined allows compile-time instrumentation of code to detect some classes of runtime undefined behavior. In preparation for allowing arches to provide infrastructure in support of this feature, add some generic UBSAN options and associated plumbing. These are only shown in the debug menu when the arch selects the appropriate symbol. The option is named equally to their Linux counterparts. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: add HAVE_EFFICIENT_UNALIGNED_ACCESS Kconfig optionAhmad Fatoum2019-08-301-0/+3
| | | | | | | | | | | | | | | | | | | | The LZO, LZ4, DEFLATE implementations in lib/ already check against CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS. Define this symbol defaulting to 0. This makes porting Kconfig symbols depending on it easier and in future, we could select it from different arches. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Kconfig: create Kconfig symbol for ARCH_HAS_DATA_ABORT_MASKAhmad Fatoum2019-08-301-0/+3
| | | | | | | | | | | | | | | | Other arch-specific features are exposed in Kconfig too, so do here likewise. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Kconfig: create Kconfig symbol for ARCH_HAS_STACK_DUMPAhmad Fatoum2019-08-301-0/+3
|/ | | | | | | | Other arch-specific features are exposed in Kconfig too, so do here likewise. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add missing arguments to memcpy_parse_options()Andrey Smirnov2019-07-091-3/+4
| | | | | | | | | | | | | Memcpy use-case differs from that of memcmp in default access type and destination file mode. This was missed in original commit that introduced memcpy_parse_options(). Add said parameters to memcpy_parse_options(), so the can be correctly specified depending on the use-case. Fixes: ddf4cca339 ("commands: Introduce memcpy_parse_options()") Reported-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-06-113-20/+61
|\
| * commands: Introduce memcpy_parse_options()Andrey Smirnov2019-05-281-0/+49
| | | | | | | | | | | | | | | | | | Both memcpy and memcmp have identical options, so in order to share code between them, introduce memcpy_parse_options() and change both tools to use it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * libbb: Drop simple_itoa()Andrey Smirnov2019-05-281-14/+0
| | | | | | | | | | | | | | | | | | Hush is the only one user of simple_itoa() and the code there can be re-implemented using snprintf(). Change the code to get rid of simple_itoa(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * libfile: Do not return 0 from write_full()Andrey Smirnov2019-05-281-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | None of the callers of write_full() expect a zero return value. Given how the documentation explicitly states that either all of the buffer is going to be written out or an error generated, treat 0 retrun from write() as a error, set errno to ENOSPC and return -1. Same logic applies to pwrite_full() as well, so make the change there while at it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * libfile: Simplify read_full()Andrey Smirnov2019-05-281-4/+2
| | | | | | | | | | | | | | | | We can figure out the amount of written data by substracting 'insize' from 'size' so there is no need to keep a separate counter for that. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: select BASE64 if BLOBGEN is selectedRouven Czerwinski2019-05-241-0/+1
|/ | | | | | | | Blobgen requires the BASE64 libraries, select them to provide them if BLOBGEN is selected. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>