archlinux-steamlink
archlinux-steamlink copied to clipboard
run arch linux arm on a steamlink, without touching the nand
archlinux-steamlink
Running Arch Linux ARM on the Steam Link.
Yes, running - no puny chroot.
The Steam Link has ~256MiB of RAM (unlike what Wikipedia says),
and a Marvell ARMv7 CPU (1 Core, 1 Thread) (MV88DE3108
).
Directly booting a custom image has been made /harder/ due to contractual requirements.
This repository explores alternative methods.
Requirements
- Ethernet connectivity to the Steam Link
- A USB Stick
Build requirements
-
bsdtar
-
curl
-
sudo
-
e2fsprogs
Preparing the USB
- partition the USB to one big partition
-
sudo mkfs.ext4 /dev/sdXY
-
sudo tune2fs -O ^has_journal /dev/sdXY
- disable journaling (no kernel support)
Working
- Full userspace replacement
- Handoff to systemd
Technical explanation
Three scripts - factory_test
, init-trampoline
and handoff
- work together to replace
the running userspace (including PID 1) with a different one.
-
factory_test
:- convince steam link that it is being QA/QC'd, and make it exec
handoff
- convince steam link that it is being QA/QC'd, and make it exec
-
handoff
:- creates a copy of
/sbin/init
in a tmpfs - masks
/sbin/init
, overlayinginit-trampoline
- calls the previously-copied
init
binary astelinit u
to reexec init- this causes PID 1 to exec
init-trampoline
- this causes PID 1 to exec
- creates a copy of
-
init-trampoline
:-
pivot_root
s to the new userspace rootfs -
chroot
s to the new userspace rootfs to work around an issue causing the caller to still have their cwd in the old rootfs - creates necessary system mountpoints
- execs
lib/systemd/systemd
to hand off PID 1 to systemd
-
Todo
- Maybe open a fd to /sbin/init in
handoff
before mounting it, saves us from copying it to tmpfs - A patched kexec works with limitations
- Restructure repo into two methods: trampoline/kexec
- Potentially submit patched kconfig to archlinux arm upstream, or provide unofficial builds
Special thanks
-
grawity:
handoff
idea, debugging