[Concept,00/12] x86: Add single 64-bit U-Boot without SPL for QEMU

Message ID 20260211143309.1183113-1-sjg@u-boot.org
Headers
Series x86: Add single 64-bit U-Boot without SPL for QEMU |

Message

Simon Glass Feb. 11, 2026, 2:32 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

This series adds support for building a single 64-bit U-Boot
binary with integrated 16-bit and 32-bit startup code,
eliminating the need for SPL on platforms where RAM is available
immediately (e.g. QEMU).

The new start_from_32.S enters in 32-bit protected mode (from
start16.S), builds identity-mapped page tables with 2MB pages,
enables SSE and PAE, then transitions to 64-bit long mode
before calling board_init_f().

Since the 64-bit binary is linked as PIE, the 16-bit startup
objects cannot be linked into it directly. Instead they are
linked into a separate 32-bit ELF and their sections are
extracted to binary files for binman.

Along the way this moves the x86 16-bit binary rules from the
top-level Makefile into arch/x86/Makefile, and switches x86_64
to use MSR_FS_BASE for the global data pointer instead of a
writable global variable.

Tested on QEMU x86_64 - boots to the command prompt. The
existing SPL-based qemu-x86_64 and 32-bit qemu-x86 builds are
unaffected.


Simon Glass (12):
  x86: Allow disabling the regparm calling-convention
  x86: Use MSR_FS_BASE for gd pointer on x86_64
  efi: Cache gd->relocaddr for EFI runtime services
  x86: Move 16-bit binary rules to arch/x86/Makefile
  x86: Exclude X86_32BIT_INIT for 64-bit builds
  x86: Build 16-bit startup objects as 32-bit for x86_64
  x86: Link 16-bit startup into separate 32-bit ELF
  x86: Add 32-to-64-bit startup code
  x86: Add qemu-x86_64_nospl defconfig
  x86: qemu: Enable MTRR setup for x86_64 no-SPL
  scripts: build-qemu: Add --no-spl option for x86_64
  CI: Add test coverage for qemu-x86_64_nospl

 .azure-pipelines.yml                          |   3 +
 .gitlab-ci.yml                                |   6 +
 Makefile                                      |  10 -
 arch/x86/Kconfig                              |  24 +-
 arch/x86/Makefile                             |  39 +++
 arch/x86/config.mk                            |   2 +
 arch/x86/cpu/Makefile                         |  15 ++
 arch/x86/cpu/i386/interrupt.c                 |  10 +-
 arch/x86/cpu/qemu/qemu.c                      |   4 +-
 arch/x86/cpu/start.S                          |  23 +-
 arch/x86/cpu/start_from_32.S                  | 248 ++++++++++++++++++
 arch/x86/cpu/start_from_spl.S                 |  21 +-
 arch/x86/cpu/start_from_tpl.S                 |  19 +-
 arch/x86/cpu/u-boot-16bit.lds                 |  30 +++
 arch/x86/cpu/x86_64/cpu.c                     |   2 +
 arch/x86/cpu/x86_64/misc.c                    |  12 +-
 arch/x86/dts/emulation-u-boot.dtsi            |   2 +-
 arch/x86/include/asm/global_data.h            |  26 +-
 board/emulation/qemu-x86/MAINTAINERS          |   1 +
 configs/qemu-x86_64_nospl_defconfig           |  82 ++++++
 lib/efi_loader/efi_runtime.c                  |  19 +-
 scripts/build-qemu                            |   9 +-
 .../bin/travis-ci/conf.qemu-x86_64_nospl_na   |  30 +++
 .../u_boot_boardenv_qemu_x86_64_nospl_na.py   |  14 +
 24 files changed, 613 insertions(+), 38 deletions(-)
 create mode 100644 arch/x86/cpu/start_from_32.S
 create mode 100644 arch/x86/cpu/u-boot-16bit.lds
 create mode 100644 configs/qemu-x86_64_nospl_defconfig
 create mode 100644 test/hooks/bin/travis-ci/conf.qemu-x86_64_nospl_na
 create mode 100644 test/hooks/py/travis-ci/u_boot_boardenv_qemu_x86_64_nospl_na.py