Commit Graph

1695 Commits

Author SHA1 Message Date
Simon Glass
7738c4c2d7 Makefile: Avoid FORCE with ESL
We don't need to force building of the ESL dtsi or capsule file if they
already exist. Drop the FORCE dependencies.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-09 22:58:34 +00:00
Simon Glass
53a402b8c6 Makefile: Avoid FORCE with test overlays
We don't need to force building of these files if they already exist.
Drop the FORCE dependencies.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-09 22:58:34 +00:00
Simon Glass
eeaaa9c448 Makefile: Avoid FORCE with CHID
We don't need to force building of this file if it already exists. Drop
the FORCE dependency.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-09 22:58:34 +00:00
Simon Glass
896268f40e Makefile: Shorten a few quiet build steps
A few of the steps are longer than the 7 characters allowed. Shorten
them so that the build output looks better:

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-09 22:58:34 +00:00
Simon Glass
f379b6570f ulib: scripts: Add a script to support symbol-renaming
When U-Boot is used as a library with other programs, some U-Boot
function names may conflict with the program, or with standard-library
functions. For example, printf() is defined by U-Boot but is typically
used by the program as well.

The easiest solution is to rename symbols in the object file, so that
they appear with a 'ub_' prefix when linked with the program.

Add a new build_api.py script which can:

- rename symbols based on a rename.syms file
- generate a header file (with the renamed symbols) for use by the
  program

This makes use of the 'objcopy --redefine-sym' feature.

The tool has 100% test coverage.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-08 13:09:56 -06:00
Simon Glass
a9e04b5d36 Makefile: Integrate CHID files into the build
When CONFIG_CHID is enabled, U-Boot must have access to a set of CHIDs
which it can use to identfy the hardware it is running on.

Add support for reading a hwids/compatible.hwidmap file in the board
directory and including the information in the board's devicetree.

This works by running the hwids_to_dtsi.py.py script and putting the
result in the dtsi_include_list variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
7d793ccadd scripts: Add a tool to convert CHIDs to devicetree
Add a Python script to convert Hardware ID files (as produced by
'fwupd hwids') into a devicetree format suitable for use within U-Boot.

Provide a simple test as well.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
c6883b8a71 scripts: Add an option for the build directory
When running in CI it is better to specify the build directory rather
than provide a device. Add a --build-dir option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-12 13:41:05 -06:00
Simon Glass
7c63cdd830 scripts: Correct virtio-sci typo
Fix a small typo in the help.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 16:53:16 -06:00
Simon Glass
5f6e2806b0 scripts: build-efi: Enable the display on ARM
Enable the display on ARM devices, so it works when running Tianocore.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 16:53:16 -06:00
Simon Glass
79c09c4244 scripts: build-qemu: Always call the run() function
The helper deals with whether we are actually running or not. We want it
to show the arguments even if not. So always call it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 16:53:16 -06:00
Simon Glass
0d08920da2 scripts: build-qemu: Enable the display on ARM
ARM devices can use a GPU display, which U-Boot only recented supports.
Enable the option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 16:52:48 -06:00
Simon Glass
219adf6bf8 scripts: build-qemu: Correct networking
Networking is not currently enabled, since the wrong variable is used.
Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 15:59:43 -06:00
Simon Glass
654bf17503 scripts: build-qemu: Support Tianocore on ARM
When ARM is selected, use the ARM Tianocore image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 15:59:43 -06:00
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