Draft: [RFC] introduce postmarket-ui-steamos

Introduction

Alright, I have been working on this on and off for months with @kcxt. There is still a bunch to improve, but in general this works pretty nicely and we gotta start putting it out there / upstreaming all of this at some point.

This MR is not meant to be merged in this state. (See the release plan further below.) Rather it is meant as a way to get some initial feedback on the whole approach, find people interested in helping with this effort and providing an initial discussion place for kicking off further work.

This MR is an attempt at packaging Steam for PostmarketOS and providing a SteamOS like experience, specifically for handheld devices like the Steam Deck or the many Android Handhelds out there, like the Ayaneo Pocket S2 which @superna9999 has been upstreaming and adding support to pmOS. The latter is specifically the device both @kcxt and me have been testing this whole ordeal on, but I have also done some limited testing on x86 machines to ensure that is functional as well. (Making this a good experience for ARM devices however is my personal main motivation to do this.)

Approach

Packaging Steam

Steam at this point runs most of it's components in the steam-runtime including optionally the steam-client itself in the latest x86 beta. The steam-runtime fortunately has it's requirements for packaging pretty well documented, the biggest issue for postmarketOS is of course glibc.

As such we build a minimal OS-tree based on Valve's Steam Runtime + some additional libraries steam needs and most importantly an up-to-date mesa version. This happens over at this repo with mkosi. The artifacts are downloaded from CI when building the steam-runtime-amd64 and steam-runtime-arm64 packages respectively.

It also contains a shell-script to run steam in this runtime using bwrap. (The initial plan was to somehow compile the steam-runtime-tools and pressure-vessel for musl and just run steam the exact same way the steam-bootstrapper does on other distros for compatibility, but patching up these tools proved very cumbersome. The official steam-bootstrapper also ends up calling bwrap in the end, so this is still very close to that.)

The arm64-package is a little special, as it also downloads the x86-runtime + a little overlay package containing fex. Since the steam-runtime is debian-based, we can mix and match libraries for different architectures in the same image, allowing us to simply install FEX into the x86 image and run from there. In the arm64-runtime there is a little dirty hack replacing /bin/sh to detect steam trying to launch an x86-based steam runtime e.g. for Linux native games or x86-Proton runtimes and redirect it into our fex-container instead.

In general the arm64-build of steam used in this isn't super smart, meaning it doesn't include all the automatic stuff integrating FEX itself, which presumably it will do, once the Steam Frame releases (lots of files in the public steamos repos hint at that). As such while you can already download the ARM64EC wine proton build from steam, it is missing files to expose it in Steam, so the arm64 image also contains a little script to setup the ARM64-Proton build on first boot and setting it as the default proton runtime. (I am planning to write up all the hacks that have gone into taming this weird arm64-build of steam into a blog post soon-ish for anyone interested.)

All of this works on any desktop.

SteamOS-like experience

You may notice this doesn't only include the steam-runtime-{arm64,amd64} packages, most of the other packages are related to provide a more integrated experience very similar to SteamOS or Bazzite.

First of all, I think most distros are violating Valves License Agreements by shipping the bootstrapped Steam Client of the Steam Deck for first-time setup. It is quite neat, since it provides a polished interface that works with touchscreens and gamepads + network setup and such, but I don't think bundling that into a package is a good idea.

Instead I wrote a tool called the steam-session-bootstrapper (very creative, I know), which looks a little like this:

playback1

playback2

playback3

If postmarketos-ui-steamos is installed this will start on first-boot to download the steam client and then straight up boot into it. The bootstrapper also provides a steam-updater ui, something that is provided on SteamOS with a custom splash screen in plymouth.

4

