summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/jsmn'Sascha Hauer2023-01-204-0/+507
|\
| * vsprintf: implement %pJP for printing JSONPathsAhmad Fatoum2023-01-101-0/+44
| | | | | | | | | | | | | | | | | | | | We use an array of strings to represnt a JSONPath. Add a new %pJP format specifier that can be used to print them. This is useful for error messages when the lookup fails. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230110084930.3439001-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: extend jsmn with simple JSONPath lookup helpersAhmad Fatoum2023-01-101-0/+86
| | | | | | | | | | | | | | | | | | | | | | Board code may not be interested in iterating fully over the JSON blob and instead just wants to lookup a value at a specific JSONPath. Add helpers to facilitate this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230110084930.3439001-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: add jsmn JSON parser supportAhmad Fatoum2023-01-103-0/+377
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Board code may require JSON support to parse factory data or to verify JSON web tokens in locked-down systems. Import the current master state[1] of JSMN, a minimalistic JSON parser, with slight changes to make it compile in barebox [1]: https://github.com/zserge/jsmn/commit/25647e6 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230110084930.3439001-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/kernelcode-helpers' into HEADSascha Hauer2023-01-171-0/+13
|\ \
| * | vsprintf: support %pOF format specifierAhmad Fatoum2023-01-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Supporting %pO* is easy enough and we have at least 50 instances in tree, where this can be used. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109151152.2052493-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | lib: provide stub Linux "generic" allocator APIAhmad Fatoum2023-01-163-0/+124
|/ / | | | | | | | | | | | | | | | | | | | | We may want to port the whole of the Linux generic allocator implementation in future as it would come in handy in drivers that need special memory for DMA. For now, support just the use case of the incoming Atmel NAND driver, which is mapping the whole of a mmio-sram. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111174023.1719129-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Rename struct device_d to deviceSascha Hauer2023-01-104-71/+86
|/ | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* KASan: fix handling of devices with MMIO above SDRAM memory regionAhmad Fatoum2022-12-131-0/+5
| | | | | | | | | | | | | | check_memory_region_inline will discard KASan reports before start of RAM as false positives. This is sufficient for i.MX SoCs where the RAM starts after all device MMIO regions. On the AT91, the EBI memory controller's memory region follows the SDRAM memory region. This results in a KASan warning the first time NAND is accessed. Record the end of the shadowed SDRAM area to fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221212163907.2356192-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* KASan: test_kasan: silence warning with newer GCCAhmad Fatoum2022-12-131-0/+2
| | | | | | | | | | | | Newer GCC will rightly complain about this being an out-of-bounds access. This is intended as the kasan command is meant to cause out-of-bounds accesses to test proper operation of KASan. Thus silence the warning for this specific instance. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221212163907.2356192-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Remove unused struct partitionSascha Hauer2022-11-231-1/+0
| | | | | | | | struct partition from include/partition.h is entirely unused. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20221117120604.3840211-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bitmap: Implement bitmap_*zalloc()Sascha Hauer2022-11-081-0/+10
| | | | | | | | Implement functions for allocating a bitmap. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20221107144524.489471-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: hexdump: make available for PBL debuggingAhmad Fatoum2022-11-022-4/+10
| | | | | | | | | | While we have puthexc_ll() for PBL use, for quick debugging or for debug prints with PBL_CONSOLE enabled, print_hex_dump_bytes() can come in handy. Build it for optional use in PBL as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221019123817.1659468-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: string: implement mempcpyAhmad Fatoum2022-11-021-0/+5
| | | | | | | | | | | | mempcpy(3) is a GNU libc extension that like stpcpy returns not the start of the destination buffer, but the first byte after its end. Provide it as it is useful when concatenating buffers or known-size strings. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221101064310.3227410-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* readline: Complete strings containing whitespaces correctlySascha Hauer2022-10-271-1/+6
| | | | | | | | | | | Completion strings containing whitespaces have to end up as a single argv[] argument, thus the whitespaces have to be escaped. Fix this. Ideally the whitespaces should only be escaped when we are outside of double or single quotes, but our completion currently doesn't trigger at all when invokes inside quotes, so we can ignore this case for now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-10-133-17/+16
|\
| * lib: random: add hwrng_get_crypto_bytesAhmad Fatoum2022-10-111-13/+12
| | | | | | | | | | | | | | | | | | | | | | We already have get_crypto_bytes to get access to hardware generated randomness. barebox as EFI loader would provide a handle for each HWRNG, so add a hwrng_get_crypto_bytes function that can be used to implement the load-side protocol. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221010061122.2084009-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lds: introduce <asm/barebox.lds.h>Ahmad Fatoum2022-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a separate linker script for each architecture and one more for PBL if supported. All linker scripts include <asm-generic/barebox.lds.h>. In future, we may want to use a linker script common to more than one architecture. Prepare for this by having each architecture define a <asm/barebox.lds.h>. Currently, these files contain little more than 1-2 #include directives, but this will change in later commits. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221010061122.2084009-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: replace errno_str() with %m printf format specifierAhmad Fatoum2022-10-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | Both errno_str() and printf("%m" end up calling strerror(). %m is more convenient to use, so switch over all instances to it. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221010061122.2084009-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Revert "lib: zstd: sync with Linux"Sascha Hauer2022-09-3037-9322/+6786
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was part of a larger series that made it possible to use other compression algos than LZO for device tree and to use zstd more widely for barebox and kernel compression. The latter zstd-related parts needed rework and were not merged, but the zstd update was applied. It broken in turn the UBIFS zstd support. As we get nothing out of the update without the not applied commits that need rework anyway, revert this commit. This reverts commit b4a9782d4f56333e897dccc35c2c27e2605f6b93. Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220929102537.1767458-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | zstd: fix assert() logicEnrico Scholz2022-09-281-1/+1
|/ | | | | | | | It should warn when condition does **not** hold Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220927172217.662321-1-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: parse_area_spec: guard against NULL pointer dereferenceAhmad Fatoum2022-09-121-0/+2
| | | | | | | | | | If mem_parse_options is called with an optstr containing x, but with swab == NULL, we will end up doing a NULL pointer dereference. Add a check that avoids this from happening. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905095557.596891-31-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-08-112-0/+41
|\
| * FIT: add first support for compressed imagesAhmad Fatoum2022-08-111-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FIT image contents are often compressed, but we got by so far, because a compressed initramfs is usually meant to be decompressed by the kernel (and so has compression = "none") and arm32 kernels had their own decompresser embedded. On ARM64, bootloader is responsible for uncompressing kernel, so we should properly process the compression property we so far ignored. The decompression isn't as efficient as one would hope for, because the FIT format only describes length of the compressed data. We thus have two options: - define an output size up-front, e.g. by guessing the uncompressed buffer size for decompression or hardcoding it (e.g. U-Boot's CONFIG_SYS_BOOTM_LEN). - Uncompress to a file descriptor We choose the second one to play it safe, but it comes with worse performance because of extra memory copies. Intention is to go with first option for the kernel image: We know how much size we can spare for the kernel image and can have bootm_load_os uncompress there directly without intermittent memory copies. This would involve slight change to the barebox decompresser API to align it with the kernel's, which allows to have it accept and observe an output buffer size. So far, we had the kernel PREBOOT API, which lacks such a parameter, but that's an optimization for another day. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220809091946.3906847-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * logo: Fix Kconfig dependenciesAlexander Shiyan2022-06-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | WARNING: unmet direct dependencies detected for BMP Depends on [n]: IMAGE_RENDERER [=n] Selected by [y]: - BAREBOX_LOGO_BMP [=y] && <choice> Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220627102500.18427-6-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: zstd: sync with LinuxAhmad Fatoum2022-08-0837-6786/+9322
|/ | | | | | | | | Import the Linux v5.18.3 state of the zstd decompression code. The compressor was omitted and error strings were disabled for PBL. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220713100922.1880282-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-06-293-6/+6
|\
| * lib: parameter: Free previous string value in param_string_setRobin van der Gracht2022-06-161-1/+3
| | | | | | | | | | | | | | | | | | When the parameter has no set function the previous (saved_value) is not freed up on completion. Signed-off-by: Robin van der Gracht <robin@protonic.nl> Link: https://lore.barebox.org/20220616125040.212193-1-robin@protonic.nl Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: parameter: Do not modify pointer returned from xstrdup()Sascha Hauer2022-06-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The sequence value_new = xstrdup(val); value_new = strim(value_new) is buggy because we not free the pointer we originally allocated. Fix this by skipping the leading whitespaces from the original string. The bug itself never triggered because the string is never freed. That will be fixed in the next patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * read_file: Pass NULL for the size parameter if the return value is not usedAlexander Shiyan2022-06-101-2/+1
| | | | | | | | | | | | Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220609072629.15723-1-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: Remove duplicate incudesAlexander Shiyan2022-06-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warning fwterated by checkincludes.pl: ./net/nfs.c: libgen.h is included more than once. ./net/ifup.c: globalvar.h is included more than once. ./crypto/rsa.c: asm/types.h is included more than once. ./lib/decompress_unlz4.c: linux/decompress/mm.h is included more than once. ./scripts/stb_image.h: stdio.h is included more than once. ./scripts/kwbimage.c: unistd.h is included more than once. ./scripts/common.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/mman.h is included more than once. ./fs/pstore/ram_core.c: linux/rslib.h is included more than once. ./fs/pstore/fs.c: fs.h is included more than once. ./fs/pstore/fs.c: linux/pstore.h is included more than once. ./fs/nfs.c: fs.h is included more than once. ./fs/uimagefs.c: fs.h is included more than once. ./fs/fs.c: command.h is included more than once. ./arch/sandbox/board/hostfile.c: linux/err.h is included more than once. ./arch/sandbox/board/devices.c: mach/linux.h is included more than once. ./arch/sandbox/os/common.c: signal.h is included more than once. ./arch/arm/boards/zii-imx51-rdu1/board.c: envfs.h is included more than once. ./arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c: generated/mach-types.h is ./arch/arm/mach-stm32mp/ddrctrl.c: mach/stm32.h is included more than once. ./arch/arm/mach-imx/cpu_init.c: common.h is included more than once. ./arch/arm/mach-imx/imx8m.c: mach/imx8m-ccm-regs.h is included more than once. ./common/efi/payload/init.c: efi.h is included more than once. ./common/state/backend_format_raw.c: common.h is included more than once. ./common/state/backend_format_raw.c: crc.h is included more than once. ./common/hush.c: libbb.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/clk.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/err.h is included more than once. ./drivers/net/virtio.c: net.h is included more than once. ./drivers/net/phy/phy.c: linux/phy.h is included more than once. ./drivers/net/cpsw.c: net.h is included more than once. ./drivers/virtio/virtio_pci_common.h: linux/list.h is included more than once. ./drivers/usb/host/ohci-hcd.c: dma.h is included more than once. ./drivers/usb/gadget/fsl_udc.c: dma.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: spi/spi.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: of.h is included more than once. ./drivers/video/imx-ipu-v3/imx-ldb.c: linux/clk.h is included more than once. ./drivers/video/imx-ipu-v3/imx-hdmi.c: linux/clk.h is included more than once. ./drivers/video/omap.c: common.h is included more than once. ./drivers/mtd/nand/nand_s3c24xx.c: asm/sections.h is included more than once. ./drivers/clk/imx/clk-imx6sx.c: linux/clk.h is included more than once. ./drivers/clk/imx/clk-imx6sl.c: linux/clk.h is included more than once. ./commands/bootm.c: of.h is included more than once. Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220607051957.2497-1-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: logo: Ignore more generated filesAlexander Shiyan2022-06-101-10/+5
|/ | | | | | Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220610054051.4911-7-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-04-211-0/+25
|\
| * libfile: implement new pread_fullAhmad Fatoum2022-03-281-0/+25
| | | | | | | | | | | | | | | | We already have pwrite_full, add pread_full for symmetry. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220318144942.498124-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | hexdump: provide support for dev_print_hex_dump()Oleksij Rempel2022-04-191-8/+16
|/ | | | | | | | | In some cases we need to know the interface name of dumped hex. So, provide optional device_d pointer and use it to get device name. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20220413082205.429509-14-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/qoi'Sascha Hauer2022-02-187-15/+853
|\
| * logo: Add choice for the QOI image format optionJules Maselbas2022-01-203-1/+22
| | | | | | | | | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20220117230235.13549-6-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * logo: Enable image format selection for the logoJules Maselbas2022-01-203-15/+56
| | | | | | | | | | | | | | | | | | | | Enables the selection of an image format to be used for the built-in barebox logo. The default image format is set to png, has it was the only choice before. This also adds bmp as the other option. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20220117230235.13549-5-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * gui: Add qoi image formatJules Maselbas2022-01-204-0/+776
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "Quite OK Image Format", aka QOI, aims to be a fast, lossless image compression format, with comparable compression factor against png, and beeing faster to encode and decode. In barebox only care about decoding, the qoi image format might be an intresting alternative to both bmp and png, some kind of midle ground. The project home page can be found at https://qoiformat.org, there is a reference implementation, for both encoder and decoder, in a single header file (qoi.h) hosted at https://github.com/phoboslab/qoi. There is no plan for future version, this is a frozen format. In case the reference implementation should be updated, the qoi.h file must be copied to the lib/gui/qoi.h without requiring modifications. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20220117230235.13549-3-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/efi'Sascha Hauer2022-02-181-2/+2
|\ \
| * | rename cdev_open() -> cdev_open_by_name()Sascha Hauer2022-02-081-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | The cdev_* functions normally take a struct cdev * argument, with the exception of cdev_open(). Rename cdev_open() to cdev_open_by_name() to be able to implement cdev_open() with the expected semantics in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: add missing command groupsAhmad Fatoum2022-01-261-0/+1
|/ | | | | | | | | CMD_GRP_MISC is assumed in absence of an explicit group. Let's be explicit instead to silence the warnings during documentation build. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220124151827.3313412-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spdx'Sascha Hauer2022-01-1956-0/+106
|\
| * treewide: add SPDX-License-Identifier for files without explicit licenseAhmad Fatoum2022-01-0535-0/+66
| | | | | | | | | | | | | | | | | | Record GPL-2.0-only as license for all files lacking an explicit license statement. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: add SPDX-License-Identifier for .gitignoreAhmad Fatoum2022-01-051-0/+2
| | | | | | | | | | | | | | | | | | Makes the files not appear when searching for files that lack SPDX-License-Identifier. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: add SPDX-License-Identifier for Kbuild/KconfigAhmad Fatoum2022-01-0520-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To verify only Kconfig/Makefile is touched: git show --numstat --format=oneline HEAD | grep -v 'Kconfig\|Makefile' will print only arch/powerpc/Kbuild. To verify nothing unexpected is added: git show -U0 | grep '^-[^-]\|^+[^+]' | sort -u Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | getopt: Add support for '+' in optstringSascha Hauer2022-01-051-3/+14
| | | | | | | | | | | | | | Stop option parsing at nonoptions when the first character of optstring is '+'. This is analog to getopt(3). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | parseopt: drop unused, duplicate, parseopt_u16Ahmad Fatoum2022-01-051-31/+0
|/ | | | | | | | | | | We always have sizeof(unsigned short) == sizeof(uint16_t), so parseopt_u16() is exactly equivalent to parseopt_hu(). The former is unused anyway, so just drop it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120205.1728778-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: add new PRINTF_FULL optionAhmad Fatoum2021-12-141-0/+3
| | | | | | | | | | We now got three compile-time selectable printf format specifiers. For debugging, it can be useful to enable all of them, thus add a new PRINTF_FULL option. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211209105708.3517684-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* vsprintf: add support for printing raw buffers as hex (%*ph)Ahmad Fatoum2021-12-142-0/+53
| | | | | | | | | | | | | | | Import from Linux support for printing buffers as a hex string with a certain separator. For larger buffers consider using print_hex_dump(). Examples: %*ph 00 01 02 ... 3f %*phC 00:01:02: ... :3f %*phD 00-01-02- ... -3f %*phN 000102 ... 3f Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211209105708.3517684-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>