Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From e5ac46dd24e6216c36aa80462af25457e7029440 Mon Sep 17 00:00:00 2001
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Date: Mon, 29 Jun 2026 22:08:12 +0100
Subject: [PATCH] config/scripts/switch-arch: fix build on aarch64 and riscv64
hosts

Ensure that the host compiler builds with -DNATIVE_BITWIDTH_SMALLER_THAN_HOST_BITWIDTH
on aarch64 and riscv64 hosts for 32-bit target architectures, otherwise host pointers
can end up being truncated to 32-bits causing a segfault running forthstrap.

Resolves: https://github.com/openbios/openbios/issues/18
Resolves: https://github.com/openbios/openbios/issues/25
Closes: https://github.com/openbios/openbios/pull/12
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
config/scripts/switch-arch | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/config/scripts/switch-arch b/config/scripts/switch-arch
index 013116bf..2c20d273 100755
--- a/config/scripts/switch-arch
+++ b/config/scripts/switch-arch
@@ -38,7 +38,8 @@ longbits()
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" \
-o "$cpu" = "amd64" -o "$cpu" = "x86_64" \
-o "$cpu" = "powerpc64" -o "$cpu" = "ppc64" \
- -o "$cpu" = "ppc64le" -o "$cpu" = "alpha" ; then
+ -o "$cpu" = "ppc64le" -o "$cpu" = "alpha" \
+ -o "$cpu" = "aarch64" -o "$cpu" = "riscv64" ; then
echo 64
else
echo 32
36 changes: 25 additions & 11 deletions base/comps/openbios/openbios.comp.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# The forthstrap Forth interpreter segfaults on aarch64 due to pointer
# truncation in cell2pointer() — mmap returns addresses above 4 GiB that
# don't fit in a 32-bit cell. Known upstream bug with no fix:
# https://github.com/openbios/openbios/issues/18
# https://github.com/openbios/openbios/issues/25
# Restrict to x86_64 builders where the address space layout avoids the bug.
# Backport the upstream fix for forthstrap pointer truncation on aarch64 and
# riscv64 hosts:
# https://github.com/openbios/openbios/commit/e5ac46dd24e6216c36aa80462af25457e7029440
[components.openbios]
# Release: 1.git%{hash}%{?dist}
# Release: %[1 + %{azl_release}].git%{hash}%{?dist}
release = { calculation = "manual" }

[components.openbios.build.defines]
# AZL-only release counter. Add this to upstream's Release value (1) so future
# Azure Linux rebuilds only need to increment this define.
azl_release = "1"

[[components.openbios.overlays]]
description = "Compose azl_release with upstream Release so Azure Linux rebuilds can be bumped independently"
type = "spec-set-tag"
tag = "Release"
value = "%[1 + %{azl_release}].git%{hash}%{?dist}"

[[components.openbios.overlays]]
description = "Backport upstream host bit-width detection for aarch64 and riscv64 to prevent forthstrap pointer truncation"
type = "patch-add"
source = "0001-config-scripts-switch-arch-fix-build-on-aarch64-and-riscv64.patch"

[[components.openbios.overlays]]
description = "Restrict build to x86_64 — forthstrap segfaults on aarch64 (upstream bug #18/#25)"
type = "spec-add-tag"
tag = "ExclusiveArch"
value = "x86_64"
description = "Use %autosetup so OpenBIOS patches are applied automatically"
type = "spec-search-replace"
section = "%prep"
regex = '^%setup -q -n %\{name\}-%\{date\}-git%\{hash\}$'
replacement = '%autosetup -p1 -n %{name}-%{date}-git%{hash}'
2 changes: 1 addition & 1 deletion locks/openbios.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
version = 1
import-commit = '086b64fc6eef1bcae87343c28ec336d54ba778a7'
upstream-commit = '086b64fc6eef1bcae87343c28ec336d54ba778a7'
input-fingerprint = 'sha256:104f38be5a6e811d3307d4034085cba0f131888be9fe18120d79dc7bc6c847fa'
input-fingerprint = 'sha256:381c0a720b64262309ce7ffc1dfddc65391b5a434146992de8e6536de20bf65f'
resolution-input-hash = 'sha256:466421704711c4fd3c71f0b2ed715a0e61d49e3e26f3a2637fee755795849c8e'
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From e5ac46dd24e6216c36aa80462af25457e7029440 Mon Sep 17 00:00:00 2001
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Date: Mon, 29 Jun 2026 22:08:12 +0100
Subject: [PATCH] config/scripts/switch-arch: fix build on aarch64 and riscv64
hosts

