Enable ia64 firmware build with "kernel only" cross-toolchains - #27
johnny-mnemonic wants to merge 1 commit into
Conversation
Like for Ski the firmware for qemu-system-ia64 can be compiled with cross-toolchains consisting of only binutils and gcc. So remove the unneeded ABI part. This allows to use the ia64 cross-toolchains built with buildall and available on: * https://www.kernel.org/pub/tools/crosstool/ * https://ftp.machine-hall.org/pub/epic-linux/toolchains/x86_64/ Signed-off-by: Johnny Mnemonic <jm@machine-hall.org>
|
You should be able to use both in my opinion. Meaning if the |
|
@kristibektashi But when building the firmware with Still, the Makefile can be modified to use what is available, but this makes the patch uneccessarily complex for no reason, as firmware is firmware and not a userland program. Also the usually used toolchain from Fedora Core only pretends to be a full one from the naming of the tools, but in reality is a "kernel only" one like ours or Arnd's, see description from Fedora. I vibed a second patch (not part of the PR, see below) with Gemini, but it looks awkward. It should (1) either use the From 2cc2e64664a2cf8036c252776983d365b5d697ee Mon Sep 17 00:00:00 2001
From: Johnny Mnemonic <jm@machine-hall.org>
Date: Thu, 6 Aug 2026 11:05:45 +0200
Subject: [PATCH] Also adapt firmware Makefile to auto-detect the available
cross-toolchain
Defaults to native build when no cross-toolchains are found in `$PATH`.
Assisted-by: Gemini:gemini-2.5-pro
Signed-off-by: Johnny Mnemonic <jm@machine-hall.org>
---
roms/ia64-firmware/Makefile | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/roms/ia64-firmware/Makefile b/roms/ia64-firmware/Makefile
index 209bc66..e2d4efa 100644
--- a/roms/ia64-firmware/Makefile
+++ b/roms/ia64-firmware/Makefile
@@ -1,7 +1,22 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Thin wrapper around the canonical firmware build script.
-CROSS ?= ia64-linux-gnu-
+PATH_DIRS := $(subst :, ,$(PATH))
+CROSS_GCC := $(wildcard $(addsuffix /ia64-linux-gnu-gcc,$(PATH_DIRS)))
+
+ifdef CROSS_GCC
+ CROSS_TOOL_PREFIX := ia64-linux-gnu-
+else
+ CROSS_GCC := $(wildcard $(addsuffix /ia64-linux-gcc,$(PATH_DIRS)))
+ ifdef CROSS_GCC
+ CROSS_TOOL_PREFIX := ia64-linux-
+ else
+ # native build
+ CROSS_TOOL_PREFIX :=
+ endif
+endif
+
+CROSS ?= $(CROSS_TOOL_PREFIX)
AS = $(CROSS)as
CC = $(CROSS)gcc
LD = $(CROSS)ld
--
2.25.1
...which works according to my test: But I figure, setting So I think I will update my initial patch to do that in addition. |
|
But as the current workflow installs the Fedora toolchain targetting ia64 anyways, the following patch is not needed, but shows how it can be done, no matter if the toolchain used has a diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d88e6b5..b081be3 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -46,13 +46,22 @@ jobs:
run: |
set -euo pipefail
+ if ia64-linux-gnu-gcc --version &> /dev/null; then
+ export CROSS="ia64-linux-gnu-"
+ elif ia64-linux-gcc --version &> /dev/null; then
+ export CROSS="ia64-linux-"
+ else
+ echo "No cross toolchain targetting ia64 found. Cannot continue."
+ false
+ fi
+
firmware_dir="roms/ia64-firmware"
binary="$firmware_dir/ia64-firmware.bin"
elf="$firmware_dir/ia64-firmware.elf"
map="$firmware_dir/ia64-firmware.map"
sections="$firmware_dir/ia64-firmware.sections"
- test -f "$(ia64-linux-gnu-gcc -print-libgcc-file-name)"
+ test -f "$(${CROSS}gcc -print-libgcc-file-name)"
make -C "$firmware_dir" clean
make -C "$firmware_dir" -j"$(nproc)"
@@ -66,7 +75,7 @@ jobs:
"$binary" \
"$elf"
- ia64-linux-gnu-readelf -h "$elf" > firmware-elf-header.txt
+ ${CROSS}readelf -h "$elf" > firmware-elf-header.txt
grep -Eiq 'Machine:.*IA-64' firmware-elf-header.txt
- name: Package the firmware |
|
There's a mistake in the last patch, where you export Also I do think the |
Indeed, thanks. Fixed now. |
Like for Ski the firmware for qemu-system-ia64 can be compiled with cross-toolchains consisting of only binutils and GCC. So remove the unneeded ABI part with this patch.
This allows to use the ia64 cross-toolchains built with buildall and available on:
https://www.kernel.org/pub/tools/crosstool/
https://ftp.machine-hall.org/pub/epic-linux/toolchains/x86_64/
...and will allow builds on arbitrary Linux distributions (our toolchains are for example made for x86_64 with Ubuntu 24.04 for use in GHA, Arnd Bergmann's are available for a variety of host architectures).
You only need to have the cross-tools in
PATHduring build.E.g.:
Tested to work fine on a not so recent Debian Sid on x86_64 and Pi OS on aarch64.