Patrick Rudolph | cb42bc8 | 2024-10-23 15:20:08 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | .. Copyright (C) 2024, Patrick Rudolph <patrick.rudolph@9elements.com> |
| 3 | |
| 4 | QEMU ARM SBSA |
| 5 | ============= |
| 6 | |
| 7 | QEMU for ARM supports Arm Server Base System Architecture Reference board, |
| 8 | short 'sbsa-ref' that utilizes ACPI over FDT. This document describes how to run |
| 9 | U-Boot under it. Only AArch64 is supported. |
| 10 | |
| 11 | The 'sbsa' platform provides the following as the basic functionality: |
| 12 | |
| 13 | - A freely configurable amount of CPU cores |
| 14 | - U-Boot loaded and executing in the emulated flash at address 0x10000000 |
| 15 | - No device tree blob |
| 16 | - A freely configurable amount of RAM |
| 17 | - A PL011 serial port |
| 18 | - An ARMv7/ARMv8 architected timer |
| 19 | - PSCI for rebooting the system |
| 20 | - A generic ECAM-based PCI host controller |
| 21 | |
| 22 | Additionally, a number of optional peripherals can be added to the PCI bus. |
| 23 | |
| 24 | Compile ARM Trusted Firmware (ATF) |
| 25 | ---------------------------------- |
| 26 | |
| 27 | Get and Build the ARM Trusted firmware |
| 28 | -------------------------------------- |
| 29 | |
| 30 | Note: srctree is U-Boot source directory |
| 31 | Get ATF from: https://github.com/ARM-software/arm-trusted-firmware |
| 32 | |
| 33 | .. code-block:: bash |
| 34 | |
| 35 | git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git tfa |
| 36 | cd tfa |
| 37 | make CROSS_COMPILE=aarch64-linux-gnu- all fip \ |
| 38 | ARM_LINUX_KERNEL_AS_BL33=1 DEBUG=1 PLAT=qemu_sbsa |
| 39 | |
| 40 | Copy the resulting FIP and BL1 binary |
| 41 | |
| 42 | .. code-block:: bash |
| 43 | |
| 44 | cp build/qemu_sbsa/debug/fip.bin ../ |
| 45 | cp build/qemu_sbsa/debug/bl1.bin ../ |
| 46 | |
| 47 | Building U-Boot |
| 48 | --------------- |
| 49 | Set the CROSS_COMPILE environment variable as usual, and run: |
| 50 | |
| 51 | .. code-block:: bash |
| 52 | |
| 53 | make qemu-arm-sbsa_defconfig |
| 54 | make |
| 55 | |
| 56 | Running U-Boot |
| 57 | -------------- |
| 58 | The minimal QEMU command line to get U-Boot up and running is: |
| 59 | |
| 60 | .. code-block:: bash |
| 61 | |
| 62 | qemu-system-aarch64 -machine sbsa-ref -nographic -cpu cortex-a57 \ |
| 63 | -pflash secure-world.rom \ |
| 64 | -pflash unsecure-world.rom |
| 65 | |
| 66 | Note that for some odd reason qemu-system-aarch64 needs to be explicitly |
| 67 | told to use a 64-bit CPU or it will boot in 32-bit mode. The -nographic argument |
| 68 | ensures that output appears on the terminal. Use Ctrl-A X to quit. |
| 69 | |
| 70 | Booting distros |
| 71 | --------------- |
| 72 | |
| 73 | It is possible to install and boot a standard Linux distribution using |
| 74 | sbsa by setting up a root disk:: |
| 75 | |
| 76 | .. code-block:: bash |
| 77 | |
| 78 | qemu-img create root.img 20G |
| 79 | |
| 80 | then using the installer to install. For example, with Debian 12:: |
| 81 | |
| 82 | .. code-block:: bash |
| 83 | |
| 84 | qemu-system-aarch64 \ |
| 85 | -machine sbsa-ref -cpu cortex-a57 -m 4G -smp 4 \ |
| 86 | -pflash secure-world.rom \ |
| 87 | -pflash unsecure-world.rom \ |
| 88 | -device virtio-rng-pci \ |
| 89 | -device usb-kbd -device usb-tablet \ |
| 90 | -cdrom debian-12.0.0-arm64-netinst.iso \ |
| 91 | -hda root.img |
| 92 | |
| 93 | Debug UART |
| 94 | ---------- |
| 95 | |
| 96 | The debug UART on the ARM sbsa board uses these settings:: |
| 97 | |
| 98 | CONFIG_DEBUG_UART=y |