|
| 1 | +# Altera Agilex 5 |
| 2 | + |
| 3 | +The Agilex 5 port follows wolfBoot's established Cortex-A TF-A model. It does |
| 4 | +not replace the platform first stage or TF-A: |
| 5 | + |
| 6 | +```text |
| 7 | +SDM -> U-Boot SPL -> TF-A BL31/EL3 -> wolfBoot BL33/EL2 -> signed Linux FIT |
| 8 | +``` |
| 9 | + |
| 10 | +SPL remains responsible for DDR, clocks, resets, pinmux, the SDHCI PHY and |
| 11 | +loading the signed U-Boot FIT. BL31 remains responsible for EL3, GICv3, PSCI, |
| 12 | +secondary CPUs and security-controller setup. The U-Boot-proper payload in the |
| 13 | +FIT is replaced with `wolfboot.bin` at load/entry address `0x80200000`. |
| 14 | + |
| 15 | +## Build |
| 16 | + |
| 17 | +Use an isolated wolfBoot checkout with initialized wolfSSL submodules: |
| 18 | + |
| 19 | +```sh |
| 20 | +cp config/examples/agilex5_013b_sdcard.config .config |
| 21 | +make clean |
| 22 | +make -j"$(nproc)" |
| 23 | +``` |
| 24 | + |
| 25 | +The hosted build is covered by the Agilex 5 job in the `Test Example Configs` |
| 26 | +GitHub Actions workflow. It installs the same freestanding AArch64 toolchain |
| 27 | +used by the other Cortex-A ports and builds this configuration on every pull |
| 28 | +request; hardware is required only for the SD-card and Linux handoff steps |
| 29 | +below. |
| 30 | + |
| 31 | +The default RSA-4096/SHA3-384 key is for development only. Production builds |
| 32 | +must supply controlled signing keys and keep them separate from both the SDM |
| 33 | +owner key and the SPL FIT-signing key. |
| 34 | + |
| 35 | +Create the Linux FIT from the GSRD `Image` and the exact board DTB, then sign |
| 36 | +that FIT with wolfBoot's normal image-signing flow. Initialize both raw A/B |
| 37 | +partitions with a valid signed image for the first boot. |
| 38 | + |
| 39 | +### Board settings |
| 40 | + |
| 41 | +The example config targets the DK-A5E013BM16AEA. Other boards set these in |
| 42 | +their config: |
| 43 | + |
| 44 | +| Setting | Default | Purpose | |
| 45 | +|---|---|---| |
| 46 | +| `CFLAGS_EXTRA+=-DDEBUG_UART_NUM=<0\|1>` | UART0 (`0x10C02000`) | select UART0 or UART1 (`0x10C02100`) for wolfBoot and Linux `earlycon` | |
| 47 | +| `CFLAGS_EXTRA+=-DDEBUG_UART_BASE=<addr>` | unset | any other console UART; write the address without a `UL` suffix | |
| 48 | +| `CFLAGS_EXTRA+=-DAGILEX5_DDR_SIZE=<bytes>` | `0x70000000` (1792 MiB) | DDR size written to the DTB memory node | |
| 49 | +| `CFLAGS_EXTRA+=-DWOLFBOOT_FDT_DISABLE_PATHS=\"/leds\"` | unset | comma-separated DTB node paths to mark `disabled`, for hardware behind the unprogrammed FPGA | |
| 50 | + |
| 51 | +wolfBoot does not read the DDR size from the DTB, because without U-Boot the |
| 52 | +memory node holds whatever the DTB author wrote rather than the fitted size. |
| 53 | + |
| 54 | +The checked-in `hal/agilex5.its` is a minimal FIT example. A GSRD production |
| 55 | +image must use the GSRD-generated kernel load address and board DTB, then be |
| 56 | +signed with the deployment key. Do not place private keys in the source tree |
| 57 | +or the WIC. |
| 58 | + |
| 59 | +## GSRD integration |
| 60 | + |
| 61 | +Keep the GSRD `u-boot.itb` structure and signature intact: |
| 62 | + |
| 63 | +- retain the existing BL31 firmware node; |
| 64 | +- replace only the U-Boot-proper/BL33 data with `wolfboot.bin`; |
| 65 | +- retain load and entry `0x80200000`; |
| 66 | +- rebuild and sign the ITB using the same GSRD/SPL trust configuration. |
| 67 | + |
| 68 | +Use a four-partition WIC: |
| 69 | + |
| 70 | +1. 128 MiB FAT boot partition containing the signed boot artifacts; |
| 71 | +2. 200 MiB raw wolfBoot A partition; |
| 72 | +3. 200 MiB raw wolfBoot B partition; |
| 73 | +4. ext4 Linux root filesystem. |
| 74 | + |
| 75 | +The wolfSSL FCS packages belong in partition 4. libfcs is Linux userspace |
| 76 | +software and is deliberately not linked into bare-metal wolfBoot. |
| 77 | + |
| 78 | +## Test order |
| 79 | + |
| 80 | +1. Cross-build the existing ZynqMP and Versal SD-card configurations to catch |
| 81 | + shared AArch64 regressions, then build Agilex 5. |
| 82 | +2. First boot a minimal signed payload that prints its exception level and |
| 83 | + proves the generic timer and PSCI reset path. |
| 84 | +3. Exercise SD reads in PIO mode, then valid, corrupt-signature, truncated and |
| 85 | + oversized images. |
| 86 | +4. Boot Linux and require the DTB in x0, x1-x3 zero, four online CPUs, working |
| 87 | + PSCI reboot, and rootfs `/dev/mmcblk0p4`. |
| 88 | +5. Build the complete WIC, inspect all four partitions, flash the whole card, |
| 89 | + compare the complete image span, cold boot, and test A-to-B fallback by |
| 90 | + corrupting only a disposable copy of A. Both slots must hold the same |
| 91 | + version: with `ALLOW_DOWNGRADE=0` wolfBoot refuses to fall back to a lower |
| 92 | + version (`Rollback to lower version not allowed`) and panics instead. |
| 93 | +6. From the booted WIC run `/usr/bin/wolfcrypttest`. Require exit zero and |
| 94 | + `ALTERA-FCS test passed!` to prove the Linux image still provides hardware |
| 95 | + FCS offload. |
| 96 | + |
| 97 | +For the reproducible meta-wolfSSL customer flow, use |
| 98 | +`recipes-wolfssl/wolfboot/agilex5/README.md` in the meta-wolfSSL checkout. It |
| 99 | +covers the Kas fragment, the four-partition WIC inspection, whole-device flash |
| 100 | +and byte comparison, virtual SDM owner-key reprovisioning after power loss, |
| 101 | +and the target-side loader/FCS checks. wolfBoot itself does not link libfcs; |
| 102 | +the FCS test belongs to the Linux image in WIC partition 4. |
| 103 | + |
| 104 | +Do not patch TF-A or take over GICv3, SMMU/firewall, mailbox, or PSCI ownership |
| 105 | +without a reproduced hardware failure showing the stock GSRD contract is |
| 106 | +insufficient. |
| 107 | + |
| 108 | +## CI and hardware boundary |
| 109 | + |
| 110 | +CI proves that the Agilex 5 configuration, linker script, startup assembly, |
| 111 | +SDHCI changes, and test application remain buildable without Agilex hardware. |
| 112 | +It cannot prove SPL DDR training, TF-A handoff, SDM services, signed FIT |
| 113 | +verification, or FCS offload. Those require the GSRD image and the |
| 114 | +DK-A5E013BM16AEA. Record the WIC hash, complete-card comparison, UART boot |
| 115 | +log, target `uname`, loader output, and `wolfcrypttest` exit status and FCS |
| 116 | +marker for a hardware release sign-off. |
0 commit comments