| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
libbb contains a find_execable() function to find an executable in a
colon separated path. The code can be reused by making the environment
variable name and the is-executable test parameters. Do this and add
a find_path()
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210624085223.14616-6-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210623043359.18391-3-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The decompression algorithms want all of the requested buffer size
to be filled and don't cope with less bytes being returned.
Use read_full to satisfy this requirement.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://lore.barebox.org/20210526090216.4003977-1-l.stach@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If the input is out of the range of the allowed values, either larger
than the largest value or closer to zero than the smallest non-zero
allowed value, then a division by zero would occur.
In the case of input too large, the division by zero will occur on the
first iteration. The best result (largest allowed value) will be found
by always choosing the semi-convergent and excluding the denominator
based limit when finding it.
In the case of the input too small, the division by zero will occur on
the second iteration. The numerator based semi-convergent should not be
calculated to avoid the division by zero. But the semi-convergent vs
previous convergent test is still needed, which effectively chooses
between 0 (the previous convergent) vs the smallest allowed fraction
(best semi-convergent) as the result.
Fixes: 323dd2c3ed0 ("lib/math/rational.c: fix possible incorrect result from rational fractions helper")
Reported-by: Yiyuan Guo <yguoaz@gmail.com>
Signed-off-by: Trent Piepho <tpiepho@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
| |
Import rational_best_approximation() from Linux. This is used by an
upcoming update of the clk_fractional_divider code.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210602095507.24609-12-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
DFU, fastboot and incoming mass storage support all use file lists as
input, but individually check syntax correctness only on use.
A dedicated file list parameter would improve the user experience
and makes the code using it easier to handle: the struct file_list
can be passed around directly instead of having to parse it first
on use.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210503114901.13095-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We have many places across the code base that use either do
printf("%s..", errno_str()) or printf("%s..", strerror(errno).
We already have %pe support for printing arbitrary errors and it's not
much work to add %m to print errno as well. Do so.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210503114901.13095-5-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Both can be useful when parsing file paths. They are added to different
files, because only one of them is available in upstream
<linux/string.h>. The other we add to <string.h>, which contains more
barebox-specific string functions.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210503114901.13095-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use case is e.g. board code that wants to register a client to light
status LEDs to indicate system state when no serial output is available.
This functionality doesn't increase code size due to linker GC when
CONFIG_PROGRESS_NOTIFIER is disabled.
There is a generic progress notifier provided that just logs the
status. This could be shared with the booted kernel via pstore or
the log as a whole written to a system setup USB drive.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210503114901.13095-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
| |
char can be an unsigned type. To test the getchar() return value against
negative values we have to use a signed type. Use int instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Both seem to be a copy-paste left-over from the int param. They are
unused anywhere, so it's safe to just drop them.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| | |
Function to add an entry sorted to a string list only when it doesn't
exist.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We won't replace pollers with bthreads completely over night. To make
migration easier, replace explicit calls to poller_call with a new
resched() function. This can be made to call bthread_reschedule() in
future and eventually replaced with bthread_reschedule() once pollers
are removed.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We already return an error code unconditionally when building with
!CONFIG_GLOB. We need to do the same for globfree. Otherwise,
we run risk of corrupting memory.
This issue exists since the code was first added, but it became
more acute with 90cde3b9ff46 ("startup: Execute init scripts in
alphabetical order"), which added a globfree into the shell init.
Configuration without CONFIG_GLOB would from then on experience
memory corruption during startup.
Reported-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Files larger than 2G cause the benign bug, that the progress bar is no
longer accurate. Use loff_t to fix this.
Note that printed % HASHES_PER_LINE in show_progress implies a 64-bit
division. A previous commit changed the constant divisor to a power of
two, so a division shouldn't be generated. The original multiplication
and modulo operations are left as is for clarity.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Decreasing the progress bar length by one won't change visuals much,
but will allow the compiler to optimize a multiplication and a modulo
into bitwise operations.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
|
|
|
|
|
|
|
| |
<asm-generic/div64.h> isn't meant for direct usage as <asm/div64.h> may
override this on a per-architecture basis. We don't do that currently,
but in the future we might. Include the <linux/math64.h> instead.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
chunk_data_sz is set to the result of a __le32 * __le32 multiplication:
chunk_data_sz = si->sparse.blk_sz * si->chunk.chunk_sz;
This will overflow.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
| |
retlen can potentially overflow. Also, write_full() in
fastboot_handle_sparse() expects size_t anyway.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have the split by '=' snippet at multiple locations that parse
key=value pairs. Consolidate them to a single location. This makes code
a bit easier to read at the cost of an extra 8 bytes (LZO-compressed
THUMB2 barebox, static inline version is bigger).
No functional change.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
With the previous commit, we now explicitly tell GCC not to optimize
constructs like (1 << 31) under assumption that they are undefined
anyway. GCC >= 8.0 -fsanitize=undefined should now not warn any longer
about (1 << 31) instances, so remove our work around.
This reverts commit 55397b9ebe3a21a3aeb6a98131c0991bff0f7123.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \ |
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Barebox uses the zero page to trap NULL pointer dereferences. However,
if the SDRAM starts at address 0x0, this makes the first page of the
SDRAM inaccessible and makes it impossible to load images to offset 0x0
in the SDRAM.
Trapping NULL pointer dereferences on such systems is still desirable.
Therefore, add a function to disable the traps if accessing the zero
page is necessary and to re-enable the traps after the access is done.
The zero_page_memcpy function simplifies copying to the SDRAM, because
this is the most common required functionality, but memtest also
accesses the zero page and does not use memcpy.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \
| |/ /
|/| | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The size of the buffer allocated in the function is needed if it shall be
inspected more closely later. Therefore optionally return it via a new pointer
argument.
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The size of the buffer allocated in the function is needed if it shall be
inspected more closely later. Therefore optionally return it via a new pointer
argument.
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Using %pe instead of PTR_ERR has the benefit of being less verbose and
less error-prone (no negation necessary) while potentially reducing
code size. Make use of it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
strerrorp() is only used along with printf. We now have a format
specifier for printing error pointers directly, so use that and
remove strerrorp.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Starting with v5.5, Linux has a format specifier for printing error
pointers. We have had strerror in barebox before that, but lets wire it
into vsprintf with the same format specifier that Linux now uses.
This yields less verbose call sites and makes Linux drivers more portable
to barebox in future. This also has the potential to reduce code size as
the previously "inlined" strerror at callsites can now be replaced by
a single vsprintf.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
No functional change, but makes code bit more future proof when it is
extended.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \ \
| |_|_|/
|/| | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The current way to set a property with multiple values (e.g. compatible
strings) is to have
char properties[] = "st,stm32mp157c-dk2\0st,stm32mp157";
of_set_property(np, "compatible", properties, sizeof(properties), 1);
Add a new helper to make this easier at the cost of one runtime
reallocation:
of_property_write_strings(np, "compatible,
"st,stm32mp157c-dk2", "st,stm32mp157", NULL);
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The symbol used to exist, but was renamed in 6f37d9efd91 ("commands:
Move /dev/mem driver to drivers/misc") and then one instance without
definition was added back in cae5e14224f4 ("ratp: add more build
dependencies"). Fix it.
Fixes: cae5e14224f4 ("ratp: add more build dependencies")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Output currently looks like this:
CC commands/printenv.o
LOGO.S lib/logo/barebox-logo-w64.bblogo
CC arch/sandbox/board/devices.o
Drop one space, so it's aligned with the usual two letter prefixes.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
DISPLAY="" only affects X11 windows. Building sandbox_defconfig under
Wayland will still result in annoying Inkscape windows being opened.
This happens due to $(call try-run, inkscape -z,-z). Inkscape v1.0
deprecates -z and it's without an effect, so Inkscape will try
to create a window, which failed under x11, but succeeded under Wayland.
Fix this by always testing -z and -e together. We don't need one or
the other anyway, because Inkscape v1.0, which supports neither,
already uses no GUI for --export-type=png.
This makes DISPLAY="" unnecessary. So just drop it.
Tested working on Inkscape 1.0.1 and 0.92.4.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
UBSAN and ASAN as well as other debugging aids are all in the
Debugging menu. Relocate KASAN to be there as well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/ /
| |
| |
| |
| |
| |
| | |
Add missing test code.
Fixes: 6cd9d2d600 ("Add KASan support")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|