Additional packages related to that include:

  • gamescope-session-plus is taken from ChimeraOS (but also packaged on other distros like Bazzite) and includes various quirks for handhelds
  • gamescope-session-steam is a package specifically for postmarketOS to start Steam with our container with gamescope-session-plus.
  • steamos-manager is a Valve tool to facilitate integrating steam with the OS. In the future we can implement more functionality through it like allowing Steam to format an inserted SD card.
  • steamos-powerbuttond valve tool, that forwards powerbutton pressed to steam to handle things like a long-press menu
  • steam-notif-daemon valve tool, that forwards libnotify notifications to steam for display

The session depends on postmarketos-ui-plasma and the "Desktop Mode" works as expected. The whole UI is only tested and supported with systemd. Many integrations could probably be provided for openrc, but I have no interest in working on that.

Ayaneo Pocket S2 specifics

The Ayaneo Pocket S2 handheld is kinda our flagship device showing this off, as such this has accumulated more packages:

  • ayaneo-platformd is another homegrown tool. A little daemon providing configuration on the ayaneo, that is typically done through proprietary android frontends, including fan control / profiles and led customization.
  • inputplumber is a tool to remap input devices on linux. It is used to combine the Xbox-compatible handheld controller and various vendor-specific buttons on the ayaneo to a single steam-deck like controller, that is exposed to steam. It contains configuration for various other handhelds.
  • decky-ayaneo is a homegrown decky plugin to control ayaneo-platformd from steam. As such this also includes a package for decky-loader. The developers of decky specifically only support Valve devices / SteamOS and many plugins contain binaries with glibc dependencies. As such I have made sure to add a disclaimer in the UI to not bug the original developers and disable the integrated updater for this inofficial port.

decky-ayaneo

This also includes a bunch of patches for linux-ayaneo-pocket-s2 from @kcxt, as well as device-ayaneo-pocket-s2 changes, include cpu affinity configs specifically for the steam session.

Other packages

  • steam-rom-manager is just a nice tool to manage external steam games and e.g. generate entries for ROM files for various emulators. Due to the steam sandbox this currently requires using emulators via AppImages in the home directory, but I want to eventually expose flatpak apps to the runtime and link the desktop-files into the container. We might also be able to generate desktop files for other applications + use host-spawn in the container to launch them and get them working somewhat cleanly with steam-rom-manager.

Release Plan

Patches

First of all this fork still contains some patches to various components, that need to be upstreamed to cut down on vendored packages:

Packages for alpine?

The following packages are generic enough, that they could be submitted for packaging in alpine instead:

  • inputplumber
  • gamescope-session-plus?
  • ayaneo-platformd?

I don't see them carrying the steam-package (though maybe? any opinions) as such they probably have no interest in any of the steam-specific supporting packages.

Packages left for inclusion in postmarketOS:

  • steam-runtime-{arm64,amd64}
  • steamos-powerbuttond
  • steam-notif-daemon
  • steam-rom-manager
  • steam-session-bootstrapper
  • gamescope-session-steam
  • decky-loader
  • decky-ayaneo

Next steps

So what this needs to be done next in my humble opinion (next to a lot of feedback and addressing that):

  • Start upstreaming patches we don't need to / want to carry in pmOS
  • Split this MR:
    • First probably simply submit only steam-runtime-{arm64,amd64} as a way to run steam on postmarketOS.
    • Secondly submit postmarketos-ui-steamos for a simpler target like the Steam Deck.
    • Submit all the patches specific to the ayaneo seperately, that don't have anything to do with Steam.
    • Lastly submit all the steam + ayaneo patches.

I am happy for any support on any of these. I am obviously happy to continue supporting my own projects (steam-session-bootstrapper, ayaneo-platformd) and also happy to maintain any of the new postmarketos packages proposed here. However I would love some support on that and don't really have the capacity to also maintain alpine packages and engage with another community (even if there is probably some overlap).

I hope this gets some other people other than Casey and myself excited about the possibility to turn our handheld into Linux gaming devices with postmarketOS. Thanks for reading through all of this. 😅

Edited by Victoria Brekenfeld

Merge request reports

Loading
Loading