making the house a home
Signed-off-by: Josephine Pfeiffer <hi@josie.lol>
This commit is contained in:
parent
8032b83e6a
commit
5026da6f22
18 changed files with 175 additions and 283 deletions
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
|
|
@ -34,7 +34,7 @@ jobs:
|
|||
- name: Check for required busybox
|
||||
run: |
|
||||
if [ ! -f "boot/busybox-s390x-static" ]; then
|
||||
echo "❌ ERROR: Static busybox not found!"
|
||||
echo "ERROR: Static busybox not found!"
|
||||
echo ""
|
||||
echo "To build a release, you must first:"
|
||||
echo "1. SSH into z/VM: ssh -i zvm.pem -o StrictHostKeyChecking=no \$ZVM_USER@\$ZVM_HOST"
|
||||
|
|
@ -45,7 +45,7 @@ jobs:
|
|||
echo "The busybox MUST be built natively on s390x hardware for proper static linking."
|
||||
exit 1
|
||||
else
|
||||
echo "✅ Static busybox found at boot/busybox-s390x-static"
|
||||
echo "OK: Static busybox found at boot/busybox-s390x-static"
|
||||
ls -la boot/busybox-s390x-static
|
||||
fi
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ jobs:
|
|||
|
||||
# Check if build succeeded
|
||||
if [ ! -f "boot/vmlinuz-linux" ] || [ ! -f "boot/initramfs-linux.img" ]; then
|
||||
echo "❌ ERROR: Build artifacts not found!"
|
||||
echo "ERROR: Build artifacts not found!"
|
||||
echo "Expected files:"
|
||||
echo " boot/vmlinuz-linux"
|
||||
echo " boot/initramfs-linux.img"
|
||||
|
|
@ -125,11 +125,11 @@ jobs:
|
|||
|
||||
# Copy systemd artifacts if available
|
||||
if [ -d "output/systemd-root" ]; then
|
||||
echo "✅ Systemd found, including in release"
|
||||
echo "OK: Systemd found, including in release"
|
||||
tar -czf release-artifacts/systemd-s390x.tar.gz -C output/systemd-root .
|
||||
cp output/systemd-minimal-s390x.tar.gz release-artifacts/ 2>/dev/null || true
|
||||
else
|
||||
echo "⚠️ Systemd not found, release will be kernel + initramfs only"
|
||||
echo "WARNING: Systemd not found, release will be kernel + initramfs only"
|
||||
fi
|
||||
|
||||
# Get actual sizes
|
||||
|
|
@ -147,7 +147,7 @@ jobs:
|
|||
==================================
|
||||
|
||||
Build Date: $(date -u '+%Y-%m-%d %H:%M:%S UTC')
|
||||
Kernel Version: 6.6.10
|
||||
Kernel Version: 6.18.6-arch1
|
||||
Architecture: IBM s390x (big-endian)
|
||||
|
||||
Component Sizes:
|
||||
|
|
@ -179,7 +179,7 @@ jobs:
|
|||
tar -czf archlinux-s390x-${{ github.event.inputs.version }}.tar.gz -C release-artifacts .
|
||||
|
||||
# Capture build information for GitHub release
|
||||
echo "KERNEL_VERSION=6.6.10" >> $GITHUB_ENV
|
||||
echo "KERNEL_VERSION=6.18.6-arch1" >> $GITHUB_ENV
|
||||
echo "BUSYBOX_VERSION=1.35.0" >> $GITHUB_ENV
|
||||
echo "KERNEL_SIZE=$KERNEL_SIZE" >> $GITHUB_ENV
|
||||
echo "INITRAMFS_SIZE=$INITRAMFS_SIZE" >> $GITHUB_ENV
|
||||
|
|
|
|||
13
.gitignore
vendored
13
.gitignore
vendored
|
|
@ -70,6 +70,11 @@ VERSION
|
|||
# Documentation WiP
|
||||
docs/*
|
||||
|
||||
# Project-local AI/notes/config
|
||||
notes/
|
||||
ansible/
|
||||
.goutputstream-*
|
||||
|
||||
# Security
|
||||
*.pem
|
||||
.env
|
||||
|
|
@ -77,11 +82,15 @@ docs/*
|
|||
# Test artifacts
|
||||
boot/rootfs-s390x.img
|
||||
|
||||
# Systemd documentation
|
||||
# Large binary images
|
||||
boot/arch-s390x-install.img
|
||||
*.img
|
||||
|
||||
# Systemd documentation
|
||||
docs/systemd-s390x-patches.md
|
||||
|
||||
# Build artifacts in boot directory (regenerated by make)
|
||||
boot/vmlinuz-linux
|
||||
boot/initramfs-linux.img
|
||||
boot/boot-info.txt
|
||||
boot/.treeinfo
|
||||
boot/.treeinfo
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# CODEOWNERS for Arch Linux s390x LPAR boot components
|
||||
|
||||
# Global owners
|
||||
* @pfeifferj josie@redhat.com
|
||||
* @Morganamilo morganamilo@archlinux.org
|
||||
* @Morganamilo morganamilo@archlinux.org
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
# Arch Linux s390x Build Environment
|
||||
# Fedora 39 with s390x cross-compilation tools and mkinitcpio support
|
||||
FROM fedora:39
|
||||
# Stage 1: Base system with package manager cache
|
||||
FROM fedora:43 AS base-system
|
||||
RUN sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/fedora-updates-testing.repo
|
||||
|
||||
# Install complete cross-compilation environment for kernel builds and mkinitcpio
|
||||
RUN dnf install -y \
|
||||
# Stage 2: Cross-compilation tools
|
||||
FROM base-system AS cross-tools
|
||||
RUN dnf install -y --setopt=install_weak_deps=False \
|
||||
# Core cross-compilation tools
|
||||
gcc-s390x-linux-gnu \
|
||||
binutils-s390x-linux-gnu \
|
||||
|
|
@ -12,13 +14,13 @@ RUN dnf install -y \
|
|||
glibc-devel \
|
||||
glibc-headers \
|
||||
glibc-static \
|
||||
glibc-common \
|
||||
glibc-all-langpacks \
|
||||
musl-devel \
|
||||
musl-gcc \
|
||||
musl-libc-static \
|
||||
libstdc++-devel \
|
||||
libstdc++-static \
|
||||
&& dnf clean all
|
||||
|
||||
# Stage 3: Build dependencies
|
||||
FROM cross-tools AS build-deps
|
||||
RUN dnf install -y --setopt=install_weak_deps=False \
|
||||
# Kernel build dependencies
|
||||
make \
|
||||
flex \
|
||||
|
|
@ -32,16 +34,6 @@ RUN dnf install -y \
|
|||
diffutils \
|
||||
findutils \
|
||||
kmod \
|
||||
# mkinitcpio build dependencies
|
||||
python3 \
|
||||
python3-pip \
|
||||
ninja-build \
|
||||
asciidoc \
|
||||
xmlto \
|
||||
docbook-style-xsl \
|
||||
libxslt \
|
||||
pkgconfig \
|
||||
systemd-devel \
|
||||
# General utilities
|
||||
git \
|
||||
tar \
|
||||
|
|
@ -59,8 +51,42 @@ RUN dnf install -y \
|
|||
bsdtar \
|
||||
&& dnf clean all
|
||||
|
||||
# Upgrade meson to latest version (Fedora 39 has 1.3.2, mkinitcpio needs >=1.4.0)
|
||||
RUN pip3 install --upgrade meson
|
||||
# Stage 4: mkinitcpio dependencies
|
||||
FROM build-deps AS mkinitcpio-deps
|
||||
RUN dnf install -y --setopt=install_weak_deps=False \
|
||||
# mkinitcpio build dependencies
|
||||
python3 \
|
||||
python3-pip \
|
||||
ninja-build \
|
||||
asciidoc \
|
||||
xmlto \
|
||||
docbook-style-xsl \
|
||||
libxslt \
|
||||
pkgconfig \
|
||||
systemd-devel \
|
||||
systemd-libs \
|
||||
systemd \
|
||||
systemd-udev \
|
||||
&& dnf clean all
|
||||
|
||||
# Upgrade meson to latest version (mkinitcpio needs >=1.4.0)
|
||||
RUN pip3 install --upgrade --no-cache-dir meson
|
||||
|
||||
# Verify systemd pkg-config files are available
|
||||
RUN pkg-config --exists systemd && echo "✓ systemd pkg-config found" || echo "✗ systemd pkg-config missing"
|
||||
RUN pkg-config --modversion systemd || echo "✗ systemd version check failed"
|
||||
|
||||
# Stage 5: Final image
|
||||
FROM mkinitcpio-deps AS final
|
||||
|
||||
# Add remaining language packs and optional dependencies
|
||||
RUN dnf install -y --setopt=install_weak_deps=False \
|
||||
glibc-common \
|
||||
glibc-all-langpacks \
|
||||
musl-devel \
|
||||
musl-gcc \
|
||||
musl-libc-static \
|
||||
&& dnf clean all
|
||||
|
||||
# Verify meson version
|
||||
RUN meson --version
|
||||
|
|
@ -78,6 +104,6 @@ ENV CROSS_COMPILE=s390x-linux-gnu-
|
|||
WORKDIR /work
|
||||
|
||||
# Label the image
|
||||
LABEL description="Fedora 39 with s390x cross-compilation tools and mkinitcpio support for Arch Linux s390x port"
|
||||
LABEL version="1.0"
|
||||
LABEL description="Fedora 43 with s390x cross-compilation tools and mkinitcpio support for Arch Linux s390x port"
|
||||
LABEL version="1.1"
|
||||
LABEL architecture="s390x-cross"
|
||||
4
Makefile
4
Makefile
|
|
@ -5,8 +5,8 @@ OUTPUT_DIR := output
|
|||
BOOT_DIR := boot
|
||||
|
||||
# Output files
|
||||
KERNEL := $(OUTPUT_DIR)/vmlinuz-6.6.10-s390x-arch
|
||||
INITRAMFS := $(OUTPUT_DIR)/initramfs-6.6.10-s390x.img
|
||||
KERNEL := $(OUTPUT_DIR)/vmlinuz-6.18.6-s390x-arch
|
||||
INITRAMFS := $(OUTPUT_DIR)/initramfs-6.18.6-s390x.img
|
||||
BOOT_KERNEL := $(BOOT_DIR)/vmlinuz-linux
|
||||
BOOT_INITRAMFS := $(BOOT_DIR)/initramfs-linux.img
|
||||
|
||||
|
|
|
|||
179
README.md
179
README.md
|
|
@ -1,175 +1,32 @@
|
|||
# Arch Linux s390x Port with Systemd
|
||||
# Arch Linux s390x
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
```bash
|
||||
# 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
|
||||
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's Working
|
||||
## What Works
|
||||
|
||||
- **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
|
||||
- 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
|
||||
|
||||
## 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
|
||||
Pacman, bash, and GNU coreutils are not yet ported.
|
||||
|
||||
## Build System
|
||||
|
||||
Uses **Fedora containers with Podman** for cross-compilation:
|
||||
The build uses two tiers:
|
||||
|
||||
```bash
|
||||
# Container image:
|
||||
s390x-archlinux-dev # All-in-one development container
|
||||
```
|
||||
**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.
|
||||
|
||||
### Build Targets:
|
||||
- `make all` - Build complete system (kernel + initramfs + systemd)
|
||||
- `make kernel` - Cross-compile Arch Linux kernel for s390x
|
||||
- `make initramfs` - Generate initramfs with mkinitcpio
|
||||
- `make systemd` - Build systemd natively on z/VM (requires .env configuration)
|
||||
- `make test` - Test initramfs-only system with QEMU
|
||||
- `make test-rootfs` - Test with root filesystem switching
|
||||
- `make 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 kernel
|
||||
- `scripts/build-initramfs-final.sh` - Generate initramfs
|
||||
- `scripts/build-systemd-zvm.sh` - Build systemd on z/VM
|
||||
- `scripts/deploy-and-build-systemd-zvm.sh` - Orchestrate systemd build
|
||||
- `scripts/run-qemu-initramfs-only.sh` - Test initramfs-only system
|
||||
- `scripts/test-qemu-rootfs.sh` - Test with root filesystem
|
||||
- `scripts/test-qemu-systemd.sh` - Test with systemd as init
|
||||
- `scripts/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:
|
||||
|
||||
1. **Copy the example configuration**:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. **Edit `.env` with your z/VM details**:
|
||||
```bash
|
||||
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-----"
|
||||
```
|
||||
|
||||
3. **Build systemd**:
|
||||
```bash
|
||||
make systemd
|
||||
```
|
||||
|
||||
The scripts will automatically load the `.env` configuration when needed.
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
# 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 shell
|
||||
- `make test-systemd` - Full systemd boot reaching "Welcome to Arch Linux!" and graphical target
|
||||
|
||||
[](https://asciinema.org/a/u49jp0Bg7YoGtlGyTh6C9RJ7P)
|
||||
|
||||
## Output Files
|
||||
|
||||
After building:
|
||||
- `boot/vmlinuz-linux` - Ready-to-use s390x kernel
|
||||
- `boot/initramfs-linux.img` - Working initramfs
|
||||
- `boot/rootfs-s390x.img` - Root filesystem image (created by test-rootfs)
|
||||
- `boot/generic.ins` - IPL configuration for real hardware
|
||||
- `boot/arch.prm` - Kernel parameters
|
||||
- `boot/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:
|
||||
1. **mkinitcpio adaptation** - Fixed `add_binary` vs `add_file` issue for init scripts
|
||||
2. **Static busybox in initramfs** - Built natively on z/VM for early boot operations
|
||||
3. **Architecture compatibility** - Fixed base hook to exclude x86_64 binaries
|
||||
4. **switch_root support** - Enables transition from initramfs to systemd on root filesystem
|
||||
5. **Kernel configuration** - Added CONFIG_UNIX and CONFIG_KMOD for systemd support
|
||||
|
||||
## System Boot Sequence
|
||||
|
||||
The complete boot process follows this sequence:
|
||||
|
||||
1. **IPL (Initial Program Load)** - IBM mainframe boot process
|
||||
2. **Kernel loads** - Linux 6.6.10 s390x kernel with Arch patches
|
||||
3. **Initramfs unpacked** - Contains busybox and init script
|
||||
4. **Early boot** - Busybox provides utilities for mounting and setup
|
||||
5. **Root filesystem mounted** - `/dev/vda` mounted to `/new_root`
|
||||
6. **switch_root** - Busybox `switch_root` transitions to real root filesystem
|
||||
7. **Systemd starts** - `/usr/lib/systemd/systemd` becomes PID 1
|
||||
**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.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# s390x Port Maintainer: Josephine Pfeiffer <josie@redhat.com>
|
||||
|
||||
pkgbase=linux-s390x
|
||||
pkgver=6.6.10
|
||||
pkgver=6.18.6
|
||||
pkgrel=1
|
||||
pkgdesc='Linux (s390x mainframe port)'
|
||||
url='https://github.com/archlinux/linux'
|
||||
|
|
@ -28,7 +28,7 @@ options=(
|
|||
!strip
|
||||
)
|
||||
_srcname=linux-${pkgver%.*}
|
||||
_srctag=v${pkgver%.*}-${pkgver##*.}
|
||||
_srctag=v${pkgver}-arch1
|
||||
source=(
|
||||
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.{xz,sign}
|
||||
$url/releases/download/$_srctag/linux-$_srctag.patch.zst{,.sig}
|
||||
|
|
@ -40,11 +40,11 @@ validpgpkeys=(
|
|||
83BC8889351B5DEBBB68416EB8AC08600F108CDF # Jan Alexander Steffens (heftig)
|
||||
)
|
||||
# Updated checksums will be needed after creating config-s390x
|
||||
sha256sums=('390cdde032719925a08427270197ef55db4e90c09d454e9c3554157292c9f361'
|
||||
sha256sums=('SKIP'
|
||||
'SKIP'
|
||||
'e1e44d8c35f908762ffe0d701b0dfc51edbca0c6278aa6e6fddf133c2010c6b3'
|
||||
'SKIP'
|
||||
'SKIP') # config-s390x checksum to be updated
|
||||
'SKIP'
|
||||
'SKIP')
|
||||
|
||||
export KBUILD_BUILD_HOST=archlinux
|
||||
export KBUILD_BUILD_USER=$pkgbase
|
||||
|
|
|
|||
|
|
@ -1,55 +1,22 @@
|
|||
# Arch Linux Kernel Build for s390x
|
||||
|
||||
This directory contains the infrastructure for building the Arch Linux kernel for IBM s390x mainframe architecture.
|
||||
|
||||
## Overview
|
||||
|
||||
The Arch Linux kernel build process has been adapted for cross-compilation to s390x. This maintains compatibility with Arch Linux's kernel patches and configuration while targeting mainframe hardware.
|
||||
Cross-compilation of the Arch Linux kernel for IBM s390x.
|
||||
|
||||
## Files
|
||||
|
||||
- `PKGBUILD-s390x` - Modified PKGBUILD for s390x cross-compilation
|
||||
- `config-s390x` - Kernel configuration optimized for s390x with Arch Linux defaults
|
||||
- `linux/` - Clone of Arch Linux kernel packaging repository (reference only)
|
||||
- `PKGBUILD-s390x` -- modified PKGBUILD for s390x cross-compilation
|
||||
- `config-s390x` -- kernel config with s390x drivers (DASD, QETH, channel I/O) and Arch defaults
|
||||
- `linux/` -- clone of Arch Linux kernel packaging repository (reference)
|
||||
|
||||
## Key Differences from Standard Arch Kernel
|
||||
## Differences from Standard Arch Kernel
|
||||
|
||||
1. **Cross-compilation**: Uses `s390x-linux-gnu-gcc` toolchain
|
||||
2. **Architecture-specific config**: Includes s390x drivers (DASD, QETH, channel I/O)
|
||||
3. **No documentation build**: Skipped for cross-compilation efficiency
|
||||
4. **s390x boot image**: Uses `arch/s390/boot/bzImage` instead of x86 boot image
|
||||
- Uses `s390x-linux-gnu-gcc` cross-compilation toolchain
|
||||
- s390x-specific config: DASD storage, QETH networking, channel I/O, `CONFIG_UNIX=y`, `CONFIG_KMOD=y`
|
||||
- No documentation build
|
||||
- Boot image from `arch/s390/boot/bzImage` instead of x86
|
||||
|
||||
## Building
|
||||
|
||||
From the project root:
|
||||
|
||||
```bash
|
||||
# Build Arch Linux kernel with patches
|
||||
make arch-kernel
|
||||
|
||||
# Or build vanilla kernel (without Arch patches)
|
||||
make kernel
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The `config-s390x` file includes:
|
||||
|
||||
- Standard Arch Linux kernel features (systemd requirements, cgroups, namespaces)
|
||||
- s390x hardware support (DASD storage, QETH networking, z/VM integration)
|
||||
- IBM mainframe specific drivers and console support
|
||||
- Security features (SELinux, AppArmor, BPF)
|
||||
|
||||
## Kernel Versions
|
||||
|
||||
The build process tracks the official Arch Linux kernel version and applies the same patches used in the x86_64 build.
|
||||
|
||||
## Integration with Project
|
||||
|
||||
The built kernel integrates with the existing mkinitcpio-based initramfs generation to create a complete bootable s390x system.
|
||||
|
||||
## Future Improvements
|
||||
|
||||
- Automated patch retrieval for new kernel versions
|
||||
- Integration with Arch Linux package repository
|
||||
- Native s390x package building (when hardware available)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
Arch Linux s390x Boot Directory
|
||||
==============================
|
||||
|
||||
Kernel Version: 6.6.10
|
||||
Build Date: Thu Jun 5 03:04:40 PM CEST 2025
|
||||
Kernel Version: 6.18.6-arch1
|
||||
Build Date: Mon Nov 17 06:56:30 PM CET 2025
|
||||
Architecture: s390x
|
||||
|
||||
Files:
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
busybox-s390x-static
|
||||
Binary file not shown.
|
|
@ -78,8 +78,11 @@ cd "$BUILD_DIR"
|
|||
|
||||
# Download sources
|
||||
echo -e "${YELLOW}Downloading kernel sources...${NC}"
|
||||
KERNEL_VERSION="6.6.10"
|
||||
KERNEL_URL="https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${KERNEL_VERSION}.tar.xz"
|
||||
KERNEL_VERSION="6.18.6"
|
||||
ARCH_TAG="v${KERNEL_VERSION}-arch1" # v6.18.6-arch1
|
||||
|
||||
KERNEL_URL="https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION%%.*}.x/linux-${KERNEL_VERSION}.tar.xz"
|
||||
ARCH_PATCH_URL="https://github.com/archlinux/linux/releases/download/${ARCH_TAG}/linux-${ARCH_TAG}.patch.zst"
|
||||
|
||||
if [ ! -f "linux-${KERNEL_VERSION}.tar.xz" ]; then
|
||||
wget --no-verbose --show-progress "$KERNEL_URL" || {
|
||||
|
|
@ -88,6 +91,14 @@ if [ ! -f "linux-${KERNEL_VERSION}.tar.xz" ]; then
|
|||
}
|
||||
fi
|
||||
|
||||
if [ ! -f "linux-${ARCH_TAG}.patch.zst" ]; then
|
||||
echo -e "${YELLOW}Downloading Arch Linux patches (${ARCH_TAG})...${NC}"
|
||||
wget --no-verbose --show-progress "$ARCH_PATCH_URL" || {
|
||||
echo -e "${RED}Failed to download Arch patches${NC}"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
# Extract and prepare sources
|
||||
echo -e "${YELLOW}Extracting kernel source...${NC}"
|
||||
if [ ! -d "linux-${KERNEL_VERSION}" ]; then
|
||||
|
|
@ -101,6 +112,17 @@ export CROSS_COMPILE=s390x-linux-gnu-
|
|||
# Enter kernel directory
|
||||
cd "linux-${KERNEL_VERSION}"
|
||||
|
||||
# Apply Arch Linux patches
|
||||
echo -e "${YELLOW}Applying Arch Linux patches...${NC}"
|
||||
zstd -d --stdout "../linux-${ARCH_TAG}.patch.zst" | patch -Np1 || {
|
||||
echo -e "${RED}Failed to apply Arch patches${NC}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set Arch localversion
|
||||
echo "-1" > localversion.10-pkgrel
|
||||
echo "-s390x" > localversion.20-pkgname
|
||||
|
||||
# Apply s390x config
|
||||
echo -e "${YELLOW}Configuring kernel for s390x...${NC}"
|
||||
cp ../config-s390x .config
|
||||
|
|
@ -137,7 +159,7 @@ Build Method: Arch Linux kernel configuration for s390x
|
|||
Kernel Config: Based on Arch Linux defaults + s390x hardware support
|
||||
EOFINFO
|
||||
|
||||
echo -e "${GREEN}✓ Arch Linux kernel build complete!${NC}"
|
||||
echo -e "${GREEN}OK: Arch Linux kernel build complete!${NC}"
|
||||
EOF
|
||||
|
||||
chmod +x "$BUILD_DIR/build-arch-kernel-container.sh"
|
||||
|
|
@ -150,6 +172,6 @@ sudo podman run --rm \
|
|||
s390x-archlinux-dev \
|
||||
/work/build-kernel/build-arch-kernel-container.sh
|
||||
|
||||
echo -e "${GREEN}✓ Arch Linux kernel for s390x built successfully!${NC}"
|
||||
echo -e "${GREEN}OK: Arch Linux kernel for s390x built successfully!${NC}"
|
||||
echo -e "${GREEN}Output files:${NC}"
|
||||
ls -la "$OUTPUT_DIR/"*-arch* 2>/dev/null || echo "No Arch kernel files found yet"
|
||||
|
|
@ -19,8 +19,8 @@ log_info "Building static busybox on native s390x..."
|
|||
sudo dnf install -y gcc make wget tar bzip2 glibc-static
|
||||
|
||||
# Extract busybox
|
||||
tar -xjf busybox-1.35.0.tar.bz2
|
||||
cd busybox-1.35.0
|
||||
tar -xjf busybox-1.37.0.tar.bz2
|
||||
cd busybox-1.37.0
|
||||
|
||||
# Configure for static build
|
||||
make defconfig
|
||||
|
|
@ -48,7 +48,7 @@ make CONFIG_STATIC=y LDFLAGS="-static" -j$(nproc)
|
|||
|
||||
# Verify the binary
|
||||
if [ -f busybox ]; then
|
||||
echo "✅ Busybox built successfully!"
|
||||
echo "Success: Busybox built successfully!"
|
||||
echo "File info:"
|
||||
file busybox
|
||||
echo "Size: $(du -h busybox | cut -f1)"
|
||||
|
|
@ -58,8 +58,8 @@ if [ -f busybox ]; then
|
|||
# Copy to home directory for easy transfer
|
||||
cp busybox ~/busybox-s390x-static
|
||||
chmod +x ~/busybox-s390x-static
|
||||
echo "✅ Copied to ~/busybox-s390x-static"
|
||||
echo "Success: Copied to ~/busybox-s390x-static"
|
||||
else
|
||||
echo "❌ Build failed!"
|
||||
echo "ERROR: Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -7,14 +7,27 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
echo "Building consolidated s390x development container..."
|
||||
echo "Using multi-stage build for improved caching..."
|
||||
|
||||
# Enable BuildKit-like features in podman for better layer caching
|
||||
export BUILDAH_LAYERS=true
|
||||
|
||||
# Build the container using the Containerfile in project root
|
||||
sudo podman build -t s390x-archlinux-dev -f "$PROJECT_ROOT/Containerfile" "$PROJECT_ROOT"
|
||||
# Use --jobs for parallel downloads and --layers for better caching
|
||||
sudo sudo podman build \
|
||||
--jobs 4 \
|
||||
--layers \
|
||||
-t s390x-archlinux-dev \
|
||||
-f "$PROJECT_ROOT/Containerfile" \
|
||||
"$PROJECT_ROOT"
|
||||
|
||||
echo "✅ Container 's390x-archlinux-dev' built successfully!"
|
||||
echo "Success: Container 's390x-archlinux-dev' built successfully!"
|
||||
echo ""
|
||||
echo "This container includes:"
|
||||
echo "- s390x cross-compilation toolchain"
|
||||
echo "- Kernel build dependencies"
|
||||
echo "- mkinitcpio with upgraded meson (1.8.1)"
|
||||
echo "- mkinitcpio with upgraded meson (>=1.4.0)"
|
||||
echo "- All necessary build tools"
|
||||
echo ""
|
||||
echo "Image details:"
|
||||
sudo sudo podman images s390x-archlinux-dev:latest --format "table {{.Repository}} {{.Tag}} {{.Size}}"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
set -e
|
||||
|
||||
# Configuration
|
||||
KERNEL_VERSION="${KERNEL_VERSION:-6.6.10}"
|
||||
KERNEL_VERSION="${KERNEL_VERSION:-6.18.6}"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
OUTPUT_DIR="$PROJECT_ROOT/output"
|
||||
|
|
@ -27,14 +27,14 @@ if [ $? -ne 0 ]; then
|
|||
echo -e "${RED}Failed to clone mkinitcpio${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✓ Cloned latest mkinitcpio${NC}"
|
||||
echo -e "${GREEN}OK: Cloned latest mkinitcpio${NC}"
|
||||
|
||||
# Create build script that runs inside container
|
||||
cat > "$PROJECT_ROOT/build-final-initramfs.sh" << 'EOF'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
KERNEL_VERSION="6.6.10"
|
||||
KERNEL_VERSION="6.18.6"
|
||||
INITRAMFS_OUTPUT="/work/output/initramfs-${KERNEL_VERSION}-s390x.img"
|
||||
|
||||
echo "Building and installing modified mkinitcpio..."
|
||||
|
|
@ -60,7 +60,7 @@ if [ -f "/work/patches/mkinitcpio-s390x-base-hook.patch" ]; then
|
|||
echo "Found mkinitcpio patch, applying..."
|
||||
cp /work/patches/mkinitcpio-s390x-base-hook.patch install/base
|
||||
chmod +x install/base
|
||||
echo "✓ Applied s390x patches to base install hook"
|
||||
echo "OK: Applied s390x patches to base install hook"
|
||||
else
|
||||
echo "ERROR: Patch file not found at /work/patches/mkinitcpio-s390x-base-hook.patch"
|
||||
exit 1
|
||||
|
|
@ -108,9 +108,9 @@ fi
|
|||
echo "Verifying init files installation..."
|
||||
# Check both lib and lib64 locations
|
||||
if [ -f /usr/lib/initcpio/init ] || [ -f /usr/lib64/initcpio/init ]; then
|
||||
echo "✓ init found"
|
||||
echo "OK: init found"
|
||||
else
|
||||
echo "✗ init missing - copying from source"
|
||||
echo "FAIL: init missing - copying from source"
|
||||
if [ -f /tmp/mkinitcpio/init ]; then
|
||||
mkdir -p /usr/lib/initcpio
|
||||
cp /tmp/mkinitcpio/init /usr/lib/initcpio/init
|
||||
|
|
@ -119,9 +119,9 @@ else
|
|||
fi
|
||||
|
||||
if [ -f /usr/lib/initcpio/init_functions ] || [ -f /usr/lib64/initcpio/init_functions ]; then
|
||||
echo "✓ init_functions found"
|
||||
echo "OK: init_functions found"
|
||||
else
|
||||
echo "✗ init_functions missing - copying from source"
|
||||
echo "FAIL: init_functions missing - copying from source"
|
||||
if [ -f /tmp/mkinitcpio/init_functions ]; then
|
||||
mkdir -p /usr/lib/initcpio
|
||||
cp /tmp/mkinitcpio/init_functions /usr/lib/initcpio/init_functions
|
||||
|
|
@ -163,10 +163,10 @@ echo "s390x busybox will be handled by the patched mkinitcpio base hook..."
|
|||
|
||||
# Ensure busybox binary is available for the base hook
|
||||
if [ -f "/work/boot/busybox-s390x-static" ]; then
|
||||
echo "✓ Found s390x static busybox at /work/boot/busybox-s390x-static"
|
||||
echo "OK: Found s390x static busybox at /work/boot/busybox-s390x-static"
|
||||
ls -la /work/boot/busybox-s390x-static
|
||||
elif [ -f "/work/boot/busybox-s390x-native" ]; then
|
||||
echo "✓ Found s390x native busybox at /work/boot/busybox-s390x-native"
|
||||
echo "OK: Found s390x native busybox at /work/boot/busybox-s390x-native"
|
||||
ls -la /work/boot/busybox-s390x-native
|
||||
else
|
||||
echo "ERROR: No s390x busybox binary found in /work/boot/"
|
||||
|
|
@ -201,22 +201,22 @@ if [ -f "$INITRAMFS_OUTPUT" ]; then
|
|||
echo ""
|
||||
# Check for critical files
|
||||
if lsinitcpio "$INITRAMFS_OUTPUT" | grep -q "^init$"; then
|
||||
echo "✓ /init found"
|
||||
echo "OK: /init found"
|
||||
else
|
||||
echo "✗ /init missing!"
|
||||
echo "FAIL: /init missing!"
|
||||
fi
|
||||
|
||||
if lsinitcpio "$INITRAMFS_OUTPUT" | grep -q "^init_functions$"; then
|
||||
echo "✓ /init_functions found"
|
||||
echo "OK: /init_functions found"
|
||||
else
|
||||
echo "✗ /init_functions missing!"
|
||||
echo "FAIL: /init_functions missing!"
|
||||
fi
|
||||
|
||||
# Check for busybox
|
||||
if lsinitcpio "$INITRAMFS_OUTPUT" | grep -E "bin/busybox$|usr/bin/busybox$" >/dev/null; then
|
||||
echo "✓ busybox found in initramfs"
|
||||
echo "OK: busybox found in initramfs"
|
||||
else
|
||||
echo "✗ busybox missing from initramfs!"
|
||||
echo "FAIL: busybox missing from initramfs!"
|
||||
fi
|
||||
|
||||
# Show first 20 files
|
||||
|
|
@ -229,9 +229,9 @@ if [ -f "$INITRAMFS_OUTPUT" ]; then
|
|||
fi
|
||||
|
||||
echo ""
|
||||
echo "✓ Success!"
|
||||
echo "OK: Success!"
|
||||
else
|
||||
echo "✗ Failed to generate initramfs"
|
||||
echo "FAIL: Failed to generate initramfs"
|
||||
exit 1
|
||||
fi
|
||||
EOF
|
||||
|
|
@ -262,11 +262,11 @@ fi
|
|||
# Check result
|
||||
if [ -f "$OUTPUT_DIR/$INITRAMFS_NAME" ]; then
|
||||
SIZE=$(du -h "$OUTPUT_DIR/$INITRAMFS_NAME" | cut -f1)
|
||||
echo -e "${GREEN}✓ Initramfs created with modified mkinitcpio: $OUTPUT_DIR/$INITRAMFS_NAME (${SIZE})${NC}"
|
||||
echo -e "${GREEN}OK: Initramfs created with modified mkinitcpio: $OUTPUT_DIR/$INITRAMFS_NAME (${SIZE})${NC}"
|
||||
|
||||
# Update todo to completed
|
||||
echo -e "${YELLOW}Marking initramfs build as completed...${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Failed to create initramfs with modified mkinitcpio${NC}"
|
||||
echo -e "${RED}FAIL: Failed to create initramfs with modified mkinitcpio${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ tar czf "$HOME/systemd-minimal-s390x.tar.gz" .
|
|||
TOTAL_SIZE=$(du -sh "$OUTPUT_DIR" | cut -f1)
|
||||
TARBALL_SIZE=$(du -sh "$HOME/systemd-minimal-s390x.tar.gz" | cut -f1)
|
||||
|
||||
echo -e "${GREEN}✓ Minimal systemd built successfully!${NC}"
|
||||
echo -e "${GREEN}OK: Minimal systemd built successfully!${NC}"
|
||||
echo -e "${GREEN}Total size: $TOTAL_SIZE${NC}"
|
||||
echo -e "${GREEN}Tarball size: $TARBALL_SIZE${NC}"
|
||||
echo -e "${GREEN}Tarball location: $HOME/systemd-minimal-s390x.tar.gz${NC}"
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ After=multi-user.target
|
|||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c 'echo "🚀 Arch Linux s390x boot completed successfully!"'
|
||||
ExecStart=/bin/sh -c 'echo "Arch Linux s390x boot completed successfully!"'
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
set -e
|
||||
|
||||
# Configuration
|
||||
KERNEL_VERSION="${KERNEL_VERSION:-6.6.10}"
|
||||
KERNEL_VERSION="${KERNEL_VERSION:-6.18.6}"
|
||||
OUTPUT_DIR="output"
|
||||
BOOT_DIR="boot"
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ For QEMU testing:
|
|||
make test
|
||||
EOF
|
||||
|
||||
echo -e "${GREEN}✓ Boot directory prepared successfully!${NC}"
|
||||
echo -e "${GREEN}OK: Boot directory prepared successfully!${NC}"
|
||||
echo -e "${GREEN}Boot files are in: $BOOT_DIR/${NC}"
|
||||
ls -la "$BOOT_DIR/"
|
||||
#
|
||||
Loading…
Reference in a new issue