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!
Requirements
Linux Machine
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.
Build essentials
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-devel
and 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 bison
and press Enter. - On Arch and Arch-based distros, type
sudo pacman -S base-devel bc python
and 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.
- Type
git clone https://github.com/codedwrench/ps4-linux.git
and 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-linux
and 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 .config
and 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 -j5
and 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 typemake -j9
as 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.
Conclusion
I hope you liked this article. Do you want me to cover something else? You might be just a comment away.
Can you tried if mine works unfortunately i dont have aeolia or belize but this one should works for the ones with this devices. Mine is baikal, unfortunately i tried to compile a baikal one for me but i got black screen. This kernel includes the patches for aeolia and belize and compile without any issues. Can you tested please https://github.com/whitehax0r/kernel5.4.x
Even I have Baikal. Thus, I am unable to test. BTW, is this whitehax0r who released the recent Arch Linux distro?
Yes I’m.
Hi, man! Glad to meet you. I was talking to codedwrench and I am planning to test out his Baikal kernel. Let’s see how it goes.
Codedwrench baikal branch doesnt work for me either always i got black screen not sure what im doing wrong, the only one who works for me is the ps4boot branch baikal one 5.3.18.
https://easyupload.io/g4csqh This is compiled by my self. 5.15.15 for Baikal. ( Its a codedwrench kernel based )
PD: Pruebalo con tu propio bootargs.txt 😉
Translation: Try it with your own bootargs.txt
No funciona bro siempre tengo pantalla negra, pero muchas gracias 🙂
Translation: It doesn’t work bro I always have a black screen, but thank you very much
That’s a bug with Codedwrench’s kernel. Unfortunately, he doesn’t have a baikal to speedily debug and sort this out. But, he sent me two commits of the kernel that are known to drop into rescueshell with display. I tried compiling them but didn’t work for me. Can you try them? I have sent you the commit links on Twitter.
Whitehax0r Can you login (ssh) or did it just freeze? btw i tried your kernel for belize… black screen // ps4 frozen.
Noob404 Please, Can you pass me those commits ? thx
These are for Baikal. Commit 1 & Commit 2.
https://twitter.com/cmhacks
These commits are old than i have. Thx anyway 🙂
You mean commits newer than these do boot you into rescueshell?
Thanks cmhacks for your bzImage 🙂
compatibility with my ps4 Pro cuh-7116b Baikal 🙂
For the leds of the ps4, you lowered the light of the RGB colors to pronounce the white
the Fsync is missing, but congratulations to you
In ps4 pro we now exceed bzimage 5.3.18
A fixed purple LED would be nice, I’ll take a look
I have 7116b too and I get black screen. Which payload did you use?
Sleirsgoevy nazky psxita?
all links are down
Awesome maybe I could help with something, testing, I’m not an expert but I’ll do my best. I don’t have the knowledge that you have but I knows a little bit of everything, I have email emailed you with my twitter.
Well my friend, you think too much of me. I stay true to my name and I am still learning. I hope to learn from people like codedwrench and you too. Anyways, checked my email. I followed you on Twitter. Just DM me, because I think you have deactivated DM on your account.
@Noob404 hello could you tell me which command to install the essential components for manjaro? in the tutorial there is only fedora and ubuntu..
The steps for driver installation are quite different. Will make a tutorial later.
Thanks Noob404 for your tutorial ,)
Thank you for this tutorial.
I have a problem, I tried to compile codedwrench kernel using my ps4 linux, but I got this error after make -j9
” AR drivers/gpu/built-in.a
make: *** [Makefile:1868: drivers] Error 2″
any help is appreciated
p.s.
Although i did not try it, to overclock go inside kernel files before compiling /ps4-linux/arch/x86/include/asm/ps4.h
open the file with txt editor and change the clock speed value to any value you like then compile the kernel.
Again I did not try this. Use this way at your own risk.
My device information:
PS4pro
5.3.18 gentoo belize kernel
Fedora 35
Hi, thank you for what you do for the community. I have a CUH 2215B ps4 on 9.00FW, I have tried several biakal kernels with multiple different displays and only having success once. Other than that one time I have not been able to escape the black screen that comes after rescue shell. Is there a website that has most of the baikal kernels compiled by multiple people? I have seen people have different results depending on who compiled it. Also is there likely to be any future baikal kernel releases that would have better compatibility/less black screen issues?
Well, there is a lot of work going on in that field. If you are interested, join the Discord. Soon, we will be taking up kernel testing hopefully.
Awesome, thank you! I just joined.
i am trying to compile the baykal kernel .when i do make -j9 it asks me a lot of questions
You haven’t copied the proper config file.
scripts/kconfig/conf –syncconfig Kconfig
*
* Restart config…
*
*
* General setup
*
Compile also drivers which will not load (COMPILE_TEST) [N/y/?] (NEW)
Good Afternoon PS4-linux Developers/Programers and Users
Dave White on pop_os_22_04
Codewrench 5.15.15 kernel beta works very well on my PS4 slim CUH-2112B belize2 A0.
When I compile 5.15.15 kernel with Network options for Docker and Display-driver
kernel loads . I install docker, displaylink-driver works great no errors
* I lose access to bluray drive *. *Get warning/error messages while compiling kernel.*
Extracted config file from beta bzImage. Compile no changes to config no Blu-ray drive show in Disks app or on boot screen.
Tried make with lower and higher version of gcc-9 – gcc13.
I tried every ps4-linx-5.15.15 github developer site.
Is it possible to compile your own kernel? Without losing access to Optical Drive.
Make error msg (1 example of 5)
drivers/ps4/ps4-apcie.c: In function ‘apcie_config_msi’:
drivers/ps4/ps4-apcie.c:71:16: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘void *’ [-Wformat=]
71 | sc_dbg(“glue_write32 to offset, value (%08x, %08x, %08x)\n”, sc->bar4, APCIE_REG_MSI(0x8), 0xffffffff);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:110:30: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
./include/linux/dev_printk.h:150:58: note: in expansion of macro ‘dev_fmt’
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/ps4/aeolia.h:158:21: note: in expansion of macro ‘dev_info’
158 | #define sc_dbg(…) dev_info(&sc->pdev->dev, __VA_ARGS__)
| ^~~~~~~~
drivers/ps4/ps4-apcie.c:71:9: note: in expansion of macro ‘sc_dbg’
71 | sc_dbg(“glue_write32 to offset, value (%08x, %08x, %08x)\n”, sc->bar4, APCIE_REG_MSI(0x8), 0xffffffff);
| ^~~~~~
drivers/ps4/ps4-apcie.c:71:51: note: format string is defined here
71 | sc_dbg(“glue_write32 to offset, value (%08x, %08x, %08x)\n”, sc->bar4, APCIE_REG_MSI(0x8), 0xffffffff);
| ~~~^
| |
| unsigned int
| %08p
another error msg exsample
drivers/ps4/ps4-apcie.c:351:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘irq_hw_number_t’ {aka ‘long unsigned int’} [-Wformat=]
351 | dev_info(&dev->dev, “apcie_assign_irqs(%d) (%d)\n”, nvec, info.hwirq);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:110:30: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
./include/linux/dev_printk.h:150:58: note: in expansion of macro ‘dev_fmt’
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/ps4/ps4-apcie.c:351:9: note: in expansion of macro ‘dev_info’
351 | dev_info(&dev->dev, “apcie_assign_irqs(%d) (%d)\n”, nvec, info.hwirq);
| ^~~~~~~~
drivers/ps4/ps4-apcie.c:351:54: note: format string is defined here
351 | dev_info(&dev->dev, “apcie_assign_irqs(%d) (%d)\n”, nvec, info.hwirq);
| ~^
| |
| int
| %ld
This simply means the kernel source might require changes (sometimes significant) for what you’re trying to achieve here.
Thanks for your feedback. Noob404 like 👍 Pop os disros releases.
I don’t understand why I can compile kernel from source (codewrench github) with beta configuration file.
Extracted config file from beta bzImage. Compile no changes to config *no Blu-ray drive show in Disks app* or on boot screen. What’s best distro, linux setup is best for compiling kernel for PS4? I think system configured wrong for compiling.
Thanks For Your Time.
I usually use an Ubuntu-based distro for compilation.
Hello, when I payload nothing happens on my ps4 slim CUH-2216B with baikal b1 (Ox30201) I tried all the bzimage can anyone help me?