Skip to content

feeRnt/ps4-linux-12xx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,355,007 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux Kernel - On the Sony PlayStation 4

This is a Linux Kernel source tailored to run on exploitable PlayStation 4 systems with various subsystem patches from
the fail0verflow team,
eeply,
Ps3itaTeam,
rancido,
valeryy (no Github - contributed to PS4 Baikal southbridges),
mircoho,
codedwrench,
tihmstar,
crashniels,
saya,
whitehax0r,
DFAUS -- and others.

For a more detailed credits section, check out this page.

This fork aimed to make the internal WiFi+Bluetooth modules on specific PlayStation models with the Marvell 88w8897 combo card (internal codename Torus 2) functional, as they typically error out on the default kernels.

Over time, I also managed to fix the common blackscreen at GUI login issue on newer kernels, and added support for various miscellaneous components such as the MT7668 WiFi and BT chip on certain consoles.
The branch names are meant to be descriptive and provide an idea, but they're far from perfect!

Merging all the main fixes into a few distinct branches is a WIP.



Console Models and Southbridge

While the CUH-1216/1215 models are definitively known to have the Torus 2 models with probelmatic WiFi, along with some 11xx models with similar WiFi issues, here is a list of consoles reported working without any hiccups from the kernels in this repo:

Console Model Variation WiFi+BT Chip Present Compatible Kernel (Patched)
CUH-1216(A/B) Phat - Belize B0 Marvell 88w8897 (Torus 2) 6.15.4, 5.15.15
CUH-1215(A/B) Phat - Belize Marvell 88w8897 (Torus 2) 6.15.4, 5.15.15
CUH-1003 Phat - Aeolia ? 6.15.4; probably non-built in firmware version
CUH-1004A Phat - Aeolia Marvell 88w8797 (Torus 1) 6.15.4; non-built in firmware version
CUH-1116A Phat - Aeolia ? 6.15.4
CUH-2215B Slim - Baikal ? 5.4.247
CUH-2216A Slim - Baikal B1 MediaTek 7668 5.4.247
CUH-2216A Slim - Belize MediaTek 7668 5.15.15
CUH-7116B Pro - Baikal B1 ? 5.4.247
CUH-7202B Pro - Baikal ? 5.4.247
CUH-7216B Pro - Baikal MediaTek 7668 5.4.247
[A and B are just hard-drive specification: 500 GB vs 1000GB].

Aeolia, Belize and Baikal are the console Southbridges.
B0, B1 etc. are the Southbridge subrevisions.
  • [[ Note: For 5.4.247 kernels, the latest working Mesa is version 25.1.x. Ensure your distribution ships this when picking a distro for these kernels for proper GPU function. See this issue. ]]

  • [[ Certain older models (specifically the 1004A) needed a kernel that was built without embedding the latest proprietary firmware blobs (for Marvell SDIO WiFi+Bluetooth), and instead functioned properly with older firmware sourced from the initramfs. For these, each affected kernel release has a "no-built-in-fw" version for best functionality. See the releases page of the referring kernels or this issue for info. ]]

  • TODO: Add a list with all supported console models, their southbridges, and their compatible kernels.


Fixing the Wireless Card on CUH-1216

The main patches which in combination fix the CUH-1216/1215 wireless module are:
150 MHz rate limit quirk on the 88w8897 card's Function 0.

relying on the patch for added sdio_id for the Function 0,

Then a few SDHCI Host quirks for the PlayStation SDHCI host {only the SDHCI_QUIRK2_PRESET_VALUE_BROKEN is needed now},

additionally with extra retries for MMC CMD 52 or 53, which it would usually fail on {this is optional}.

The primary culprit behind the failed SDIO initialization, seems to be that the card doesn't properly support 208 or 200 MHz clock rate on this PS4 SDHCI host, causing the card to show tuning and other command failures. You can read more about the search for a solution from here.

Through MUCH trial and error, I was able to reach such an arcane fix,

Many of the kernels I had to compile and test before finally landing on the fix kernel

and here's a screenshot with working internal WiFi and Bluetooth as shown in the logs, on an Arch Linux system running on my CUH-1216 console:

Working WiFi image

Hard work paid off!



Branches

There are different branches that you can select on the repo,
x_old__ps4-linux-5.15.y and x_old__ps4-linux-5.15.y-conservative2 are branches with excessive debug logs, that helped me pinpoint the issue on the whole MMC stack. Due to the logging, it is not advisable to use those kernel branches.

