Console Hacking 2016: Postscript

Another year, another console hacking talk! This talk picks off where our lighting talk last year left off, and goes into detail of how we ported Linux to the PS4.

If you haven’t watched it, take a look before reading the rest of this post:

Slides: Online · Download / source code

Last year we demoed Linux on the PS4. Since then, we’ve gotten 3D graphics working, polished a number of drivers, and wrote some new ones. Linux on the PS4 is now actually quite a usable OS, with some minor caveats. We can run Steam OS and many games stably (e.g. Portal 2, but most games that run well on Linux should work). The current kernel is based on Linux 4.9.

Continuing last year’s theme of focusing on the Linux port and loader instead of on exploits, this year’s talk focused on the hardware and what it takes to bring up Linux on a very much non-PC-compatible x86 platform. We also covered how we originally got kernel binary dumps via a hardware PCI Express man-in-the-middle attack two years ago, and Radeon reverse engineering tools.

So, what’s next? Well, last year we said we’d like to upstream some of the work into the Linux kernel, and we still plan to do so. Now that the drivers have been cleaned up a bit, that is starting to look more likely.

In addition, we are working on PS4 Pro support. Linux currently boots on it, but the GPU driver needs fixups. We are also interested in adding PS4 support to the newer AMDGPU kernel driver, so it might make sense to defer graphics work on the Pro until that is ready.

The platform is mostly limited by its CPU, as the PS4 has 8 rather weak cores while most PC games are optimized for 1 or 2 fast cores. Nonetheless, even the Dolphin emulator runs surprisingly well; it currently seems to be bottlenecked on CPU geometry processing, which might be caused by the Radeon driver (and might improve if we make improvements to that or switch to AMDGPU). In practice, we get anywhere from 3 to 30FPS on Wind Waker, mostly in the 20-30FPS range depending on how much geometry is in the direction of the viewport (the 3FPS moments seem to be some kind of degenerate case and are rare). With the Null GPU mode we do get ~30FPS, so the Gekko CPU emulation seems to be just about fast enough. There is plenty of pixel performance, so rendering GameCube games at 1080p or even beyond is no problem (we accidentally switched to 4K rendering at one point and it wasn’t even that slow). The PS4 Pro should work better, obviously.

We also need to work on performance switching and power management. Right now I’m not sure if the fan is doing the right thing, and the CPU performance mode is hardcoded in an init script, as the kernel CPU scaling is not working properly. The GPU might not be working in its maximum performance mode either. We’ll be taking a look at those issues soon.

As we said last year, we are not planning to release our exploits, as we believe that there are plenty of people capable of developing their own exploits for the PS4 userland and kernel; we are leaving that to the community. That said, we previously offered to help out anyone with an exploit who wants to run Linux, and our offer still stands: if you have a way to run kernel code on your PS4 and you want to run Linux, feel free to drop me a line. We had several people do so throughout the year and that helped fix some Linux bugs and improve ps4-kexec.

As usual, our repositories are all on GitHub: