Skip to content

Commit a3a135b

Browse files
committed
Fix the CI jobs that fail on the Ubuntu 26.04 runner image
1 parent cedaf81 commit a3a135b

7 files changed

Lines changed: 33 additions & 11 deletions

File tree

‎.github/workflows/test-endian.yml‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ jobs:
2525
run: |
2626
export DEBIAN_FRONTEND=noninteractive
2727
sudo apt-get update -o Acquire::Retries=3
28+
# Ubuntu 26.04 dropped qemu-user-static: qemu-user carries the
29+
# static emulators there, as qemu-ppc.
30+
QEMU_PKG=qemu-user-static
31+
apt-cache policy "$QEMU_PKG" | grep -q 'Candidate: [0-9]' \
32+
|| QEMU_PKG=qemu-user
2833
sudo apt-get install --no-install-recommends -y -q \
2934
-o Acquire::Retries=3 \
30-
gcc-powerpc-linux-gnu libc6-dev-powerpc-cross qemu-user-static \
35+
gcc-powerpc-linux-gnu libc6-dev-powerpc-cross "$QEMU_PKG" \
3136
dosfstools mtools e2fsprogs
3237
3338
# Fixture generation takes minutes, so prove the cross toolchain works
@@ -39,8 +44,9 @@ jobs:
3944
powerpc-linux-gnu-gcc -static -o /tmp/be_probe /tmp/be_probe.c
4045
file /tmp/be_probe | grep -q 'MSB' \
4146
|| { echo "cross-compiler did not produce a big-endian binary"; exit 1; }
42-
qemu-ppc-static /tmp/be_probe \
43-
|| { echo "qemu-ppc-static cannot run a big-endian binary"; exit 1; }
47+
QEMU_PPC=$(command -v qemu-ppc-static || command -v qemu-ppc)
48+
"$QEMU_PPC" /tmp/be_probe \
49+
|| { echo "$QEMU_PPC cannot run a big-endian binary"; exit 1; }
4450
echo "big-endian toolchain OK"
4551
4652
- name: generate filesystem fixtures

‎.github/workflows/test-sbom.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ on:
4343

4444
jobs:
4545
sbom_canary:
46-
runs-on: ubuntu-latest
46+
# Held on 24.04: the macro capture runs each compiler at its own default
47+
# language standard, and from GCC 15 that default is C23, which defines
48+
# macros (the <stdint.h> *_WIDTH family) that clang's default does not.
49+
# The neutrality check below then fails on 26.04 until the capture pins a
50+
# standard.
51+
runs-on: ubuntu-24.04
4752
timeout-minutes: 20
4853

4954
steps:

‎.github/workflows/test-x86-fsp-qemu.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
run: |
4646
export DEBIAN_FRONTEND=noninteractive
4747
sudo apt-get update -o Acquire::Retries=3
48-
sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 swtpm uuid-dev
48+
sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 swtpm uuid-dev python3-setuptools
4949
- name: run test
5050
run: |
5151
./tools/scripts/x86_fsp/qemu/test_qemu.sh
@@ -65,7 +65,7 @@ jobs:
6565
run: |
6666
export DEBIAN_FRONTEND=noninteractive
6767
sudo apt-get update -o Acquire::Retries=3
68-
sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 uuid-dev dosfstools mtools e2fsprogs
68+
sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 uuid-dev python3-setuptools dosfstools mtools e2fsprogs
6969
- name: run test
7070
run: |
7171
./tools/scripts/x86_fsp/qemu/test_qemu.sh -f
@@ -84,7 +84,7 @@ jobs:
8484
run: |
8585
export DEBIAN_FRONTEND=noninteractive
8686
sudo apt-get update -o Acquire::Retries=3
87-
sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 swtpm uuid-dev
87+
sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 swtpm uuid-dev python3-setuptools
8888
- name: run test
8989
run: |
9090
./tools/scripts/x86_fsp/qemu/test_qemu.sh -r

