Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Steam Deck Support #34

Merged
merged 55 commits into from
Dec 2, 2022
Merged

Add Steam Deck Support #34

merged 55 commits into from
Dec 2, 2022

Conversation

Hoverbear
Copy link
Contributor

@Hoverbear Hoverbear commented Nov 2, 2022

The Steam Deck has a read-only root, so it demands some special attention. This is also a good way to test plan flexibility.

Testing instructions are in src/planner/linux/steam_deck.rs and copied here:

One time step:

  1. Grab the SteamOS: Steam Deck Image from https://store.steampowered.com/steamos/download/?ver=steamdeck&snr=

  2. Extract it (this can take a bit)

    bunzip2 steamdeck-recovery-4.img.bz2
  3. Create a disk image

    qemu-img create -f qcow2 steamos.qcow2 64G
  4. Start a VM to run the install onto the created disk

    Note:

    RECOVERY_IMAGE=steamdeck-recovery-4.img
    nix build "nixpkgs#legacyPackages.x86_64-linux.OVMF.fd" --out-link ovmf
    qemu-system-x86_64 -enable-kvm -smp cores=4 -m 8G \
        -device usb-ehci -device usb-tablet \
        -device intel-hda -device hda-duplex \
        -device VGA,xres=1280,yres=800 \
        -drive if=pflash,format=raw,readonly=on,file=ovmf-fd/FV/OVMF.fd \
        -drive if=virtio,file=$RECOVERY_IMAGE,driver=raw \
        -device nvme,drive=drive0,serial=badbeef \
        -drive if=none,id=drive0,file=steamos.qcow2
  5. Pick "Reimage Steam Deck". Important: when it is done do not reboot the steam deck, hit "Cancel"

  6. Run sudo steamos-chroot --disk /dev/nvme0n1 --partset A and inside run this

    steamos-readonly disable
    echo -e '[Autologin]\nSession=plasma.desktop' > /etc/sddm.conf.d/zz-steamos-autologin.conf
    passwd deck
    sudo systemctl enable sshd
    steamos-readonly enable
    exit
  7. Run sudo steamos-chroot --disk /dev/nvme0n1 --partset B and inside run the same above commands

  8. Safely turn off the VM!

Repeated step:

  1. Create a snapshot of the base install to work on
    cp steamos.qcow2 steamos-hack.qcow2
  2. Run the VM
    nix build "nixpkgs#legacyPackages.x86_64-linux.OVMF.fd" --out-link ovmf
    qemu-system-x86_64 -enable-kvm -smp cores=4 -m 8G \
        -device usb-ehci -device usb-tablet \
        -device intel-hda -device hda-duplex \
        -device VGA,xres=1280,yres=800 \
        -drive if=pflash,format=raw,readonly=on,file=ovmf-fd/FV/OVMF_CODE.fd \
        -drive if=pflash,format=raw,readonly=on,file=ovmf-fd/FV/OVMF_VARS.fd \
        -drive if=virtio,file=steamos-hack.qcow2 \
        -device virtio-net-pci,netdev=net0 \
        -netdev user,id=net0,hostfwd=tcp::2222-:22
  3. Do your testing! You can ssh deck@localhost -p 2222 in and use rsync -e 'ssh -p 2222' result/bin/harmonic deck@localhost:harmonic to send a harmonic build.
  4. Delete steamos-hack.qcow2

@Hoverbear Hoverbear self-assigned this Nov 2, 2022
@Hoverbear Hoverbear changed the title Add Steam Deck Support Add Partial Steam Deck Support Nov 14, 2022
@Hoverbear Hoverbear changed the title Add Partial Steam Deck Support Add Steam Deck Support Nov 14, 2022
@Hoverbear Hoverbear mentioned this pull request Nov 15, 2022
@Hoverbear
Copy link
Contributor Author

https://lists.freedesktop.org/archives/systemd-devel/2022-October/048426.html

tl;dr: you should add a normal service to /etc/systemd, and use ExtensionImages= to make the service have the ext activated in its mount namespace

@Hoverbear Hoverbear marked this pull request as ready for review November 23, 2022 18:14
@Hoverbear
Copy link
Contributor Author

It's in a good enough state I'd install it on my own device now, in fact I will tomorrow. :)

@Hoverbear
Copy link
Contributor Author

... Github Actions isn't building the right checkout? What?

@Hoverbear Hoverbear requested review from cole-h and removed request for lheckemann November 29, 2022 17:38
Copy link
Member

@cole-h cole-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and it seemed to work. Rebooted and it still worked, too! Some doc comments went missing, so I added suggestions for them below.


One thing that could be improved overall is that we never tell the user they may need to reload their environment (by opening a new terminal or exec $SHELL or something). If you run it without -v, it just silently exits (which is fine, though I would like some indication that it completed successfully by default...), and if you try to nix-shell right after that, it won't work and the user is left guessing if it actually completed, or if something went wrong. I'll make a ticket about this.

src/planner/mod.rs Show resolved Hide resolved
src/settings.rs Show resolved Hide resolved
src/settings.rs Show resolved Hide resolved
@cole-h
Copy link
Member

cole-h commented Nov 30, 2022

Failed CI because there's no buildkite stuff setup in this branch. I think that's fine.

@Hoverbear
Copy link
Contributor Author

Thank you for the fixes! :)

@Hoverbear Hoverbear merged commit ae37842 into main Dec 2, 2022
@Hoverbear Hoverbear deleted the steam-deck branch December 2, 2022 15:31
@Hoverbear Hoverbear added this to the 0.0.1 milestone Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants