| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
CONFIG_MXS_HOSTTOOLS currently only builds the tools mxsimage and
mxsboot, which are both only needed to create bootable images for the
MXS platform, and are not really useful as stand-alone host tools.
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
dc7f1fce6747 ("sandbox: fix SANDBOX_UNWIND dependency to be KASAN
only") already restricted ARCH_HAS_STACK_DUMP to be dependent
only on AddressSanitizer being available.
This change got lost by an erroneous merge conflict resolution in
39bdcdfb814a ("Merge branch 'for-next/misc' into master"). Fix it up.
Fixes: 39bdcdfb814a ("Merge branch 'for-next/misc' into master")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Recent commits have modified sandbox for easier support of many common
features:
- block devices
- watchdogs
- reset source
- reboot mode
- barebox state
Enable those in defconfig along with some other useful options.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For testing barebox-state, it would be nice to have a state
pre-configured out-of-the-box. Add one to sandbox.dts.
Because the barebox message on an non-configured state can looks
quite scary, add an init script that tells the user that all
is well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Add SIGALRM based watchdog driver. This can reset barebox if stuck and
plays nicely with $global.system.reset.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Having a default reboot mode in the device tree allows testing the
functionality out of sandbox without prior setup.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
We can differentiate between POR and RST by explicitly storing RST as
reset reason when we invoke the reset handler. Do so.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Follow-up will extend the poweroff driver to support system reset source.
Set the stage by renaming the driver to power (as it does reset as well)
and make it probe from device tree, so it can point at the system reset
source syscon via phandle.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that we can define a hostfile that's persistent over barebox resets,
but does not rely on a hard coded filename, we can have an always-on
environment node.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, hostfils without a barebox,filename are assigned a new
temporary file on every start.
For use of a hostfile syscon for reboot mode or reset source, we will
need to persist the changes over a regular reset. This can easily be
done by passing through all automatically created temporary file with
an explicit --image option on subsequent runs. Do so.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
So far use of hostfile in the device tree required us to hard code a file
name. If we instead create a temporary file on demand, we can support:
- environment
- barebox-state
- syscon for reset source and reboot mode
out of the box with no dependency on external files.
Do the necessary, so a hostfile device tree node without a
barebox,filename gets a temporary file generated with the appropriate
size.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
801b7cff0210 ("sandbox: hostfile: allow probing from device tree") added
initial support for probing hostfiles out of a non-fixed up device tree.
This was achieved by having the driver probe call linux_open if the device
tree node doesn't contain a valid barebox,fd property. A mmap did not
happen in that case and as such the node couldn't be used as a syscon.
Fix this by unifying the binding for hostfiles added by --image and ones
already in the device tree. Both will result in a device node with just
a barebox,filename property. On pure init level, both kinds of hostfiles
will be iterated through and filenames will be opened and mmaped.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Follow up commits will flesh out the sandbox.dts and make most of what's
in the skeleton.dtsi redundant. Merge the .dtsi with the .dts to have
all the code at one place.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
hf->base may remain uninitialized if an image is > 4G, but sandbox
barebox is compiled for 32-bit. Fix this.
Reported-by: clang-analyzer-10
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The sandbox architecture is device tree only and so far when no --dtb
was passed, it created a basic one itself and used that.
Instead of creating the default device tree in C, just build the dtb
into barebox like we do on other platforms.
When --dtb is specified, that device tree will be used instead.
This results in functional change: Model and hostname are now more
accurate.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The different architectures duplicate some code around unflattening and
registering the device tree. Add common functions to reduce this
duplication.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Super I/O devices on x86 have their base usually located at one of two
I/O ports. They are probed by writing a "passcode" to the I/O port
and then a value is read back.
When COMPILE_TESTing these drivers and running them on sandbox,
this fails with a segfault because all I/O port access lead to
zero page dereference on that architecture. Even without running
barebox, static analyzers correctly flag these accesses as invoking
undefined behavior. Adding a dummy I/O region solves both issues.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
Indentation was unintentionally doubled. Fix this.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
While we can mount file systems on cdevs in barebox, partition table
parsing only works for block devices. Allow for
--image=argument,blkdev to try to mount an image as block device.
This will fail for files that aren't of a multiple of the 512 byte
block size. Host OS block devices are suitable for use as barebox
block devices always, so that's the default unless overridden with
a ,cdev suffix.
The initcall level has been changed to occur after fs initcall level.
This is required, because we can't have automounts without / mounted.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On Linux, /proc/self/exe is a symlink to the originally exec(2)d
executable. We can exec that with the original argv to simulate
a reset. This is useful for shorter development cycles on sandbox
and in future, could be used to test barebox behavior around resets
(e.g. reset reason can be passed through via libc environment).
We leave the original hanging reset in place though, because:
- Many boards have multiple reset providers and incoming patches
will allow users to select a specific one. Having this on
sandbox as well makes testing easier.
- /proc/self/exe is Linux-specific and wouldn't work when being
run on e.g. BSDs or macOS
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Typing reset in sandbox results in hang() while the terminal is not
cooked and ^C is ineffective. Only way to terminate barebox then is
via kill. Reinstate cooked mode on reset, so ^C termination is
possible.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
gcc v9.3.0's libubsan does not export a __sanitizer_print_stack_trace
symbol. Play it safe and avoid possible linker errors by having the
optional SANDBOX_UNWIND depend only on CONFIG_KASAN.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some tools like afl-fuzz generate file names containing commas.
Allow escaping the commas in the file names, so they can be passed
to barebox.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
BLKGETSIZE64 writes 64-bit to the address pointed at by the ioctl argument.
As hf->size is a 32-bit size_t on 32-bit systems, on such systems,
the adjacent member might be corrupted. Fix this.
Fixes: 8d6da6462b12 ("sandbox: add_image: mmap block devices")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The file descriptor is mandatory for doing anything useful.
Error out if we don't have one.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
For distro packaging, make it possible to build all host tools in one go
(and a very minimal barebox image as an unimportant side artifact).
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Unlike Linux, Barebox does not support 'make dtbs_install'.
There is no good reason to use dtb-y, which is not natively
supported by the Barebox build system.
Sandbox is the special architecture that compiles DTB as a
separate file. Add .dtb to always-y directly.
CONFIG_OFTREE is a bool option. Use a more Kbuild-ish style
instead of ifeq ($(CONFIG_OFTREE),y).
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
| |
sandbox really has ASan support, that is address sanitizer with the help
of the userspace library libasan. In contrast KASan is used on real
hardware where we have to implement our own support code. Rename sandbox
KASan to ASan to not clash with upcoming KASan support.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If we exit due to AddressSanitizer error, we remain in raw mode, which
is not best user experience. Currently every exit is an AddressSanitizer
death due to leaks. We want to encourage users to always have ASan
enabled, to catch more errors, thus call cookmode() on exit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
While we typically want to reuse as much barebox functionality as
possible in sandbox, using system malloc(3) instead can be very
useful when using external memory integrity tools. This is even
useful for AddressSanitizer, because the reports resulting from
the memory poisoning API are less detailed than the built-in
support for the libc malloc(3).
Note that a barebox "heap" is still allocated upfront. It's only
used for request_sdram_region now though. Whatever is allocated by
means of malloc and memalign will be ina disjunct heap.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
GCC reports:
./arch/sandbox/os/common.c: In function ‘add_image’:
./arch/sandbox/os/common.c:271:6: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
This is because hf->base is an unsigned long long, with the upper 32 bit
all-zeroes on 32-bit systems. The compiler doesn't see that though.
Change the cast, so we no longer warn.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The INTERNAL_SIZE_T default is size_t, which already is 64-bit on 64-bit
platforms and 32-bit on 32-bit ones. We can thus drop the #define and go
back to the minimal <asm/types.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
sizeof(dma_addr_t) == 8 shouldn't introduce any functional change, because
we can't have DMA on sandbox. For now it suppresses benign warnings about
mismatched pointer and integer sizes when some headers are included.
sizeof(phys_addr_t) == 8 was already the case on systems with
__x86_64__. As CONFIG_64BIT now is set according to the bitness
of the compiler, we can migrate this fully to Kconfig.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
Code under arch/sandbox/os is meant to link against the libc primitives
of the OS, not the barebox counterparts (e.g. for malloc).
54d47eb7e912 ("sandbox: support forcing 32-bit x86") broke this
rendering the sandbox architecture unusable. Fix this.
Reported-by: Peter Mamonov <pmamonov@gmail.com>
Fixes: 54d47eb7e912 ("sandbox: support forcing 32-bit x86")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
devname is strdup'd few lines later, so remove the earlier strdup.
The pointer isn't stored anywhere persistent in between.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For easier code-sharing, the UBIFS code still uses the Kernel's
atomic accessors. Provide a sandbox <asm/atomic.h> header, so we
can compile-test UBI under sandbox.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
With the DMA stubs in place, we can indicate HAS_DMA in good conscience.
Do so.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
For compile-testing drivers that use DMA operations under sandbox,
we want stub implementations of these. Provide them.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
For compile-testing drivers that use DMA operations under sandbox,
we want stub implementations of these. Provide them.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ARM <asm/io.h> defines the U-Boot style setbits/clrbits helpers.
Have sandbox follow suit to allow more drivers to be compile tested
there.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If gcc supports multiple architectures, barebox uses only the default
when compiling for ARCH=sandbox, this is e.g. the case with compilers
that generate both 32- and 64-bit x86 executables.
There can be good reasons to force 32-bit though, e.g. to reduce memory
consumption while fuzzing or to temporarily avoid 32-to-64-bit warnings,
while running the static analyzer. Add an option for this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that we have an accurate CONFIG_64BIT describing sandbox bitness,
we don't need to assume everything except __x86_64__ as 32-bit.
This assumes that sizeof(long) == sizeof(void *), which is assumed
anyway throughout the code base.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
All 64-bit architectures are supposed to define CONFIG_64BIT to support
the relevant 64-bit MMIO accessors. The sandbox architecture is a bit
of a special case, because barebox uses the toolchain default and
doesn't force a bitness. Add 64BIT as promptless symbol, which reflects
the pointer size of the target platform.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \
| |/
|/| |
|