With codedwrench working on stabilising kernel 5.15 for PS4 Linux, we are seeing more activity in the kernel space. Infact, he has released kernel 5.15 for Aeolia and Belize. You can download them from our Kernel Downloads section. Anyways, we can expect more and more devs to pitch in with newer kernels soon, hopefully. So, I thought it would be the perfect time to teach you guys how to compile PS4 Linux kernel on your own.
See, many devs do release the pre-compiled bzImage which you can drop onto your USB drive and copy to your FAT32 partition to boot from it. But, say, the kernel is still under development in the Github repo, or, you want to overclock it? In that case, how do you manually compile PS4 Linux kernel and test it? That’s what we will be discussing in this article. So, let’s get started!
You could either dual boot a Linux distro or install it on a Virtual machine. Here are the instructions for installing Linux on a virtual machine. I recommend using Ubuntu (based), Fedora (based) or Arch (based) distros for this process, as I will be providing the steps for these distros.
Linux Kernel source
Most developers provide the source code for their kernels, mostly on Github. You may find them in our Downloads section.
Before we build kernel, we need to make sure that the distro has all the necessary software and dependencies to build a kernel from source. The steps are slightly different on Fedora and Ubuntu. We will cover them in this tutorial. So, don’t worry.
Compile PS4 Linux Kernel from source: Detailed Tutorial
Step 1. Setup build essentials
- Open a terminal.
- On Fedora and Fedora-based distros, type
sudo dnf install gcc git flex make bison openssl-devel elfutils-libelf-develand press Enter.
- On Ubuntu and Ubuntu-based distros, type
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bisonand press Enter.
- On Arch and Arch-based distros, type
sudo pacman -S base-devel bc pythonand press Enter.
This should nicely set you up for kernel compilation. Infact, we may have overdone.
Step 2. Download kernel from source
In this tutorial, I am going to show you how you could build codedwrench’s kernel for the PS4. But, the steps for the others are more or less the same.
- Go to the Github page of the kernel source.
- On the top right, click on Code and under Clone, making sure HTTPS is selected, copy the address, for example, https://github.com/codedwrench/ps4-linux.git.
- Make a folder to contain the kernel in a suitable location on your system, say, a folder named kernel.
- Open a terminal within that folder.
git clone https://github.com/codedwrench/ps4-linux.gitand press Enter.
- This will create a folder within the kernel folder, we created earlier and download the kernel source within that folder.
Step 3. Compile PS4 Linux kernel from downloaded source
- Change directory into the newly created folder within the kernel folder. In this case, it will be ps4-linux. So, you could type
cd ps4-linuxand press Enter.
- Make sure that this folder has a .config file. If not, you will have to find it. In this case, it is named as config. So, you will have to rename it by typing
cp config .configand pressing Enter. The config may also be variably found in other folders such as arch/x86/configs for example. Just copy it into the root folder of the kernel files and rename it as .config.
- Now, check how many cores your PC has. Assuming you are doing it on a quad core (4 cores) CPU, on the terminal we already had open, type
make -j5and press Enter. The general rule of thumb is in the command, j should be followed by the number cores plus 1. So, if you were to compile on a PS4 Linux distro, you would type
make -j9as PS4 has an octa core (8 cores) APU.
- Once the process is complete, you will find the compiled kernel (bzImage) in the folder – arch/x86/boot.
Now, all that’s left is to move the bzImage to the USB drive containing your PS4 Linux distro. I have already listed the detailed instructions to do just that.
I hope you liked this article. Do you want me to cover something else? You might be just a comment away.