Commit Graph

1681 Commits

Author SHA1 Message Date
Simon Glass
4470f4f729 scripts: build-qemu: Move virtiofsd code into the helper
Move this code into the helper so that build-efi can use it too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 15:59:43 -06:00
Simon Glass
2a6a7e9716 scripts: build-qemu: Move qemu program-name to the helper
Put this in the helper so that we can (later) have it show the correct
error when the virtiofs daemon fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 15:59:43 -06:00
Simon Glass
a783a7ea64 scripts: build-qemu: Move memory size to the helper
Move this field to the helper so we can (later) have it set up the
virtiofs daemon.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 15:59:43 -06:00
Simon Glass
68ec2401ad scripts: Adjust EFI script to support an OS
At present the OS disk conflicts with the boot disk used to hold the
app (or payload). Number the OS disk after that.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 14:47:39 -06:00
Simon Glass
f7a683d3f3 scripts: Adjust EFI script to support a root disk
At present the root disk conflicts with the boot disk used to hold the
app (or payload). Use virtio for this disk and number the others after
that.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-05 11:49:30 -06:00
Simon Glass
3cf8c74bb7 scripts: Always use the RNG device with QEMU
There is no harm in always having this device enabled, thus reducing the
number of script arguments. Enable RNG always.

Series-to: concept
Series-version: 2
Series-changes: 2
- Use /dev/urandom instead, dropping the now-unnecessary arguments

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-07-30 13:42:18 +12:00
Simon Glass
3b8ed0cebb sandbox: Adjust how OS-interface files are built
The current mechanism uses a completely separate build rule for each
file which must be built with system headers.

Before adding any more files, adjust the scheme so that the flags are
handled in the common Makefile, with sandbox simply listing the files
affected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-23 20:19:42 -06:00
Simon Glass
5db07904c5 x86: emulation: Move the x86_64 build to Q35
Q35 is newer and has a native PCI Express bus. Move to using this by
default.

Update the QEMU script to select the correct machine.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-22 14:39:37 -06:00
Simon Glass
a4a1a69412 acpi: Provide a way to build in a boot logo
EFI has a Boot Graphics Record Table which can be used to show a logo
when booting up and shutting down.

Add support for adding this to the image, using a U-Boot logo which
includes the name, since many people will be unfamiliar with the logo.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-11 21:12:11 +02:00
Simon Glass
4f8548284b scripts: Make the build rule for the logo more specific
This rule assumes that any .bmp file relates to the logo. We want to be
able to add a second BMP in some cases, so update the rule to match
a filename ending in '_logo.bmp'

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-11 21:12:11 +02:00
Simon Glass
cbc27536ff scripts: build-qemu: Support a random-number generator
Add a --rand option to enable access to /dev/random from QEMU.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-10 07:26:51 +02:00
Simon Glass
1492937d63 scripts: Allow -d to specify multiple disks in build_helper
Sometimes it is useful to provide several disks to QEMU. Update the -d
flag to support this. It can be used like this:

   scripts/build-qemu -d root.img mmc6.img -r

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-09 23:11:32 +02:00
Simon Glass
b3d8820e98 scripts: Support a root disk connected via virtio-scsi
Sometimes it is useful to use SCSI instead of the plain virtio. Add a
-S option to connect the root disk via SCSI.

Drop the -S for --sct-seq since it is a less common option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-02 12:34:59 -06:00
Simon Glass
65d7446e31 scripts: Move root-disk processing to helper
The build-efi and build-qemu scripts have common code to set up the root
disk. Move it to build_helper to avoid duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-02 12:34:59 -06:00
Simon Glass
fcc852c0f0 scripts: Move OS selection into the helper
Both scripts allow booting from an ISO containing an OS, so move this
handling into the common helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:25:33 -06:00
Simon Glass
e2e338d4f1 scripts: Move bitness and os_arch to helper
These two concepts are used in both scripts, so move them to the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:58 -06:00
Simon Glass
f8de2c4048 scripts: Move some QEMU-arg building into build_helper
Providing a kernel, initrd and related options are useful in the EFI app
too, so move them into the common code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:58 -06:00
Simon Glass
cd73d77f92 scripts: build-efi: Use --write-kernel instead of -K
We want to use the -K option for providing a kernel via QEMU's QFW
interface. Perhaps we could use the same option and require that the
file be provided always, but that is less convenient.

