summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
| * lib: rename json_strcpy to json_strdupAhmad Fatoum2023-09-221-1/+1
| | | | | | | | | | | | | | | | | | jsmn_strcpy is an unfortunate name for a function that allocates memory. Rename it to jsmn_strdup instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230921102426.1109289-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: jsmn: add case-insensitive comparisonAhmad Fatoum2023-09-221-0/+12
| | | | | | | | | | | | | | | | | | Users may want to do a case-insensitive comparison of tokens. Add simple helpers for that. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230921102426.1109289-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: jsmn: add helper for allocating tokensAhmad Fatoum2023-09-221-0/+36
| | | | | | | | | | | | | | | | | | | | | | jsmn_parse can be called with a NULL buffer to determine the needed allocation size beforehand. Most users will go on to dynamically allocate that buffer, so add a helper that does just that and start using it to simplify the json selftest. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230921102426.1109289-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: jsmn: add and use new jsmn_token_size helperAhmad Fatoum2023-09-221-2/+2
| | | | | | | | | | | | | | | | | | To make code a bit more terse, add a simple helper to get a token's size and start using it in some of the existing jsmn helpers. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230921102426.1109289-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * decompressors: Update xz to include ARM64 BCJ decoderJules Maselbas2023-09-084-5/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | Update lib/xz/xz_dec_bcj.c and lib/xz/xz_private.h files from xz-embedded [1], which include spelling fixes and the new ARM64 BCJ decoder which was recently introduced into .xz file format version 1.1.0 (2022-12-11) [2]. [1] https://git.tukaani.org/?p=xz-embedded.git [2] https://tukaani.org/xz/xz-file-format-1.1.0.txt Signed-off-by: Jules Maselbas <jmaselbas@zdiv.net> Link: https://lore.barebox.org/20230907152047.102747-1-jmaselbas@zdiv.net Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/dump-stack-stderr'Sascha Hauer2023-09-252-13/+11
|\ \
| * | KASan: don't allocate memory while printing reportAhmad Fatoum2023-09-122-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logging functions call the pr_* family of functions, which not only add pretty-colored prefix, but also allocate memory appending to the log. While KASAN protects against recursion while printing the log, this can falsify debugging results, so let's ensure, we only print to stderr and nothing more. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230911125619.2782229-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | KASan: only print to stderrAhmad Fatoum2023-09-121-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | Part of KASan output, like the stack trace, is already printed to stderr, while some others are printed to stdout. Let's print everything to stderr as not to complicate debugging when stdout and stderr go to different consoles. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230911125619.2782229-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: mmu: catch stack overflowing into TTB with stack guard pageAhmad Fatoum2023-09-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While barebox stack is often quite generous, due to its default of 32K, bugs can make it overflow and on ARM, this clobbers the page tables leading to even harder to debug problems than usual. Let's add a 4K buffer zone between the page tables and the stack and configure the MMU to trap all accesses into it. Note that hitting the stack guard page can be silent if the exception handler places it's frame there. Still a hanging barebox may be better than an erratically behaving one. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230911150900.3584523-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: add stackprotector supportAhmad Fatoum2023-09-214-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC's "stack-protector" puts, at the beginning of functions, a canary value on the stack just before the return address, and validates the value just before actually returning. Stack based buffer overflows (that need to overwrite this return address) now also overwrite the canary, which gets detected and the attack is then neutralized via a barebox panic. Unlike Linux, we do not add support for the regular stack protector, as that relies on a heuristic to detect vulnerable functions, which is greatly improved upon by the later added strong stack protector. In return, we add a CONFIG_STACKPROTECTOR_ALL option that's missing in Linux: This turns out to be a nice way to find out, which functions lack a __prereloc (or __no_stack_protector) annotation as every function will access the canary and that fails if the function is called prior to relocation. We don't give it a prompt though, because it's only interesting for development. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230911150900.3584523-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: mark early C setup functions as __prerelocAhmad Fatoum2023-09-211-1/+1
|/ | | | | | | | | | | | | In preparation for adding stack protector support, we need to start marking functions run before the C environment is completely set up. Introduce a __prereloc attribute for this use case and an even stronger no noinstr (no instrumentation) attribute and start adding it at enough places for bareboxproper to start up with -fstack-protector-all. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230911150900.3584523-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: open_and_lseek(): move error messages to callersSascha Hauer2023-08-182-11/+7
| | | | | | | | | For some cases like in common/filetype.c the caller already prints an error message, so to avoid duplicated error messages leave it up to the caller to print an error. This also adds error messages to all callers where necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: open_and_lseek(): return error code on errorSascha Hauer2023-08-181-7/+12
| | | | | | | Some callers of open_and_lseek() expect an error code instead of -1 as return value, so consistently return an error code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bitmap: implement bitmap_{to,from}_arr{32,64}Ahmad Fatoum2023-06-231-0/+103
| | | | | | | | | | | Converting from a bitmap to a u32 or u64 array of bits and back can involve endianness conversions depending on platform. Import the Linux functions that take care of this. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230622072329.1339317-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2023-06-222-0/+17
|\
| * common: partitions: decouple from EFI GUID definitionAhmad Fatoum2023-06-082-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have three UUID/GUID definitions in barebox: - efi_guid_t: for EFI GUIDs - uuid_t: for RFC 4122/DCE 1.1 (Variant 1) UUIDs - guid_t: Apparently UUIDs stored in little-endian In preparation for switching efi_guid_t to be a special case of guid_t like in Linux, let's replace non-EFI uses of efi_guid_t with guid_t. This allows us to drop the efi.h header outside of EFI code. This also involves two replacements of efi_char16_t with wchar_t. This is ok, as we always build with -fshort-wchar. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230607120714.3083182-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc-fixes-sandbox'Sascha Hauer2023-06-221-0/+3
|\ \
| * | lib: make_directory: return -ENOMEM on allocation failureAhmad Fatoum2023-06-131-0/+3
| |/ | | | | | | | | | | | | | | | | mkdir calls strdup on the dir that's passed in, but doesn't account for allocation failure. Have it return -ENOMEM in that case. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612130239.1087599-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / string: import strverscmp_improved from systemdAhmad Fatoum2023-06-053-0/+173
|/ | | | | | | | | | | | | | | | | | | The Boot Loader specification now references the UAPI group's version format specification[1] on how blspec entries should be sorted. In preparation of aligning barebox entry sorting with the specification, import systemd's strverscmp_improved as strverscmp and add some tests for it. The selftest is called string.c, because it indirectly tests some string mangling function and in anticipation of adding more string tests in the future. [1]: https://uapi-group.org/specifications/specs/version_format_specification/#examples Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20230531062853.670751-4-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/kconfig-missing-firmware'Sascha Hauer2023-05-241-2/+0
|\
| * Kconfig: source Kconfig.include earlierSascha Hauer2023-05-021-2/+0
| | | | | | | | | | | | | | | | kconfig.include is included where first needed. Include it at the top so that all Kconfig files can use it. Link: https://lore.barebox.org/20230426090354.1350981-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | lib: genalloc: drop reliance on mmio-sram driverAhmad Fatoum2023-05-021-4/+6
|/ | | | | | | | | | | | The barebox mmio-sram driver just makes SRAMs available as /dev/sramX devices. The genalloc stub depended on it without selecting CONFIG_SRAM. Instead of making this dependency explicit, just call of_address_to_resource and have no dependency on CONFIG_SRAM at all. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230417125158.882170-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: use non-executable stack annotations for blobsAhmad Fatoum2023-05-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | We are building the non-sandbox platforms with -z noexecstack, because the ELF section attributes don't matter. This is different for sandbox, where we compile assembly files directly only for embedding blobs. This currently yields a build warning: binutils-2.39/bin/ld: warning: defaultenv/defaultenv-2-reboot-mode.bbenv.gz.o: missing .note.GNU-stack section implies executable stack binutils-2.39/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker Let's add the non-executable stack annotations, so sandbox may run with non-executable stack. This way we are left with a single linker warning that needs to be resolved: binutils-2.39/bin/ld: warning: barebox has a LOAD segment with RWX permissions Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20230424115548.114858-2-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2023-04-191-0/+16
|\
| * graphic_utils: add optional damage trackingPhilipp Zabel2023-04-111-0/+16
| | | | | | | | | | | | | | | | | | | | Annotate framebuffer updates with damage rectangles so drivers may implement partial updates for displays with an integrated framebuffer. This can speed up fbconsole. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.barebox.org/20230405122734.2348025-2-p.zabel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | libfile: don't leak file descriptors in compare_fileAhmad Fatoum2023-04-171-2/+4
|/ | | | | | | | | | | | | | | | | | | Depending on the state of environment, running while saveenv; do true; done Can quickly lead to: saving environment could not open /dev/mmc2.barebox-environment: error 24 saveenv: error 24 Because the leaked file descriptors gobble up the 128 we have preallocated. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230414152032.3783908-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: string: remove duplicated functionDenis Orlov2023-03-161-31/+17
| | | | | | | | | | | | | | | | | | | We have two functions that are doing the same thing: 'strncasecmp' and 'strnicmp'. The only difference between them is that the latter is correctly handling the len argument of 0. So rename it into the former one ('strncasecmp', as it is the POSIX name for this function), deleting the other implementation. As no one is actually using 'strnicmp', no other code requires any fixes. This change is effectively forwarded from the Linux commits 'lib/string.c: remove duplicated function' (hash cd514e727b18ff4d189b8e268db13729a4175091) and 'lib/string.c: remove strnicmp()' (hash af3cd13501eb04ca61d017ff4406f1cbffafdc04). Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20230316073650.4170874-1-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: Increase the initial RTO to 200msJules Maselbas2023-02-131-1/+1
| | | | | | | | | | | | | | | | | | The initial value for RTO is 100ms which might be a bit low. From the RFC916 the RTO is expected to have a lower and upper bound but values are not specified. The RFC916 also define the calculation of the RTO to be somewhere between 1.3 to 2.0 times the SRTT (which is currently defined to 100ms). Thus I propose to set the initial value of RTO to 200ms, to be 2.0 times greater than the initial SRTT. Moreover, the current runtime calculation for RTO is done in the function ratp_msg_done and has lower bound of 200ms: ri->srtt = (alpha * ri->srtt + (10 - alpha) * rtt) / 10; ri->rto = max(200, beta * ri->srtt / 10); Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20230207162055.10050-5-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: Fix retransmission for header-only packetsJules Maselbas2023-02-131-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using sendmsg_current to detect if a packet needs to be retransmitted is brittle as only packets containing data will ever be considered, packets only containing a header (without data) were never being retransmitted. The sendbuf_len is used to determine if a packets is being send or not, a non-zero length means that a packets is still being in the "try-send" state, the length is not set to zero when a valid SN is received. Retransmission issue can be easily reproduced with a physical UART (not cdc_acm over USB), by running the following command: while ratp-barebox-cli -b 115200 -t /dev/ttyACMx -p; do :; done Alternatively, it is possible to modify lib/ratp.c to force packets to be sent by the retransmission logic with the following change: @ int ratp_send_pkt(struct ratp_internal *ri, void *pkt, int length) ri->sendbuf_len = length; - ri->retransmission_timer_start = get_time_ns(); + ri->retransmission_timer_start = get_time_ns() - ri->rto * MSECOND/2; ri->retransmission_count = 0; } - return ri->ratp->send(ri->ratp, pkt, length); + return 0; Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20230207162055.10050-3-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: printk: retire printk_once for pr_debug_onceAhmad Fatoum2023-02-031-3/+2
| | | | | | | | | | printk is just printf and KERN_DEBUG is just "", so printk_once(KERN_DEBUG doesn't do what's promised. Replace instead with pr_debug_once, which does what one would expect. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230202133415.319020-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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>