Skip to content

Commit dc87bca

Browse files
authored
Move out HAF and TFA build to pipeline and consume the bins locally (#1227)
## Description For SBSA, move out HAF and TFA build to GitHub workflow and consume the bins locally. Eliminates need for local developer to rely on HAF/TFA build steps via a new `HAF_TFA_BUILD` build flag set to `FALSE` by default. The GitHub Workflow on Release will run `stuart_build` with `HAF_TFA_BUILD=TRUE` and publishes the Hafnium and TFA binaries for consumption as a part of the GitHub release. It will also publish a file `fip_blob_manifest.json` which is generated using the output of the fiptool from TFA against fip.bin. This is needed because the fiptool reports offsets that are necessary to patch up the fip.bin if we want to employ this method of building SBSA with HAF/TFA bins being pulled down from an extdep. The GitHub workflow runs the end-to-end build with `HAF_TFA_BUILD=TRUE` only on GitHub releases. We will not publish the binaries after building on arbitrary PR runs, but will still run stuart_build with `HAF_TFA_BUILD=TRUE`. On github releases, the version number and sha for the extdep must also be updated for every release, as the contents of the binaries and the json manifest, `fip_blob_manifest.json` needs to get updated also. Once this and #1229 are merged, a developer can build SBSA like they would normally, however the default behavior for building the Hafnium and TFA binaries will be to use the extdep through `stuart_update`. Along with this, the Post-Build step will now patch the extdep binaries with the contents of the secure partitions that the local developer has built as a part of `stuart_build`. For more advanced use cases, where the developer would need to modify the secure partition DTS files, or if the developer changes the .fd files to be larger than the size reported in the `fip_blob_manifest.json`, then the developer would have to use `HAF_TFA_BUILD=TRUE` in their `stuart_build` step as an argument. After this PR is merged, we need to make a formal GitHub release so that the necessary binaries and artifacts can be published as a part of that release. For details on how to complete these options and their meaning refer to [CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md). - [ ] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? ## How This Was Tested Tested on my fork by doing a release and making this pr and watching the pipeline build publish the bins to test13 release on my fork https://github.com/eeshanl/mu_tiano_platforms/releases/tag/test13_tag but skips the just the publish step on this pr. pr pipeline run: https://github.com/microsoft/mu_tiano_platforms/actions/runs/17990944480/job/51180666584?pr=1227 release pipeline run: https://github.com/eeshanl/mu_tiano_platforms/actions/runs/18020305440/job/51275744986 And then locally tested the ext_deps step by pointing to this release. ## Integration Instructions This PR must be merged first, then make a release to autopopulate new ext_dep artifacts.
1 parent c17f309 commit dc87bca

File tree

3 files changed

+522
-80
lines changed

3 files changed

+522
-80
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# This workflow automatically publishes the HAF and TFA binaries for a given
2+
# release.
3+
#
4+
# Copyright (c) Microsoft Corporation.
5+
# SPDX-License-Identifier: BSD-2-Clause-Patent
6+
#
7+
8+
name: Hafnium and Trusted Firmware-A Build
9+
10+
on:
11+
release:
12+
types:
13+
- published
14+
pull_request:
15+
branches:
16+
- '**' # Matches all branches
17+
paths:
18+
- 'Platforms/QemuSbsaPkg/**'
19+
- 'Silicon/Arm/**'
20+
workflow_dispatch:
21+
22+
jobs:
23+
build:
24+
name: Hafnium and Trusted Firmware-A Build
25+
runs-on: ubuntu-24.04
26+
container:
27+
image: ghcr.io/microsoft/mu_devops/ubuntu-24-dev:latest
28+
29+
steps:
30+
- name: Checkout Code
31+
uses: actions/checkout@v4
32+
33+
- name: Install Pip Modules
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install -r pip-requirements.txt
37+
38+
- name: Configure Git identity
39+
run: |
40+
git config --global user.name "github-actions[bot]"
41+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
42+
git config --global --add safe.directory $GITHUB_WORKSPACE
43+
44+
- name: Stuart Setup
45+
run: python Platforms/QemuSbsaPkg/PlatformBuild.py --setup
46+
47+
- name: Stuart Update
48+
run: python Platforms/QemuSbsaPkg/PlatformBuild.py --update
49+
50+
- name: Stuart Build
51+
run: python Platforms/QemuSbsaPkg/PlatformBuild.py HAF_TFA_BUILD=TRUE
52+
53+
- name: Install archive tools
54+
if: github.event_name == 'release'
55+
run: |
56+
apt-get update -y
57+
apt-get install -y zip tar gh
58+
59+
- name: Create per-target archives
60+
if: github.event_name == 'release'
61+
shell: bash
62+
run: |
63+
set -euo pipefail
64+
BIN_DIR="Build/QemuSbsaPkg/DEBUG_GCC5/HafTfaBins"
65+
echo "Packaging binaries from ${BIN_DIR}"
66+
if [ ! -d "$BIN_DIR" ]; then
67+
echo "Binary directory not found: $BIN_DIR" >&2
68+
exit 1
69+
fi
70+
ZIP_PATH="${RUNNER_TEMP}/haf-tfa-firmware-${{ github.event.release.tag_name }}.zip"
71+
TAR_PATH="${RUNNER_TEMP}/haf-tfa-firmware-${{ github.event.release.tag_name }}.tar.gz"
72+
(cd "$BIN_DIR" && zip -r "$ZIP_PATH" .)
73+
(cd "$BIN_DIR" && tar -czf "$TAR_PATH" .)
74+
echo "Created archives:"
75+
ls -lh "$ZIP_PATH" "$TAR_PATH"
76+
77+
- name: Upload Release Assets
78+
if: github.event_name == 'release'
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
run: |
82+
gh release upload "${{ github.event.release.tag_name }}" "${RUNNER_TEMP}"/*.zip
83+
gh release upload "${{ github.event.release.tag_name }}" "${RUNNER_TEMP}"/*.tar.gz
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
##
2+
# Download the compiled HAF and TFA bins from the github release
3+
#
4+
# Copyright (c) 2025, Microsoft Corporation
5+
# SPDX-License-Identifier: BSD-2-Clause-Patent
6+
##
7+
scope: qemusbsa
8+
id: haf-tfa-bin
9+
type: web
10+
name: HAF_TFA_BUILD
11+
source: https://github.com/microsoft/mu_tiano_platforms/releases/download/v10.0.0/haf-tfa-firmware-v10.0.0.zip
12+
13+
version: v10.0.0
14+
sha256: 9970d7d17d18506c0e91092e17d47655c0eb5f1ca41b3e78580be9889010f911
15+
internal_path: /
16+
compression_type: zip
17+
flags:
18+
- set_shell_var
19+
- set_build_var
20+
- set_path
21+
var_name: HAF_TFA_BINS

0 commit comments

Comments
 (0)