For now, rename the option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:58 -06:00
Simon Glass
686ee0523a scripts: build-efi: Use -a instead of -A
It seems better to specify the arch rather than using somewhat cryptic
flags. The build-qemu scripts uses -a (for Architecture) so do the same
for build-efi

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-06-30 14:14:58 -06:00
Simon Glass
12e532f710 scripts: build-efi: Drop the -a option
This is not really needed, since it is the default and we have -p to
select the payload. It also conflicts with -a in build-qemu

Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:58 -06:00
Simon Glass
ce85d868e1 scripts: Use the same main() approach fo both scripts
Add a main() function for EFI and adjust the scripts to look the same in
this area.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:57 -06:00
Simon Glass
c44dd6832c scripts: Move common arguments into build_helper.py
The two main QEMU scripts (build-efi and build-qemu) share some common
arguments, so put them in the common file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:57 -06:00
Simon Glass
c9832707e3 scripts: Drop unwanted Stage() function from build_helper
This was brought in from another script by mistake but isn't needed.
Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:57 -06:00
Simon Glass
72afce26be scripts: Add a script check consistency of linker lists
If linker lists have inconsistent alignment it can cause strange
runtime errors. Add a script that can detect and report these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-29 06:53:46 -06:00
Simon Glass
8001779b9b scripts: build-qemu: Support running qboot
Qboot is a good demonstration of the fastest possible boot on x86. Add
a way to run Qboot instead of U-Boot, for easy comparison.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-12 19:43:54 +00:00
Simon Glass
2d461a7186 scripts: build-qemu: Add a way to set the linux root
Add -t and -U flags to set the root for Linux, to a device or a UUID,
respectively.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-12 19:43:54 +00:00
Simon Glass
b6f9ded4bc scripts: build-qemu: Add a way to enable linux console
Add a -C flag to enable the serial console when booting Linux. This is
only supported on x86, but a future -c flag might perhaps support other
archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-12 19:43:54 +00:00
Simon Glass
8f28573146 scripts: build-qemu: Add a way to pass kernel and ramdisk
QEMU provides a special way to pass a kernel and a devicetree via the
QFW interface. Add -K and -I options to provide these.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-12 19:43:54 +00:00
Simon Glass
b3743e7120 scripts: build-qemu: Fix message when creating config file
The message is missing an f-string specifier. Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-12 19:43:54 +00:00
Simon Glass
e18a8940a6 scripts: Update build-efi to allow firmware settings
At present the -bios option is used to specify the firmware, but this does
not allow settings to be adjusted.

Use the pflash method instead, with a separate variables file, so that
settings can be changed.

Add a -g option to tell QEMU to stop and wait for gdb to connect.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
a69d83f77a scripts: Update build-efi to support debugging with QEMU
Add a -g option to tell QEMU to stop and wait for gdb to connect.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
026ca64102 scripts: Update build-efi to support passing a root disk
Add a -d option to specify a root disk to boot with.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
4d22a33cf6 scripts: Update build-efi to allow showing the QEMU cmdline
Add a -v option for verbose output. For now this just shows the QEMU
cmdline before starting it. This allows the user to start it separately,
perhaps tweaking the args.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
680591f692 scripts: Update build-efi to support booting an OS
Bring this script into line with build-qemu so an OS and release can be
specified. As with that script, only Ubuntu is supported for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
e70d3b6ab8 scripts: Update build-efi to support kvm
This is a useful feature when booting the EFI app, so add this option to
the build-efi script too, matching the same option in build-qemu

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
ab87f396c5 scripts: Change -k and -o options
These have a different meaning in build-qemu, so capitalise these
options to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
c2bfe755fd scripts: Tidy up build-qemu a little
This provides a few clean-ups:

