6.4 KiB
6.4 KiB
Arch Linux s390x Port with Systemd
This repository contains a complete, working s390x Arch Linux system with systemd support and full root filesystem that boots successfully on IBM mainframes and QEMU emulation.
Quick Start
# Build everything
make all
# Test initramfs-only system
make test
# Test with root filesystem
make test-rootfs
# Test with systemd as init
make test-systemd
What's Working
- Arch Linux Kernel: Linux 6.6.10 with Arch patches and CONFIG_UNIX/CONFIG_KMOD support (5.8MB)
- Initramfs: Complete 5.9MB initramfs with s390x busybox
- Boot Process: Successful boot to root filesystem with busybox shell
- Root Filesystem: COMPLETE! 150MB ext4 root filesystem with Arch Linux identification
- Systemd: WORKING! 42MB minimal systemd with mount/udevadm utilities - boots to "Welcome to Arch Linux!"
- Modern Init: Full systemd boot reaching Multi-User and Graphical targets
- QEMU Testing: Fully functional in s390x emulation
- Ready for Hardware: IPL configuration for real mainframes
Build Status
Core System Components
| Component | Status | Details |
|---|---|---|
| Kernel | ✅ Working | 5.8MB bootable s390x kernel with CONFIG_UNIX/CONFIG_KMOD (6.6.10) |
| Initramfs | ✅ Working | 5.9MB with native s390x binaries |
| Boot Process | ✅ Working | IPL → kernel → initramfs → root filesystem → systemd |
| Root Filesystem | ✅ COMPLETE | 150MB ext4 with working busybox switch_root |
| Systemd | ✅ WORKING | 42MB minimal systemd with mount/udevadm - reaches graphical target |
| mkinitcpio | ✅ Fixed | Adapted for s390x architecture |
Userspace Components
| Component | Status | Details |
|---|---|---|
| Init System | ✅ COMPLETE | Busybox in initramfs → switch_root → systemd |
| Shell | 🟨 Minimal | Busybox sh (not bash) |
| Core Utilities | ✅ Enhanced | Busybox applets + mount/udevadm/kmod utilities |
| Package Manager | ❌ TODO | Pacman needs porting |
| Systemd Runtime | ✅ WORKING | Full systemd boot with journal, udev, and basic services |
| Bash | ❌ TODO | Needs s390x build |
| GNU Coreutils | ❌ TODO | Replace busybox applets |
Legend
- ✅ Complete - Fully working
- 🟨 Minimal - Working but minimal implementation
- ❌ TODO - Not yet implemented
Build System
Uses Fedora containers with Podman for cross-compilation:
# Container image:
s390x-archlinux-dev # All-in-one development container
Build Targets:
make all- Build complete system (kernel + initramfs + systemd)make kernel- Cross-compile Arch Linux kernel for s390xmake initramfs- Generate initramfs with mkinitcpiomake systemd- Build systemd natively on z/VM (requires .env configuration)make test- Test initramfs-only system with QEMUmake test-rootfs- Test with root filesystem switchingmake test-systemd- Test with systemd as init (full modern boot)make clean- Clean build artifacts
Key Scripts:
scripts/build-arch-kernel.sh- Cross-compile Arch Linux kernelscripts/build-initramfs-final.sh- Generate initramfsscripts/build-systemd-zvm.sh- Build systemd on z/VMscripts/deploy-and-build-systemd-zvm.sh- Orchestrate systemd buildscripts/run-qemu-initramfs-only.sh- Test initramfs-only systemscripts/test-qemu-rootfs.sh- Test with root filesystemscripts/test-qemu-systemd.sh- Test with systemd as initscripts/build-busybox-zvm.sh- Build static busybox on z/VM
z/VM Configuration
For building systemd and busybox natively on s390x hardware, you'll need access to an IBM z/VM system:
-
Copy the example configuration:
cp .env.example .env -
Edit
.envwith your z/VM details:ZVM_HOST=your.zvm.host ZVM_USER=your_username ZVM_SSH_KEY="-----BEGIN OPENSSH PRIVATE KEY----- ... your SSH private key content ... -----END OPENSSH PRIVATE KEY-----" -
Build systemd:
make systemd
The scripts will automatically load the .env configuration when needed.
Testing
# Install QEMU s390x
sudo pacman -S qemu-system-s390x # Arch Linux
# or
sudo apt install qemu-system-s390x # Ubuntu/Debian
# Test initramfs-only system
make test
# Test root filesystem switching
make test-rootfs
# Test full systemd boot (requires systemd build)
make test-systemd
Expected Results:
make test- System boots to emergency shell in initramfs-only mode (press Ctrl-A X to exit)make test-rootfs- Boots completely to root filesystem with busybox shellmake test-systemd- Full systemd boot reaching "Welcome to Arch Linux!" and graphical target
Output Files
After building:
boot/vmlinuz-linux- Ready-to-use s390x kernelboot/initramfs-linux.img- Working initramfsboot/rootfs-s390x.img- Root filesystem image (created by test-rootfs)boot/generic.ins- IPL configuration for real hardwareboot/arch.prm- Kernel parametersboot/busybox-s390x-static- Static busybox binary built on z/VM (used by mkinitcpio)output/systemd-root/- Complete systemd installation for root filesystem
Technical Details
s390x Adaptations:
- Big-endian architecture support
- IPL boot process (not BIOS/UEFI)
- Channel I/O subsystem drivers
- mkinitcpio modified for cross-architecture builds
Key Fixes Applied:
- mkinitcpio adaptation - Fixed
add_binaryvsadd_fileissue for init scripts - Static busybox in initramfs - Built natively on z/VM for early boot operations
- Architecture compatibility - Fixed base hook to exclude x86_64 binaries
- switch_root support - Enables transition from initramfs to systemd on root filesystem
- Kernel configuration - Added CONFIG_UNIX and CONFIG_KMOD for systemd support
System Boot Sequence
The complete boot process follows this sequence:
- IPL (Initial Program Load) - IBM mainframe boot process
- Kernel loads - Linux 6.6.10 s390x kernel with Arch patches
- Initramfs unpacked - Contains busybox and init script
- Early boot - Busybox provides utilities for mounting and setup
- Root filesystem mounted -
/dev/vdamounted to/new_root - switch_root - Busybox
switch_roottransitions to real root filesystem - Systemd starts -
/usr/lib/systemd/systemdbecomes PID 1