The other "x_experimental__" or "x_exp__" prefixed branches were made for debugging & testing a particular subsystem or problem in the kernel, and are not advised to be used.
They are only kept for further future experiment, archive or study only.

- - For example, the x_experimental__5.15.15-fix-baikal branch is non-functional. Kernel 5.15 is not reported to be working on any Baikal console, but it's kept for testing only.


The 5.15.15-aeolia-belize is a branch without the PS4 patches from codedwrench's Baikal branch.
It still runs as intended on a Belize (no blackscreen fix yet), but you will get bad errors. Should be used for testing only.

However, it probably runs on Aeolia models, unlike the *-belize -only branches. (Not tested yet)


The main release branches are:

  • 5.15.15-belize : The clean WiFi, Blackscreen & other misc. fixes' branch for Kernel version 5.15.15 on Belize southbridges.
    This is the primary branch of the repo.

  • 5.15.189-belize : The clean WiFi & Blackscreen fix branch for Kernel version 5.15.189 on Belize southbridges.
    (Not as well maintained as 5.15.15)

  • 5.4.247-baikal-dfaus: A branch for version 5.4.247 with fixed blackscreen and MT7668 support for Baikal southbridges.
    Based on DFAUS' source.

  • 6.15.4-aeolia-belize-crashniels : The clean WiFi, Blackscreen & other misc. fixes' branch for Kernel version 6.15.4, on Aeolia/Belize southbridges.
    Based on crashniels' source.



Compile and Build

To compile any of these branches, you can simply fork the repo, go to the Actions tab and run the Workflow file for build-kernel_latest.yaml for a particular branch.

Or if you would like to build locally, just clone the repo for your desired branch and run the necessary commands (commands based on Ubuntu 24.04):

Build-deps

apt-get update
apt-get install build-essential

# gcc-11 is ideal for compiling the 5.4 & 5.15.y kernels, and can build 6.15.y too
# Otherwise you will have many typecheck and compile errors compiling the older kernels
apt-get-install libssl-dev gcc-11 libgcc-11-dev -y # Needs libssl-dev, at least on 5.x

apt-get install clang-14 lld-14 llvm-14 -y # Needs LLVM-14 to compile 5.4.247 and 5.15.15
apt-get install clang lld llvm -y # Will get LLVM-18 on Ubuntu 24.04; can compile 6.15.4

apt-get build-dep linux -y

Configuration and compilation

git clone https://github.com/feeRnt/ps4-linux-12xx --branch <desired-branch-name> --depth=3
# keep a low depth to save on space

cd ps4-linux-12xx