‎src/string.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ int memcmp(const void *_s1, const void *_s2, size_t n)
257257
return diff;
258258
}
259259

260+
/* A C23 <string.h> defines memchr as a macro that keeps the constness of
261+
* its argument; this is the function itself. */
262+
#ifdef memchr
263+
#undef memchr
264+
#endif
260265
void* memchr(void const *s, int c_in, size_t n)
261266
{
262267
unsigned char c = (unsigned char)c_in;

‎tools/fs-test/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Two notes on the fixtures:
8282

8383
## Big-endian coverage
8484

85-
`make check` also runs the fixtures as **big-endian PowerPC** under `qemu-user`, when `powerpc-linux-gnu-gcc` and `qemu-ppc-static` are installed. It skips with a note otherwise.
85+
`make check` also runs the fixtures as **big-endian PowerPC** under `qemu-user`, when `powerpc-linux-gnu-gcc` and `qemu-ppc-static` (or `qemu-ppc`, on distributions whose `qemu-user` package replaced `qemu-user-static`) are installed. It skips with a note otherwise.
8686

8787
This matters because the parsers read every multi-byte on-media field through byte-wise accessors (`fs_le16` / `fs_le32`) rather than casting a buffer to a struct. That should make them endian-neutral, and the big-endian run proves it instead of assuming it.
8888

‎tools/fs-test/runtests.sh‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ neg ext4-4k.img 0 "/a/b/c/d/e/f/g/h/i/j/k/l.itb" "path too deep"
6565
# entries, and every FAT32/ext4 field. All of it is read byte-wise, so the
6666
# whole stack should be endian-neutral. Prove it by running the same
6767
# fixtures as big-endian PowerPC under qemu-user.
68+
# The emulator is qemu-ppc-static where the qemu-user-static package exists,
69+
# and qemu-ppc from qemu-user on distributions that dropped it.
70+
QEMU_PPC=$(command -v qemu-ppc-static || command -v qemu-ppc || true)
6871
if command -v powerpc-linux-gnu-gcc >/dev/null 2>&1 && \
69-
command -v qemu-ppc-static >/dev/null 2>&1; then
72+
[ -n "$QEMU_PPC" ]; then
7073
echo
7174
echo "=== big-endian (PowerPC), full stack incl. MBR/GPT ==="
7275
# Do NOT hide this build. A cross-compile failure here (a missing
@@ -86,7 +89,7 @@ if command -v powerpc-linux-gnu-gcc >/dev/null 2>&1 && \
8689
local img="$1" path="$2"
8790
[ -f "$F/$img" ] || return
8891
printf " %-26s " "$img"
89-
if qemu-ppc-static ./fs-test-be verify "$F/$img" 0 "$path" \
92+
if "$QEMU_PPC" ./fs-test-be verify "$F/$img" 0 "$path" \
9093
"$F/payload/os.itb" >/dev/null 2>&1; then
9194
echo "PASS"; pass=$((pass + 1))
9295
else
@@ -102,7 +105,7 @@ if command -v powerpc-linux-gnu-gcc >/dev/null 2>&1 && \
102105
fi
103106
else
104107
echo
105-
echo " (big-endian check skipped: needs powerpc-linux-gnu-gcc + qemu-ppc-static)"
108+
echo " (big-endian check skipped: needs powerpc-linux-gnu-gcc + qemu-ppc-static or qemu-ppc)"
106109
fi
107110

108111
echo

‎tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ download_sbl_patch_and_patch_edkii() {
5959
}
6060

6161
build_qemu_fsp() {
62+
# This EDK2 release's host tools are pre-C23 code (old-style function
63+
# declarations), and C23 is the default from GCC 15.
64+
export BUILD_CC="${BUILD_CC:-gcc -std=gnu17}"
6265
(cd "$WORK_DIR/edk2" &&
6366
python ./BuildFsp.py &&
6467
cd BuildFsp &&

0 commit comments

Comments
 (0)