| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
While very recent binutils releases have dedicated efi-*-aarch targets,
we may want to support older toolchains. For this reason, we import
the kernel's EFI stub PE fakery, so the same barebox-dt-2nd.img may be
loaded as if it were a "normal" or an EFI-stubbed kernel.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240304190038.3486881-87-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The EFI code will grow considerably with the addition of loader support,
so it makes sense to move it to top-level to shorten the path and to
improve visibility.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240304190038.3486881-8-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Linux has been configured with -std=gnu11 since v5.18 to benefit from
being able to declare variables in for loops init statements.
This is handy for barebox as well and should we adopt
__attribute__((cleanup)) to simplify resource management, it will become
required anyway, because define __attribute((cleanup)) variables much
earlier than they are used is needlessly cumbersome.
So let's do the switch.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20231122172951.376531-13-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For testing remoteproc and ELF loading mechanisms, it can be useful
to have the consumed ELF files result from the barebox build itself.
The *.pblb intermediate artifacts can be used for this purpose, but they
are at least 64K larger than need be, because of generous alignment in
addition to debug and symbol information.
Let's add a separate %.elf target, that behaves like %.pblb with the
difference that the result is stripped and alignment of sections on-disk
is disabled.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230913125715.2142524-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The barebox sourcetree contains a very outdated U-Boot mkimage tool.
The only purpose of this tool is to create a uImage barebox image which
can be used to start barebox 2nd stage from U-Boot. There is also a Make
target for generating such an image. This however predates PBL support
and is incompatible with PBL enabled barebox builds.
As the barebox.uimage target is not very useful nowadays remove it.
A recent mkimage is availabe in most Linux distributions as a host tool,
so remove the outdated version from barebox as well.
Link: https://lore.barebox.org/20230803065749.3827198-1-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Build systems integrating barebox may want to pass compiler and linker
options for when barebox is building target tools. This is especially
important when the compiler toolchain is configured without a sysroot
like in Yocto and the --sysroot option must be used. As there was no
option explicitly meant for this, userccflags is sometimes abused and
set in the environment[1][2].
While this appears to work, it breaks when setting userccflags as make
option instead of an environment variable. Let's just provide USERCFLAGS
and USERLDFLAGS explicitly for this use case.
This is an adaptation of Linux commit:
| commit f67695c9962e5f444549b3437fb8d840ec6222c8
| Author: Elliot Berman <quic_eberman@quicinc.com>
| Date: Tue Feb 1 13:35:42 2022 -0800
|
| Allow additional arguments be passed to userprogs compilation.
| Reproducible clang builds need to provide a sysroot and gcc path to
| ensure the same toolchain is used across hosts. KCFLAGS is not currently
| used for any user programs compilation, so add new USERCFLAGS and
| USERLDFLAGS which serves similar purpose as HOSTCFLAGS/HOSTLDFLAGS.
|
| Clang might detect GCC installation on hosts which have it installed
| to a default location in /. With addition of these environment
| variables, you can specify flags such as:
|
| $ make USERCFLAGS=--sysroot=/path/to/sysroot
|
| This can also be used to specify different sysroots such as musl or
| bionic which may be installed on the host in paths that the compiler
| may not search by default.
|
| Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
[1]: https://github.com/pengutronix/meta-ptx/blob/38ada68c70/recipes-bsp/barebox/barebox.inc#L91
[2]: https://lore.kernel.org/all/20230331104025.1478393-3-ejo@pengutronix.de/
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230727084812.880438-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Unlike Linux, barebox build system does build both host and
target tools in the same build, each using a different pkg-config.
This is done by using `pkg-config` for the host tools and
`$CROSS_PKG_CONFIG` for the target tools. In Yocto, `pkg-config` is for
target tools and `pkg-config-native` is for host tools, which we can't
represent with the current scheme.
The usual work around that Yocto employs for the kernel is to
override PKG_CONFIG_PATH to always point into the native sysroot and
resetting PKG_CONFIG_SYSROOT_DIR, but this breaks build of target tools
that use pkg-config.
Fix this by providing a PKG_CONFIG variable that can be overridden
when necessary.
This intentionally skips the scripts/kconfig directory to make it easier
to sync with the kernel. While we should eventually switch that over to
use PKG_CONFIG as well, Yocto will set PKG_CONFIG_PATH and
PKG_CONFIG_SYSROOT_DIR appropriately in cm1.bbclass' do_menuconfig, so
this can wait until the change is done to the kernel and synced back.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230727084812.880438-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The stickypage is a hack to have a 4K hostfile persist over reboot. This
was so far done by compiling the stickypage separately and referencing
it from the device tree via the magic $build variable that expands to
the working directory.
This breaks a number of assumptions:
- KBUILD_IMAGE: should only have a single entry, e.g.
barebox-flash-images ends up with two files per one line
- stickypage must be writable, which may fail if barebox is installed,
e.g. in r/o Nix Store
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230817073941.1261154-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Unless overridden by SORT*, LD will place sections matched by wildcards
in the order they were seen in the link. So far, this meant that
arch/ initcalls and device trees compiled into barebox proper, were
always last.
For platforms with PBL or with only one device tree in barebox proper,
this didn't matter much, but when enabling the of_manipulation selftest,
a second device tree would be built into barebox on kvx, openrisc and
some MIPS.
Because all directories appear before arch/, this had the effect that
on kvx, openrisc and some MIPS, __dtb_start would end up pointing at the
test's device tree instead of the board device tree breaking the build.
Switching the affected platforms to use PBL would be one fix for the
issue, but there's a simple one: let's just move test/ after arch/.
My preferred solution would've been to move arch/ at the first
beginning, but this may cause fallout for code that depended on specific
ordering of initcalls or other linker-defined lists.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230629065356.1119480-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For development, it may be useful to enforce warning-free builds.
Add a Kconfig option for this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230605063755.1438127-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Port silent mode detection to the future (post make-4.4) versions of gnu make.
Makefile contains the following piece of make code to detect if option -s is
specified on the command line.
ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
This code is executed by make at parse time and assumes that MAKEFLAGS
does not contain command line variable definitions. Currently if the
user defines a=s on the command line, then at build only time MAKEFLAGS
contains " -- a=s". However, starting with GNU Make commit dc2d963989b9
("Always add command line variable assignments to MAKEFLAGS") MAKEFLAGS
contains command line definitions at both parse time and build time.
This '-s' detection code then confuses a command line variable
definition which contains letter 's' with option -s.
$ # old make
$ make net/wireless/ocb.o a=s
CALL scripts/checksyscalls.sh
DESCEND objtool
$ # this a new make which defines makeflags at parse time
$ ~/src/gmake/make/l64/make net/wireless/ocb.o a=s
$
We can see here that the letter 's' from 'a=s' was confused with -s.
This patch checks for presence of -s using a method recommended by the
make manual here
https://www.gnu.org/software/make/manual/make.html#Testing-Flags.
Link: https://lists.gnu.org/archive/html/bug-make/2022-11/msg00190.html
Reported-by: Jan Palus <jpalus+gnu@fastmail.com>
Signed-off-by: Dmitry Goncharov <dgoncharov@users.sf.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
[ported from Linux commit 4bf73588165ba7d32131a043775557a54b6e1db5]
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230612125823.1087094-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As pointed out in [1], compilation failed if the prepare make
target was not called before compiling the imx-usb-loader, which caused
the generated file not to exist when building for the sandbox target and
broke the build.
After a discussion on the original thread, a different approach has been pursued
by simply adding utsrelease.h as a dependency to scripts.
[1] https://lore.barebox.org/barebox/20230525181320.2277320-1-ahmad@a3f.at/
Fixes: c1b50061f4b3 ("imx-usb-loader: add commandline option for displaying version number")
Reported-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230526165947.1079052-2-j.zink@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CROSS_PKG_CONFIG is referenced in both Kconfig and Makefiles. To be
visibile everywhere, its default needs to be exported, but it wasn't.
This wasn't noticed, because usual usage was:
CROSS_PKG_CONFIG=some-pkg-config make scripts
where the shell took care to export the variable. On NixOS, cross
pkg-config is actually called ${CROSS_COMPILE}pkg-config and it didn't
work out of the box. Fix this.
Fixes: 1c1198a3f252 ("scripts: allow building USB loader tools for target as well")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230411071436.1630752-12-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
All users of AM335x SPI images are multi-image, so the SPI image
generation code in arch/arm/Makefile is unused. Drop it.
Link: https://lore.barebox.org/20230302111606.1054037-10-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
All mvebu boards are multi-image, so they don't need image generation
in arch/arm/Makefile anymore. Drop it.
Link: https://lore.barebox.org/20230302111606.1054037-9-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The Zynq board in tree is converted to multi-image, thus doesn't
need image generation in arch/arm/Makefile anymore. Drop it.
Link: https://lore.barebox.org/20230302111606.1054037-8-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Users of GNU ld (BFD) from binutils 2.39+ will observe multiple
instances of a new warning when linking barebox and PBL in the form:
ld: warning: defaultenv/defaultenv-2-dfu.bbenv.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: .tmp_barebox1 has a LOAD segment with RWX permissions
We don't need executable stack, so disable with -z noexecstack. We also
do not use the permissions from ELF segments, so disable the warning
with --no-warn-rwx-segments.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The same linker flags are passed to both LDFLAGS_barebox and LDFLAGS_pbl.
Instead of duplicating it create a LDFLAGS_common variable for these
common flags.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Recent episode with pointer authentication showed again that for
platforms without __attribute__((naked)), we are better off writing
the early header in assembly. We still want to keep the board specific
entry points in C for ease of use, so we have ENTRY_FUNCTION_WITHSTACK
generate two symbols:
- A 32-bit stack top value that's placed in .rodata
- An entry point with the normal C code, including stack-using
prologues
The new common assembly head code will access the stack pointer in a
position-independent manner and set it up, before continuing with the
C code. The barebox header is part of the common assembly head code
ensuring it's not moved around due to compiler code generation.
The common code will need access to board-specific entry point and stack
top. The former is readily available as the alias __pbl_board_entry.
The latter is a bit more complicated, as the symbol may not exist for
boards not using the common header in a multi-image build.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20221024065716.1215046-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/ /
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The aarch64 cross-compiler built with Yocto's kirkstone release
configures -mbranch-protection=standard as default.
The resulting PACIASP/AUTIASP instructions are interpreted as NOPs by
existing CPUs, but they increase image size and misalign the barebox
header in ENTRY_FUNCTION(). Also on ARMv8.3+, where they serve a
purpose, we wouldn't benefit from them as we don't setup any pointer
authentication keys. Thus disable it.
The misaligned barebox header caused is_barebox_arm_head to fail,
breaking all code that verified barebox' header, like i.MX8MM
imx-usb-loader barebox-side support and barebox_update for
some ARM64 SoCs without a SoC-specific header.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20221019135322.2283270-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|