No description
Find a file
Mathieu Benoit 22b101dc47 [FIX] gcc: two defects only a chroot could find
Our gcc package was built a dozen times and never once used to compile
anything -- stage 1 compiles with Ubuntu's gcc. The first program it was ever
asked to link was in the stage-2 chroot, and it failed twice.

  collect2: fatal error: cannot find 'ld'

/usr/bin/ld was present, executable, on PATH, and ran as the same user. -B,
COMPILER_PATH and three symlinks changed nothing. strace settled it in one
line: it was looking for s390x-linux-gnu-ld, the DEBIAN triplet, and printing
the generic name. gcc's configure had recorded Ubuntu's copy, a file no Arch
system will ever have. --with-ld and --with-as now pin absolute paths, correct
on the host, in the chroot and on the target alike.

  /usr/bin/ld: cannot find -lgcc_s

package_gcc() moves libgcc_s{,_asneeded}.so three directories deeper. The
asneeded one is a linker script and survives; libgcc_s.so is a symlink naming
its target relative to /usr/lib, so after the move it points at nothing. The
only libgcc_s.so on the system was dangling, so -lgcc_s could not resolve and
nothing linked at all -- not even int main(void){return 0;}.

Verified: the chroot now compiles and runs a program.

--- FR ---

Notre paquet gcc a été bâti une douzaine de fois sans jamais servir à
compiler : l'étage 1 compile avec le gcc d'Ubuntu. Le premier programme qu'on
lui a demandé de lier l'a été dans le chroot d'étage 2, et il a échoué deux
fois.

  collect2: fatal error: cannot find 'ld'

/usr/bin/ld était présent, exécutable, dans le PATH, et répondait pour le même
utilisateur. -B, COMPILER_PATH et trois liens symboliques n'ont rien changé.
strace a tranché en une ligne : il cherchait s390x-linux-gnu-ld, le triplet
DEBIAN, en affichant le nom générique. La configuration de gcc avait
enregistré la copie d'Ubuntu, un fichier qu'aucun système Arch n'aura jamais.
--with-ld et --with-as épinglent désormais des chemins absolus, corrects sur
l'hôte, dans le chroot et sur la cible.

  /usr/bin/ld: cannot find -lgcc_s

package_gcc() déplace libgcc_s{,_asneeded}.so trois répertoires plus bas.
Le second est un script ld et survit ; libgcc_s.so est un symlink dont la
cible est relative à /usr/lib, si bien qu'après le déplacement il ne pointe
plus sur rien. Le seul libgcc_s.so du système pendait dans le vide : -lgcc_s
ne pouvait se résoudre et plus rien ne se liait — pas même
int main(void){return 0;}.

Vérifié : le chroot compile et exécute désormais un programme.

Assisted-by: Claude Opus 5
2026-08-19 08:30:49 -04:00
.github/workflows making the house a home 2026-01-27 23:26:31 +01:00
arch-kernel making the house a home 2026-01-27 23:26:31 +01:00
boot making the house a home 2026-01-27 23:26:31 +01:00
patches [FIX] gcc: two defects only a chroot could find 2026-08-19 08:30:49 -04:00
scripts [FIX] test-chroot: an audit that classifies, and one that was wrong 2026-08-19 06:40:50 -04:00
.env.example full boot with systemd 2025-06-05 12:32:34 +02:00
.gitignore making the house a home 2026-01-27 23:26:31 +01:00
CODEOWNERS making the house a home 2026-01-27 23:26:31 +01:00
Containerfile making the house a home 2026-01-27 23:26:31 +01:00
LICENSE use arch kernel patches 2025-06-02 21:53:33 +02:00
Makefile making the house a home 2026-01-27 23:26:31 +01:00
README.md making the house a home 2026-01-27 23:26:31 +01:00
TODO.md [FIX] test-chroot: an audit that classifies, and one that was wrong 2026-08-19 06:40:50 -04:00

Arch Linux s390x

A port of Arch Linux to IBM s390x mainframe architecture with systemd support.

Boots a full Arch Linux system on IBM mainframes (or QEMU s390x emulation) using a hybrid build: cross-compilation for the kernel, native s390x compilation on z/VM for userspace.

Quick Start

make container        # build dev container (first time)
cp .env.example .env  # configure z/VM access
make all              # build kernel + initramfs + systemd
make test-systemd     # boot it

What Works

  • Arch Linux kernel 6.18.6-arch1 with Arch patches, cross-compiled
  • Initramfs via modified mkinitcpio
  • Static busybox built natively on z/VM, 2.3MB
  • Root filesystem with ext4, switch_root to real rootfs
  • Systemd as PID 1

Pacman, bash, and GNU coreutils are not yet ported.

Build System

The build uses two tiers:

Cross-compilation (x86_64 host): Kernel is built in a Fedora 43 container with s390x-linux-gnu-gcc. Initramfs is generated with a patched mkinitcpio that handles cross-architecture binary injection.

Native compilation (s390x z/VM): Busybox and systemd must be built on real s390x hardware. The z/VM system runs RHEL 9.6 with GCC 11.5.0. Scripts handle SSH deployment and retrieval automatically via .env configuration.