- sort the imports correctly
- sort the arguments (-v is in the wrong place)
- use os_arch for the OS architecture, to match build-efi

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Tom Rini
bf030467d2 Merge patch series "Update kbuild"
Ilias Apalodimas <ilias.apalodimas@linaro.org> says:

Last time the kbuild scripts were synced with the Linux kernel was on the
4.20 release. Updating directly to 6.x makes the diff difficult to read, so
let's do the changes incrementally and bump to 5.1 first.

Since the number of commits is big, I am splitting this in multiple series.
This one includes most of the commits for Makefile.build,
Makefile.lib and some from Makefile.

commit eeb5687a7139649e ("kbuild: add -Werror=strict-prototypes flag unconditionally")
commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top Makefile for old Make versions")
commit b421b8a6cb87 ("kbuild: remove unused archmrproper")
commit 1a49b2fd8f58 ("kbuild: strip whitespace in cmd_record_mcount findstring")
commit 88110713ca9dfb ("kbuild: hardcode genksyms path and remove GENKSYMS variable")
commit 1d8001ef358 ("kbuild: generate modules.order only when CONFIG_MODULES=y")
commit 45c4372d00 ("kbuild: refactor quiet_modtag")
commit b39a691617e4 commit ("kbuild: remove redundant quiet_modtag for $(obj-m)")
commit 5439f09f488f ("kbuild: remove redundant 'set -e' from cmd_* defines")
commit e5d289100d3a ("kbuild: remove trailing semicolon from cmd_* passed to if_changed_rule")
commit 3a2429e1faf4 ("kbuild: change if_changed_rule for multi-line recipe")
commit ee3e46b7efd2 ("kbuild: refactor modversions build rules")
commit 4317ee3b6a5e ("kbuild: remove redundant 'set -e' from sub_cmd_record_mcount")
commit 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files")
commit 898f5a009f22 ("kbuild: move archive command to scripts/Makefile.lib")
commit b79c6aa6a1f1 ("kbuild: remove unnecessary in-subshell execution")
commit afa974b77128 ("kbuild: add real-prereqs shorthand for $(filter-out FORCE,$^)")
commit ecbd10d90e94 ("kbuild: simplify rules of data compression with size appending")
commit 58156ba4468f ("kbuild: skip 'addtree' and 'flags' magic for external module build")
commit 172caf1993b7 ("kbuild: remove redundant target cleaning on failure")
commit f3fd4a3f3a38 ("kbuild: remove redundant 'set -e' from filechk_offsets")
commit a2237fec1e06 ("kbuild: Enable dtc graph_port warning by default")
commit 70523a3ce5ff ("kbuild: disable dtc simple_bus_reg warnings by default")
commit e4aca4595005 ("kbuild: de-duplicate fixdep usage")

Link: https://lore.kernel.org/r/20250520052153.307194-1-ilias.apalodimas@linaro.org
2025-05-31 10:07:09 +01:00
Simon Glass
e60873c8f3 passage: Support an incoming passage
Plumb in the ability for U-Boot proper to accept an incoming standard
passage from a previous phase, such as SPL or TF-A. This allows data to
be passed from binary to binary when firmware is booting.

Series-changes: 2
- Rebase to master
- Rework global_data for new stdpass convention

Series-changes: 3
- Move passage.h into this patch
- Add passage_valid() to decide if stdpass was provided
- Move arch_passage_entry() into this patch
- Make the global_data fields present only when needed

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-29 17:21:36 +01:00
Simon Glass
6c1e1062ac scripts: build-qemu: Support xPL with ARM
Add a -x flag to build/run xPL instead of the normal build.

Series-changes: 5
- Add RFC for test script

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-29 17:21:36 +01:00
Simon Glass
3693046cc4 Revert "efi_loader: Move public cert for capsules to .rodata"
The dtb part of this patch was rejected a few years ago[1][2]

It seems to have crept in under another name.

With signatures in U-Boot itself it is difficult to insert signatures
after U-Boot itself is built. The devicetree approach is more flexible,
since it can be updates by Binman or other build processes.