Ensure that the host compiler builds with -DNATIVE_BITWIDTH_SMALLER_THAN_HOST_BITWIDTH
on aarch64 and riscv64 hosts for 32-bit target architectures, otherwise host pointers
can end up being truncated to 32-bits causing a segfault running forthstrap.

Resolves: https://github.com/openbios/openbios/issues/18
Resolves: https://github.com/openbios/openbios/issues/25
Closes: https://github.com/openbios/openbios/pull/12
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
config/scripts/switch-arch | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/config/scripts/switch-arch b/config/scripts/switch-arch
index 013116bf..2c20d273 100755
--- a/config/scripts/switch-arch
+++ b/config/scripts/switch-arch
@@ -38,7 +38,8 @@ longbits()
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" \
-o "$cpu" = "amd64" -o "$cpu" = "x86_64" \
-o "$cpu" = "powerpc64" -o "$cpu" = "ppc64" \
- -o "$cpu" = "ppc64le" -o "$cpu" = "alpha" ; then
+ -o "$cpu" = "ppc64le" -o "$cpu" = "alpha" \
+ -o "$cpu" = "aarch64" -o "$cpu" = "riscv64" ; then
echo 64
else
echo 32
3 changes: 3 additions & 0 deletions specs/o/openbios/openbios.azl.macros
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Macros file automatically generated by azldev.
# Do not edit manually; changes will be overwritten.
%azl_release 1
10 changes: 7 additions & 3 deletions specs/o/openbios/openbios.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# This spec file has been modified by azldev to include build configuration overlays.
# Do not edit manually; changes may be overwritten.

# All Azure Linux specs with overlays include this macro file, irrespective of whether new macros have been added.
%{load:%{_sourcedir}/openbios.azl.macros}

%global hash c3a19c1
%global date 20240913

Expand All @@ -13,7 +16,7 @@

Name: openbios
Version: %{date}
Release: 1.git%{hash}%{?dist}
Release: %[1 + %{azl_release}].git%{hash}%{?dist}
Epoch: 1
Summary: OpenBIOS implementation of IEEE 1275-1994

Expand All @@ -29,6 +32,7 @@ BuildArch: noarch
# date=`git log -1 --format='%cd' --date=short | tr -d -`
# git archive --prefix openbios-${date}-git${hash}/ ${hash} | xz -7e > ../openbios-${date}-git${hash}.tar.xz
Source0: %{name}-%{date}-git%{hash}.tar.xz
Source9999: openbios.azl.macros

# Note that these packages build 32 bit binaries with the -m32 flag.
BuildRequires: make
Expand All @@ -40,7 +44,7 @@ BuildRequires: fcode-utils
BuildRequires: libxslt


ExclusiveArch: x86_64
Patch0: 0001-config-scripts-switch-arch-fix-build-on-aarch64-and-riscv64.patch
%description
The OpenBIOS project provides you with most free and open source Open
Firmware implementations available. Here you find several
Expand All @@ -66,7 +70,7 @@ such as coreboot or U-Boot.


%prep
%setup -q -n %{name}-%{date}-git%{hash}
%autosetup -p1 -n %{name}-%{date}-git%{hash}


%build
Expand Down
Loading