Switch default to ubuntu2604 and rename ubuntu to ubuntu2404.

This commit is contained in:
Andy Nguyen
2026-04-28 19:45:10 +02:00
parent 34de424611
commit 8a9d48bb65
12 changed files with 37 additions and 171 deletions

View File

@@ -1,6 +1,6 @@
# PS5 Linux Image Builder
Builds bootable Linux USB images for PlayStation 5 using Docker containers. Supports Ubuntu 24.04, Ubuntu 26.04, Arch, and Alpine, individually or as a multi-distro image with kexec switching.
Builds bootable Linux USB images for PlayStation 5 using Docker containers. Supports Ubuntu 26.04, Ubuntu 24.04, Arch, and Alpine, individually or as a multi-distro image with kexec switching.
## Prerequisites
@@ -17,13 +17,17 @@ newgrp docker
## Quick Start
```bash
# Build a single Ubuntu 24.04 image
./build_image.sh --distro ubuntu
# Build a single Ubuntu 26.04 image
./build_image.sh --distro ubuntu2604
# Build a multi-distro image (ubuntu + ubuntu2604 + arch + alpine)
OR
# Build a single Ubuntu 24.04 image
./build_image.sh --distro ubuntu2404
OR
# Build a multi-distro image (ubuntu2604 + ubuntu2404 + arch + alpine)
./build_image.sh --distro all
```
@@ -32,14 +36,14 @@ The script auto-clones the kernel source, applies PS5 patches, compiles, and bui
## Flash to USB
```bash
sudo dd if=output/ps5-ubuntu.img of=/dev/sdX bs=4M status=progress
sudo dd if=output/ps5-ubuntu2604.img of=/dev/sdX bs=4M status=progress
```
## Options
| Flag | Description | Default |
|------|-------------|---------|
| `--distro` | `ubuntu`, `ubuntu2604`, `arch`, `alpine`, or `all` | `ubuntu` |
| `--distro` | `ubuntu2604`, `ubuntu2404`, `arch`, `alpine`, or `all` | `ubuntu2604` |
| `--kernel` | Path to kernel source directory | auto-clone `v6.19.10` |
| `--img-size` | Disk image size in MB | `12000` (`32000` for `all`) |
| `--clean` | Remove all cached build artifacts and start fresh | off |
@@ -60,7 +64,7 @@ Use `--clean` to wipe everything and rebuild from scratch. The build will also s
PS5 Linux Image Builder
=======================
Distro: all
(ubuntu ubuntu2604 arch alpine)
(ubuntu2604 ubuntu2404 arch alpine)
Image size: 32000MB
Kernel src: /path/to/work/linux
@@ -94,12 +98,12 @@ All verbose output goes to `build.log`. The terminal shows a spinner with live p
| Partition | Type | Label | Content |
|-----------|------|-------|---------|
| p1 | FAT32 | boot | Shared kernel, per-distro initrds, kexec scripts |
| p2 | ext4 | ubuntu | Ubuntu 24.04 rootfs |
| p3 | ext4 | ubuntu2604 | Ubuntu 26.04 rootfs |
| p2 | ext4 | ubuntu2604 | Ubuntu 26.04 rootfs |
| p3 | ext4 | ubuntu2404 | Ubuntu 24.04 rootfs |
| p4 | ext4 | arch | Arch rootfs |
| p5 | ext4 | alpine | Alpine rootfs |
The boot partition contains kexec scripts to switch between distros at runtime. Ubuntu 24.04 is the default boot target.
The boot partition contains kexec scripts to switch between distros at runtime. Ubuntu 26.04 is the default boot target.
## Directory Layout
@@ -113,7 +117,7 @@ docker/
entrypoint.sh # Single-distro build logic
entrypoint-multi.sh # Multi-distro build logic
distros/
ubuntu/ # Ubuntu 24.04 (Noble)
ubuntu2404/ # Ubuntu 24.04 (Noble)
ubuntu2604/ # Ubuntu 26.04 (Resolute)
arch/ # Arch Linux
alpine/ # Alpine 3.21
@@ -121,7 +125,7 @@ distros/
boot/
cmdline.txt # Kernel cmdline template (__DISTRO__ placeholder)
vram.txt # VRAM allocation
kexec-{ubuntu,ubuntu2604,arch,alpine}.sh
kexec-{ubuntu2604,ubuntu2404,arch,alpine}.sh
work/ # Build artifacts (auto-created)
linux-bin/ # Compiled kernel packages
output/ # Final .img files