## Copy additional firmware files
if [ -d extra_firmware ]; then
    if [ ! -z "$( ls -A 'extra_firmware/')" ]; then
        echo "Copying extra firmware to /lib/firmware"
        cp -ri extra_firmware/* /lib/firmware
    fi
fi

echo "Copying even more (mainline) extra firmware to /lib/firmware"

sudo mkdir /lib/firmware/mrvl
wget -nc https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mrvl/sd8897_uapsta.bin \
&& sudo mv -i sd8897_uapsta.bin /lib/firmware/mrvl

wget -nc https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mrvl/sd8797_uapsta.bin \
&& sudo mv -i sd8797_uapsta.bin /lib/firmware/mrvl

sudo mkdir /lib/firmware/mediatek
wget -nc https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mediatek/mt7668pr2h.bin \
&& sudo mv -i mt7668pr2h.bin /lib/firmware/mediatek

## Rename .config file

mv config .config

## Set installation variables
export localversion=`cat .config | grep CONFIG_LOCALVERSION= | sed -nE 's|^.*="-||p' | tr -d '"'` # expects CONFIG_LOCALVERSION starting with a dash
export INSTALL_DIR="${PWD}/install_path/${localversion}/install"

## Set compiler options

export KCFLAGS="-march=btver2 -mtune=btver2 -O3"
export KAFLAGS="-march=btver2 -mtune=btver2 -O3"
export KCPPFLAGS="-march=btver2 -mtune=btver2 -O3"
# O3 is experimental; maybe O2 gives better performance on 5.x kernels?

## Set build options (for GCC)
export MAKE_OPTS="-j`nproc` \
             INSTALL_PATH="${INSTALL_DIR}/boot" \
             INSTALL_MOD_PATH="${INSTALL_DIR}" \
             HOSTCC=gcc-11 \
             CC=gcc-11"

## Set build options (for Clang,LLVM-14)
# export MAKE_OPTS="-j`nproc` \
#             INSTALL_PATH="${INSTALL_DIR}/boot" \
#             INSTALL_MOD_PATH="${INSTALL_DIR}" \
#             CC=clang-14 LD=ld.lld-14 AR=llvm-ar-14 NM=llvm-nm-14 STRIP=llvm-strip-14 \
#             OBJCOPY=llvm-objcopy-14 OBJDUMP=llvm-objdump-14 OBJSIZE=llvm-size-14 \
#             READELF=llvm-readelf-14 HOSTCC=clang-14 HOSTCXX=clang++-14 HOSTAR=llvm-ar-14 \
#             HOSTLD=ld.lld-14"


# Set build options (for Clang,LLVM-18)
# export MAKE_OPTS="-j`nproc --ignore=1` \
#             INSTALL_PATH="${INSTALL_DIR}/boot" \
#             INSTALL_MOD_PATH="${INSTALL_DIR}" \
#             LLVM=1"

mkdir -p "${INSTALL_DIR}/boot"

## Disable/Enable Link Time Optimization:

scripts/config --disable CONFIG_LTO_CLANG_FULL
#scripts/config --enable CONFIG_LTO_CLANG_THIN
scripts/config --enable CONFIG_LTO_NONE
# Full LTO is enabled by default on the configs in this repo,
# except for the 5.4 kernels, which don't have this option.

# Explicitly disable it here
# Selecting GCC as the compiler automatically deselects LTO as well

# Warning ::: you might want to reduce the thread/processor count, j, with fullLTO builds
# Ensure you have proper RAM and swapspace, otherwise you will likely run Out of Memory (OOM).
# 32 GB of memory is recommended for fulLTO builds. thinLTO should be much easier however.

## Compilation:
make ${MAKE_OPTS} olddefconfig
make ${MAKE_OPTS} prepare
echo "making kernel. . ."
make ${MAKE_OPTS}
echo "making modules . . ."
make ${MAKE_OPTS} modules
echo "installing kernel . . ."
make ${MAKE_OPTS} install # This step is unnecessary
echo "installing modules . . ."
make ${MAKE_OPTS} modules_install

echo "Copying bzImage to $INSTALL_DIR/boot. . ."
cp arch/x86/boot/bzImage "$INSTALL_DIR/boot/"
echo "Copying used .config to $INSTALL_DIR/.config. . ."
cp .config "$INSTALL_DIR/.config"
cd "${INSTALL_DIR}"

The bzImage should now be in boot/, and any modules compiled in lib/ .



Releases and Downloads

To get some pre-compiled kernels, go to the releases section, and choose a kernel (bzImage) based on your needed version.

Please read the boldened out and highlighted text, as they contain some information that might be useful for a particular release. It's very wordy, that needs to be fixed!!



Contributing

If something doesn't work on these kernels, has missing features, or your model still has unsupported WiFi, you can open a GitHub issue to share its details.

Pull requests/code contributions are always welcome.



Documentation, Guides and the PS4 Linux Future (As of December 2025)

While many of the bugs and issues prevalent in PS4 Linux kernels, and PS4 Linux in general have been fixed over the years, many of them still exist, and are seldom worked on.
A few honorable mentions aimed at improving this scene go to:

  1. Blackscreen/No Display/Unsupported Monitor issue:

  2. Mainling the PS4-specific patches and packages (OS-specific):
    See,

  3. General discussion/help:

  4. Random and other links regarding PS4-Linux that were, are, or could be useful:

For an instructional manual on installation and other topics, refer to this all-around guide.


Enjoy your Linux-Station!



Generic Linux Kernel Documentation

There are several guides for kernel developers and users. These guides can be rendered in a number of formats, like HTML and PDF. Please read Documentation/admin-guide/README.rst first.

In order to build the documentation, use make htmldocs or make pdfdocs. The formatted documentation can also be read online at:

https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory, several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the requirements for building and running the kernel, and information about the problems which may result by upgrading your kernel.

About

Linux Kernel on the PS4 Gaming Console - Forked from codedwrench (https://github.com/codedwrench/ps4-linux), and includes additional patches for better peripheral support (WIFI/BT,HDMI) on CUH-12xx and other models

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

No contributors

Languages

  • C 98.3%
  • Assembly 0.7%
  • Shell 0.4%
  • Python 0.2%
  • Makefile 0.2%
  • Perl 0.1%
  • Other 0.1%