This reverts commit 261b422aed.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20210802014621.2280899-1-sjg@chromium.org/
[2] https://lore.kernel.org/u-boot/CAPnjgZ1UiJVHxe2qD3GrYO2LBrXWazXsqP_HYUabOXjKRiPZDA@mail.gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 08:54:57 +01:00
Adriano Cordova
370ab06aa5 scripts/Makefile.lib: add PLATFORM_LIBGCC to efi linking
Link .efi applications using libgcc

Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
2025-05-16 17:03:17 +02:00
Ilias Apalodimas
261b422aed efi_loader: Move public cert for capsules to .rodata
commit ddf67daac3 ("efi_capsule: Move signature from DTB to .rodata")
was reverted in
commit 47a25e81d3 ("Revert "efi_capsule: Move signature from DTB to .rodata"")
because that's what U-Boot was usually doing -- using the DT to store
configuration and data. Some of the discussions can be found here [0].

(Ab)using the device tree to store random data isn't ideal though.
On top of that with new features introduced over the years, keeping
the certificates in the DT has proven to be problematic.
One of the reasons is that platforms might send U-Boot a DTB
from the previous stage loader using a transfer list which won't contain
the signatures since other loaders are not  aware of internal
U-Boot ABIs. On top of that QEMU creates the DTB on the fly, so adding
the capsule certificate there does not work and requires users to dump
it and re-create it injecting the public keys.

Now that we have proper memory permissions for arm64, move the certificate
to .rodata and read it from there.

[0] https://lore.kernel.org/u-boot/CAPnjgZ2uM=n8Qo-a=DUkx5VW5Bzp5Xy8=Wgmrw8ESqUBK00YJQ@mail.gmail.com/

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Jonathan Humphreys <j-humphreys@ti.com>  # on TI sk-am62p-lp
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on AML-A311D-CC
Tested-by: Raymond Mao <raymond.mao@linaro.org>
2025-05-16 14:45:26 +02:00
Simon Glass
b7d6edfd69 scripts: Convert the build-qemu script to Python
Convert this to Python and make use of the build_helpers module. Update
that module to remove old options and improve the ordering of options.

The script doubles in size, part of which is being a lot more friendly
with virtiofsd problems, as well as adding a verbose mode.

Update the documentation as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-15 07:54:38 +02:00
Simon Glass
3a6ba29bd2 scripts: Create a common settings file for QEMU scripts
Move the settings into a common file so they can be used by all tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-15 06:35:37 +02:00
Simon Glass
9b5decd807 scripts: Convert the build-efi script to avoid sudo
Make use of the mk_fs() function to avoid needing to use sudo to mount
the loopback partition. This makes the script a little more friendly for
those nervous about sudo in their tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-15 06:35:37 +02:00
Simon Glass
721804b0f8 scripts: Rename build-efi.py to drop the file extension
The .py extension isn't very useful. Drop it and update the shebang to
specify Python 3

Update the docs for this and also drop the old reference to 2021 images.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-15 06:35:37 +02:00
Mattijs Korpershoek
dd269b99be tools/make_pip: Use venv when invoking pip
Recent Ubuntu versions (24.04+) disallow pip by default when
installing packages. The recommended approach is to use a virtual
environment (venv) instead.
Because of this, "make pip" is failing on such versions.

To prepare CI container migration to Ubuntu 24.04, use a venv in the
make_pip script.

Note: This has been reported on [1]

[1] https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/37

Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
(cherry picked from commit 9d3f1ebaf8)
2025-05-01 20:26:24 -06:00
Tom Rini
2825b387b0 Kbuild: Always use $(PHASE_)
It is confusing to have both "$(PHASE_)" and "$(XPL_)" be used in our
Makefiles as part of the macros to determine when to do something in our
Makefiles based on what phase of the build we are in. For consistency,
bring this down to a single macro and use "$(PHASE_)" only.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-01 05:56:48 -06:00
Simon Glass
eea87b0b3a scripts: Update build-efi to support arm64
Provide a -A flag to select ARM instead of x86. For now, only the app
is supported and only for 64-bit ARM.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-27 05:35:34 -06:00