Skip to content
RichardDorianPublic

About

📺 Experimental Linux based operating system for DIY TV boxes

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

TV OS

A small Linux operating system that turns a mini PC into a TV box, and decides for itself what every part of it does.

Latest release Status: experimental Platform: x86-64

Try it · Install it · Features · How it works · Build it

The TV OS home screen: a featured film full screen, the apps row below

Plug in a USB drive, pick a film, and the TV switches to the film's own refresh rate, and to HDR if the film has it. The sound can go to your receiver bit for bit. There is no desktop underneath: no systemd, no X11 or Wayland, no PipeWire. A custom kernel, our own init and a handful of Rust services do the work, in a download of under 50 MB.

Every behaviour of the box is a decision written down in this repository, with its reasons: see the decision records.

Warning

TV OS is experimental. The only apps are Files, Settings and Jellyfin (your own server's films and shows): there are no streaming services' apps yet (apps can be written: see docs/apps), no media library of the box's own and no automatic updates. See what's missing.

Try it in a virtual machine

You need an x86-64 Linux PC with QEMU (qemu-system-x86_64, with its GTK display), zstd and write access to /dev/kvm: without KVM the VM is very slow and may not start. Nothing is installed on the host. Download the QEMU archive and its .sha256 from the latest release, then:

sha256sum -c tvos-*-qemu.tar.zst.sha256
tar --zstd -xf tvos-*-qemu.tar.zst
cd tvos-*-qemu/
./run-qemu.sh

Use the arrows, Enter and Esc (all keys). The virtual machine has no GPU decoding and its sound is not played, so judge playback on a real PC. Release images don't include the artwork shown above: Home has a plain background.

Install it on a PC

Board Hardware Video decoding
intel Intel integrated graphics, Skylake (2015) to Meteor Lake / Arrow Lake GPU (VA-API)
amd Ryzen with a Radeon 780M; other GPUs need their firmware added CPU
qemu Virtual machine CPU

Wi-Fi works only on the intel board, with an Intel AX200, AX201, AX210 or AX211 card; so does that card's Bluetooth. The amd board has no Wi-Fi driver and no built-in Bluetooth firmware: use Ethernet. The Intel board notes list what is and isn't covered. Raspberry Pi 5 is planned; only notes exist.

TV OS runs from the USB stick and installs nothing on the PC's internal disk, but it mounts the partitions it can read there, read-only, and shows them in Files. Mounting an ext4 partition that wasn't cleanly unmounted can still replay its journal, so don't boot the stick on a PC whose Linux is hibernated.

Download the image for your board from the latest release, then write it to a stick:

lsblk                                # find the stick; check its size and name
sudo umount /dev/sdX*                # if any of its partitions are mounted
xz -dc tvos-*-intel.img.xz | sudo dd of=/dev/sdX bs=4M conv=fsync status=progress

Caution

This erases everything on /dev/sdX. Check the device name twice.

Turn Secure Boot off (the kernel isn't signed) and choose the stick in the PC's boot menu, often F12, F10 or Esc.

What works

Settings, Display: resolution, refresh rate, HDR, tone mapping and frame rate matching

Picture Refresh rate matched to the content, VRR where the GPU drives it (0004); HDR10 and HLG output (0013), or tone mapping with four curves on SDR screens (0012); on Intel, GPU-decoded frames go to a display plane without a copy (0017)
Sound Dolby Digital, Dolby Digital Plus, TrueHD, DTS and DTS-HD passthrough over HDMI (0014); HDMI, analog, USB and Bluetooth outputs, each with its own settings (0010); volume of outputs that get PCM only (0015), otherwise on the TV or receiver; Bluetooth codecs SBC, AAC, aptX, aptX HD and LDAC, chosen per device (0021)
Playback One FFmpeg-based player with our own clock and A/V sync; audio and subtitle track choice (0003)
Files FAT32, exFAT, NTFS and ext4, on USB and internal drives, mounted read-only (0008)
Input Remotes, keyboards and game controllers over USB (0005, 0018) or Bluetooth (0011); the TV's own remote through HDMI-CEC
Network Ethernet, and, on the intel board, Wi-Fi with WPA2/WPA3 Personal (0009)
Interface Made for a D-pad at three metres; Home, Quick settings with notifications, and Diagnostics showing what the TV and audio devices report
Apps Each app its own process drawing its own UI, with the system's player, rows on Home and links between apps; Files, Settings and Jellyfin are apps; an app can live in its own repository (0022, docs/apps)
Jellyfin Films and shows from a Jellyfin server, played directly by the system's player and resumed where they were left (0024)

Not yet

  • Apps and content: streaming apps, a media library, search, user profiles, a photo viewer. Home's featured titles are a fixed list (0016).
  • Playback: picture subtitles in separate files (.sup, .idx/.sub).
  • Connectivity: Enterprise Wi-Fi, anything that uses a Bluetooth headset's microphone (the profile is there, off), Bluetooth LE Audio.
  • System: updates, UI sounds, Raspberry Pi 5.

Controls

Key Action
Arrows, Enter Move, OK
Hold Enter on an app Its options: move it on Home, take it off Home (it stays in All apps) or put it back (0023)
Esc or Backspace Back
H Home
M Quick settings; audio and subtitles in the player
Space Play or pause
T Audio and subtitles
I Playback information
P Power
Volume and mute keys Volume, here or on the TV or receiver over CEC

Remotes use their navigation and media buttons. Controllers use the D-pad, hat or left stick. A TV remote needs CEC enabled on the TV and a CEC adapter on the box, such as a Pulse-Eight USB adapter. The physical keyboard layout (US QWERTY, French AZERTY or German QWERTZ) is chosen in Settings > Remotes & devices.

How it works

flowchart TD
    init["tvos-init (PID 1): starts and supervises every service"]
    init --> shell["shell: display, input, UI"]
    init --> player["player: FFmpeg, clock, A/V sync"]
    init --> audiod["audiod: audio outputs"]
    init --> netd["netd: Ethernet, Wi-Fi"]
    init --> btd["btd: Bluetooth"]
    init --> devd["devd: USB, drives"]
    init --> cecd["cecd: HDMI-CEC"]
    player -. "video frames" .-> shell
Loading
  • The shell owns the screen. It drives KMS and reads evdev directly; Slint only renders (0002). Apps draw their own UI into memory the shell shows, and get actions, never devices (0022).
  • Sound goes straight to ALSA, with no sound server to resample or reroute it; the player resamples only when the output needs it (0001).
  • No kernel modules, no udev, no systemd. If a driver isn't chosen at build time, it isn't there (0006).
  • Policy is data. Display modes, audio formats, storage, key maps and apps are TOML files in policy/.

docs/architecture.md has the whole picture.

Build it

Clone with the pinned Buildroot submodule and install just:

git clone --recurse-submodules https://github.com/RichardDorian/tvos.git
cd tvos
just            # list every task

On your PC. Needs Rust 1.95 or newer, a C compiler, and the development headers of FFmpeg, libass and alsa-lib (libva is optional).

just test         # unit tests
just run-desktop  # every service on this PC, the shell in a window
just screenshots  # render the UI into shots/

Images. Needs Buildroot's host packages and about 12 GB of disk per board. The first build is long.

just image              # QEMU image
just run-qemu           # boot it in a window
just smoke              # boot it headless, drive it with keys, check it
just libvirt            # install it as a VM in virt-manager

just image intel        # or amd
just efi-test intel     # boot it under UEFI in QEMU (no GPU there)
just flash intel /dev/sdX

just image intel-dev and amd-dev build development variants, with logs on screen and kept on the stick. They and the QEMU image have a root shell on the serial port; intel and amd release images have no shell at all.

Pushing a tag builds every board's image and attaches it to a release.

Repository layout
buildroot/   Buildroot, pinned, never edited
external/    BR2_EXTERNAL: defconfigs, boards (kernel configs, images), packages
src/         Rust workspace
  bin/       init, shell, player, netd, btd, devd, audiod, cecd
  apps/      the system's apps: files, settings, jellyfin
  lib/       display, media, av, alsa, dbus, input, ipc, http, policy, settings,
             app (the app SDK, with the design system's .slint files), app-build
  ui/        the shell's .slint screens
examples/    an app built outside the workspace
policy/      what the box supports, as data
assets/      fonts, featured titles, app art (CC BY-SA 4.0)
docs/        architecture, decision records, the app API (docs/apps)
tools/       configure, flash, test and development scripts
tests/       media expectations, hardware test plans

Contributing

Issues and pull requests are welcome. Reports from real hardware are especially useful: say which board image, PC, GPU and TV or receiver you use, and what Settings > Diagnostics shows. Before a pull request, run just test, and just smoke if it changes what the box does. A change to a documented behaviour updates its decision record too.

License

TV OS is free software under the GNU General Public License, version 3 or later (GPL-3.0-or-later): you may use, change and share it, and anyone who ships it, changed or not, must offer its source under the same license. The shell's UI toolkit, Slint, is free on devices only under the GPL 3.0, which is one reason for this choice.

The bundled Inter and Space Grotesk fonts are under the SIL Open Font License. Images also contain third-party software (Linux, FFmpeg, BlueZ and others) under their own licenses.

About

📺 Experimental Linux based operating system for DIY TV boxes

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages