summaryrefslogtreecommitdiffstats
path: root/lib/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* lib: remove duplicate __div64_32Ahmad Fatoum2021-02-191-2/+0
| | | | | | | | | | | | f933da28cf3f ("include: <linux/math64.h>: sync with upstream") imported the div64 code from Linux, which also defines __div64_32 as a weak symbol. __div64_32 was defined before in a separate file though and used from do_div. Remove this duplication. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: <linux/math64.h>: sync with upstreamAhmad Fatoum2021-01-071-0/+1
| | | | | | | | | | | | | | | | | | The header implements definitions for the 64-bit division helpers on 64-bit builds only. For 32-bit builds, it can only provide prototypes and the actual implementation will need to come from elsewhere. We didn't have any out-of-line definitions in barebox with the result that functions like div_s64_rem() were so far only usable in 64-bit barebox builds. On 32-bit builds, they would result in a linker error. Import the Linux v5.11-rc1 generic out-of-line 64-bit math on 32-bit implementation to fix this. While at it, synchronize the header to reduce diff to upstream. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add KASan supportSascha Hauer2020-09-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KernelAddressSANitizer (KASAN) is a dynamic memory error detector. It provides a fast and comprehensive solution for finding use-after-free and out-of-bounds bugs. This adds support for KASan to barebox. It is basically a stripped down version taken from the Linux Kernel as of v5.9-rc1. Quoting the initial Linux commit 0b24becc810d ("kasan: add kernel address sanitizer infrastructure") describes what KASan does: | KASAN uses compile-time instrumentation for checking every memory access, | therefore GCC > v4.9.2 required. v4.9.2 almost works, but has issues with | putting symbol aliases into the wrong section, which breaks kasan | instrumentation of globals. | | Basic idea: | | The main idea of KASAN is to use shadow memory to record whether each byte | of memory is safe to access or not, and use compiler's instrumentation to | check the shadow memory on each memory access. | | Address sanitizer uses 1/8 of the memory addressable in kernel for shadow | memory and uses direct mapping with a scale and offset to translate a | memory address to its corresponding shadow address. | | For every 8 bytes there is one corresponding byte of shadow memory. | The following encoding used for each shadow byte: 0 means that all 8 bytes | of the corresponding memory region are valid for access; k (1 <= k <= 7) | means that the first k bytes are valid for access, and other (8 - k) bytes | are not; Any negative value indicates that the entire 8-bytes are | inaccessible. Different negative values used to distinguish between | different kinds of inaccessible memory (redzones, freed memory) (see | mm/kasan/kasan.h). | | To be able to detect accesses to bad memory we need a special compiler. | Such compiler inserts a specific function calls (__asan_load*(addr), | __asan_store*(addr)) before each memory access of size 1, 2, 4, 8 or 16. | | These functions check whether memory region is valid to access or not by | checking corresponding shadow memory. If access is not valid an error | printed. 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>
* 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/qemu'Sascha Hauer2019-09-121-0/+9
|\
| * Compile libfdt for bareboxSascha Hauer2019-08-191-0/+10
| | | | | | | | | | | | | | | | | | 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>
* | common: add generic CONFIG_UBSAN plumbingAhmad Fatoum2019-09-091-0/+3
|/ | | | | | | | | | | | | | -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 blobgen frameworkSteffen Trumtrar2019-04-121-0/+1
| | | | | | | | | | | This adds a framework for en/decrypting data blobs. Some SoCs have support for hardware crypto engines that can en/decrypt using keys that a tied to the SoC and are visible for the crypto hardware only. With this patch it's possible to encrypt confidential data using these keys and to decrypt it later for usage. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: add base64 helpersSteffen Trumtrar2019-04-121-0/+1
| | | | | | | Import the busybox-1.23.1 uuencode/base64 helper functions. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add Freescale QUICC Engine firmware supportSascha Hauer2019-03-131-0/+1
| | | | | | | The Freescale QUICC Engine found on Layerscape SoCs needs firmware loaded. This adds support for loading such a firmware. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Port basic Linux kernel NLS functionsAndrey Smirnov2019-02-221-0/+1
| | | | | | | | | Port basic Linux kernel NLS functions: utf8_to_utf32() and utf8s_to_utf16s() in order to support porting kernel code that uses them. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add generic implementation for muldi3Martin Hofmann2019-01-071-0/+1
| | | | | | | | | | | | | | Since version v2018.08.0 some shared copies of gcc routines got added to barebox so that archs don't need to have their own copy inside their lib. The arch I am working on atm also needs support for muldi3 which is not present as a generic version right now. This patch adds the generic version from latest linux v4.20 to barebox and lets the archs select it in their Kconfig so they don't need to provide it themself. Signed-off-by: Martin Hofmann <martin.hofmann_at_mni.thm.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2018-11-091-0/+1
|\
| * lib: Port CRC8 implementation from Linux kernelAndrey Smirnov2018-11-061-0/+1
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: Port kstrtox.c from Linux kernelAndrey Smirnov2018-10-291-0/+1
|/ | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add shared copies of some GCC library routinesAntony Pavlov2018-06-291-0/+7
| | | | | | | | | | | | | | | | | | | This commit is based on these linux kernel commits: | commit b35cd9884fa5d81c9d5e7f57c9d03264ae2bd835 | Author: Palmer Dabbelt <palmer@dabbelt.com> | Date: Tue May 23 10:28:26 2017 -0700 | | lib: Add shared copies of some GCC library routines | | commit e3d5980568fdf83c15a5a3c8ddca1590551ab7a2 | Author: Matt Redfearn <matt.redfearn@mips.com> | Date: Wed Apr 11 08:50:17 2018 +0100 | | lib: Rename compiler intrinsic selects to GENERIC_LIB_* Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Port CRC-CCITT functions from Linux kernelAndrey Smirnov2018-04-031-0/+1
| | | | | | | | Port CRC-CCITT implemenation in order to support porting MFD driver for RAVE SP. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: add weak clz/ctz functionsLucas Stach2018-02-211-0/+1
| | | | | | | | | | | | This is a copy of the Linux kernel implementation. This adds weak functions for the clz and ctz gcc builtins. Normally GCC will map those builtins to CPU instructions directly, but for CPUs where those are unavailable, we need to provide a fallback implementation. Fixes build of the zlib decompressor on ARMv4 CPUs. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add zstd decompression modulePhilipp Zabel2018-02-051-0/+1
| | | | | | | Based on kernel commit 73f3d1b48f50 ("lib: Add zstd modules"). Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add xxhash modulePhilipp Zabel2018-02-051-0/+1
| | | | | | | Based on kernel commit 5d2405227a9e ("lib: Add xxhash module"). Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-01-221-0/+1
|\
| * move parseopt to lib/Antony Pavlov2018-01-171-0/+1
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Add support for fastboot sparse imagesSascha Hauer2018-01-171-0/+1
|/ | | | | | | | This adds support for reading Android fastboot sparse images. This code is based on the corresponding U-Boot code, but has been heavily modified to provide a read-like API which better fits into barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add Kconfig symbol for FNMATCHSascha Hauer2016-07-251-1/+1
| | | | | | | fnmatch is useful on its own, so make a separate Kconfig symbol and select it from GLOB. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video/edid: Move int_sqrt() outAndrey Smirnov2016-06-301-0/+1
| | | | | | | | Move int_sqrt() out of drivers/video/edid.c so that it is availible to other parts of Barebox. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add list_sort from u-boot v2016.03Alexander Stein2016-04-081-0/+1
| | | | | | | This is required by UBIFS update. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove now unused libmtdSascha Hauer2016-04-061-1/+0
| | | | | | | The only user of libmtd was ubiformat which now uses the mtd-peb API, so remove the now unused libmtd. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ratp'Sascha Hauer2016-02-081-0/+1
|\
| * Add Reliable Asynchronous Transfer ProtocolSascha Hauer2016-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | lib: Import reed solomon code from kernelMarkus Pargmann2015-12-101-0/+1
|/ | | | | | | | 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>
* Merge branch 'for-next/logo'Sascha Hauer2015-08-061-0/+1
|\
| * Add new barebox logo to the treeSascha Hauer2015-07-201-0/+1
| | | | | | | | | | | | | | | | 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>
* | import lib/fonts framework from linux kernelAntony Pavlov2015-07-161-0/+1
|/ | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add hex2bin and bin2hex implementationsSascha Hauer2015-03-131-0/+1
| | | | | | | 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>
* Merge branch 'for-next/rockchip'Sascha Hauer2015-03-091-0/+1
|\ | | | | | | | | Conflicts: arch/arm/Kconfig
| * lib: Add gcd() functionAndrey Panov2015-03-051-0/+1
| | | | | | | | | | | | | | It calculates greatest common divisor. Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | move cmdline partition parsing code to separate fileSascha Hauer2015-02-121-0/+1
|/ | | | | | | 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>
* Add PBL console supportSascha Hauer2015-01-051-0/+2
| | | | | | | | | | | 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>
* printf: move simple_strto*() functions to separate fileSascha Hauer2015-01-051-0/+1
| | | | | | These are not needed in the PBL, so move them to a separate file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add xz decompression supportSascha Hauer2014-11-041-0/+1
| | | | | | | | This adds xz decompression support from the kernel. Both compressing the barebox binary with xz and decompressing xz files on the commandline is supported. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rtc'Sascha Hauer2014-08-071-0/+1
|\ | | | | | | | | | | Conflicts: arch/mips/dts/jz4755.dtsi commands/Makefile
| * lib: import 'bcd' from linux-3.15Antony Pavlov2014-07-311-0/+1
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2014-08-071-0/+1
|\ \ | | | | | | | | | | | | Conflicts: lib/Makefile
| * | lib: Add bitmap functions from kernelSascha Hauer2014-07-171-0/+1
| |/ | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/metadata'Sascha Hauer2014-08-071-1/+1
|\ \ | | | | | | | | | | | | | | | | | | Conflicts: arch/arm/dts/Makefile common/Makefile lib/Makefile
| * | move file helper functions to separate fileSascha Hauer2014-08-071-1/+1
| |/ | | | | | | | | | | | | | | | | | | We have our file helper functions in several places. Move them all to lib/libfile.c. With this we no longer have file helpers in fs/fs.c which contains the core fs functions and no functions in lib/libbb.c which are not from busybox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / Add beginning wchar supportSascha Hauer2014-07-141-0/+1
|/ | | | | | | | EFI uses 16 bit character strings. Add beginning support for this. Since barebox uses 8 bit strings internally we need conversion functions to convert between 16 bit and 8 bit strings. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: fix whitespace, drop blank lines at EOFAntony Pavlov2014-01-061-1/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2013-08-051-0/+1
|\