View File

@@ -1,6 +0,0 @@
#!/bin/sh
# Switch to Ubuntu via kexec
set -e
BOOT=/boot/efi
kexec -l "$BOOT/bzImage" --initrd="$BOOT/initrd-ubuntu.img" --command-line="$(cat $BOOT/cmdline-ubuntu.txt)"
kexec -e

6
boot/kexec-ubuntu2404.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
# Switch to Ubuntu 24.04 via kexec
set -e
BOOT=/boot/efi
kexec -l "$BOOT/bzImage" --initrd="$BOOT/initrd-ubuntu2404.img" --command-line="$(cat $BOOT/cmdline-ubuntu2404.txt)"
kexec -e

View File

@@ -2,18 +2,18 @@
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
DISTRO="ubuntu"
DISTRO="ubuntu2604"
KERNEL_SRC=""
CLEAN=false
IMG_SIZE=12000
MULTI_DISTROS="ubuntu ubuntu2604 arch alpine"
MULTI_DISTROS="ubuntu2604 ubuntu2404 arch alpine"
usage() {
echo "Usage: $0 [--distro <distro>] [--kernel <path>] [--img-size <MB>] [--clean]"
echo ""
echo "Options:"
echo " --distro Distribution to build: ubuntu, ubuntu2604, arch, alpine, all (default: ubuntu)"
echo " --distro Distribution to build: ubuntu2604, ubuntu2404, arch, alpine, all (default: ubuntu2604)"
echo " --kernel Path to kernel source directory (default: auto-clone to work/linux/)"
echo " --img-size Disk image size in MB (default: 12000, 32000 for --distro all)"
echo " --clean Remove all cached build artifacts and start from scratch"
@@ -34,8 +34,7 @@ done
LINUX_REPO="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
LINUX_DEFAULT_DIR="$SCRIPT_DIR/work/linux"
# TODO: switch to https://github.com/ps5-linux/ps5-linux-patches.git once repo is public
PATCHES_REPO="git@github.com:ps5-linux/ps5-linux-patches.git"
PATCHES_REPO="https://github.com/ps5-linux/ps5-linux-patches.git"
PATCHES_DIR="$SCRIPT_DIR/work/ps5-linux-patches"
PATCHES_CONFIG=".config"

View File

@@ -12,8 +12,8 @@ DISTRO="unknown"
cp "/boot/vmlinuz-$KVER" "$BOOT_PART/bzImage"
cp "/boot/initrd.img-$KVER" "$BOOT_PART/initrd-${DISTRO}.img"
# Ubuntu is default boot — also update the generic initrd.img
if [ "$DISTRO" = "ubuntu" ]; then
# Ubuntu 26.04 is default boot — also update the generic initrd.img
if [ "$DISTRO" = "ubuntu2604" ]; then
cp "/boot/initrd.img-$KVER" "$BOOT_PART/initrd.img"
fi

View File

@@ -1,137 +0,0 @@
image:
name: ps5-ubuntu-minimal
distribution: ubuntu
release: noble
description: Ubuntu Noble minimal (for testing)
architecture: x86_64
source:
downloader: debootstrap
url: http://archive.ubuntu.com/ubuntu
variant: minbase
keyserver: keyserver.ubuntu.com
keys:
- 0x790BC7277767219C42C86F933B4FE6ACC0B21F32
- 0xf6ecb3762474eda9d21b7022871920d1991bc93c
packages:
manager: apt
update: true
cleanup: true
repositories:
- name: sources.list
url: |-
deb http://archive.ubuntu.com/ubuntu {{ image.release }} main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu {{ image.release }}-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu {{ image.release }}-security main restricted universe multiverse
architectures:
- amd64
sets:
- packages:
- ubuntu-desktop-minimal
- firefox
- openssh-server
- network-manager
- linux-firmware
- initramfs-tools
- kmod
- sudo
- nano
- cloud-guest-utils
- kexec-tools
action: install
files:
- path: /etc/hostname
generator: hostname
- path: /etc/hosts
generator: hosts
- path: /etc/machine-id
generator: dump
- path: /etc/NetworkManager/conf.d/dns.conf
generator: copy
source: /tmp/build-staging/nm-dns.conf
- path: /etc/kernel/postinst.d/zz-update-boot
generator: copy
source: /tmp/build-staging/zz-update-boot
mode: "0755"
- path: /etc/fstab
generator: copy
source: /tmp/build-staging/fstab
- path: /usr/local/sbin/grow-rootfs
generator: copy
source: /tmp/build-staging/grow-rootfs
mode: "0755"
- path: /etc/systemd/system/grow-rootfs.service
generator: copy
source: /tmp/build-staging/grow-rootfs.service
- path: /opt/debs/
generator: copy
source: /tmp/build-staging/debs
actions:
- trigger: post-unpack
action: |-
#!/bin/bash
set -eux
# Install gnupg + dirmngr so we can fetch the Mozilla PPA key
apt-get update
apt-get install -y gnupg dirmngr curl
# Import Mozilla PPA signing key and add repository
mkdir -p /root/.gnupg /etc/apt/keyrings
chmod 700 /root/.gnupg
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0AB215679C571D1C8325275B9BDB3D89CE49EC21" | \
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/keyrings/mozillateam.gpg --import
chmod 644 /etc/apt/keyrings/mozillateam.gpg
echo "deb [signed-by=/etc/apt/keyrings/mozillateam.gpg] http://ppa.launchpad.net/mozillateam/ppa/ubuntu noble main" \
> /etc/apt/sources.list.d/mozilla-ppa.list
# Pin PPA firefox over snap transitional package
cat > /etc/apt/preferences.d/mozilla-ppa << 'PINEOF'
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
PINEOF
- trigger: post-update
action: |-
#!/bin/bash
set -eux
passwd -l root
- trigger: post-packages
action: |-
#!/bin/bash
set -eux
# SSH — password auth only, root login via sudo
sed -i 's/^#*PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
systemctl enable ssh
- trigger: post-files
action: |-
#!/bin/bash
set -eux
systemctl enable grow-rootfs.service
systemctl enable systemd-resolved
mkdir -p /boot/efi
dpkg -i /opt/debs/*.deb
rm -rf /opt/debs
KVER=$(ls -1t /lib/modules | head -1)
update-initramfs -c -k "$KVER"
/etc/kernel/postinst.d/zz-update-boot "$KVER"
mappings:
architecture_map: debian

View File

@@ -1,5 +1,5 @@
image:
name: ps5-ubuntu
name: ps5-ubuntu2404
distribution: ubuntu
release: noble
description: Ubuntu Noble desktop

View File

@@ -5,7 +5,7 @@ set -ex
IMG_SIZE="${IMG_SIZE:-32000}"
SKIP_CHROOT="${SKIP_CHROOT:-false}"
DISTROS="${DISTROS:-ubuntu ubuntu2604 arch alpine}"
DISTROS="${DISTROS:-ubuntu2404 ubuntu2604 arch alpine}"
STAGING="/tmp/build-staging"
EFI_LABEL="boot"
IMG="/output/ps5-multi.img"
@@ -252,9 +252,9 @@ for DISTRO in $DISTROS; do
rm -rf "$CHROOT/boot/efi"/*
done
# Ubuntu is default boot — copy its initrd as the generic initrd.img
if [ -f /tmp/mnt_boot/initrd-ubuntu.img ]; then
cp /tmp/mnt_boot/initrd-ubuntu.img /tmp/mnt_boot/initrd.img
# Ubuntu 26.04 is default boot — copy its initrd as the generic initrd.img
if [ -f /tmp/mnt_boot/initrd-ubuntu2604.img ]; then
cp /tmp/mnt_boot/initrd-ubuntu2604.img /tmp/mnt_boot/initrd.img
fi
# Generate per-distro cmdline files
@@ -262,8 +262,8 @@ for DISTRO in $DISTROS; do
sed "s|__DISTRO__|${DISTRO}|" /repo/boot/cmdline.txt > "/tmp/mnt_boot/cmdline-${DISTRO}.txt"
done
# Default cmdline points to ubuntu
sed "s|__DISTRO__|ubuntu|" /repo/boot/cmdline.txt > /tmp/mnt_boot/cmdline.txt
# Default cmdline points to ubuntu2604
sed "s|__DISTRO__|ubuntu2604|" /repo/boot/cmdline.txt > /tmp/mnt_boot/cmdline.txt
# Copy kexec scripts
for DISTRO in $DISTROS; do

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -ex
DISTRO="${DISTRO:-ubuntu}"
DISTRO="${DISTRO:-ubuntu2604}"
IMG_SIZE="${IMG_SIZE:-12000}"
SKIP_CHROOT="${SKIP_CHROOT:-false}"
STAGING="/tmp/build-staging"