How to compile PS4 Linux Kernel from source? | Detailed Tutorial

A detailed article on compiling Linux kernels for PS4 from source. This includes everything from downloading PS4 Linux kernel source to updating kernel on the Linux USB.

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!


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

  1. Open a terminal.
  2. On Fedora and Fedora-based distros, type sudo dnf install gcc git flex make bison openssl-devel elfutils-libelf-devel and press Enter.
  3. 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.
  4. 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.

  1. Go to the Github page of the kernel source.
  2. On the top right, click on Code and under Clone, making sure HTTPS is selected, copy the address, for example,
  3. Make a folder to contain the kernel in a suitable location on your system, say, a folder named kernel.
  4. Open a terminal within that folder.
  5. Type git clone and press Enter.
  6. 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

  1. 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.
  2. 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.
  3. 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 type make -j9 as PS4 has an octa core (8 cores) APU.
  4. 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.


  1. 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

  2. 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.

  3. 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.

  4. @Noob404 hello could you tell me which command to install the essential components for manjaro? in the tutorial there is only fedora and ubuntu..

  5. 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

    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:
    5.3.18 gentoo belize kernel
    Fedora 35

  6. 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?

  7. scripts/kconfig/conf –syncconfig Kconfig
    * Restart config…
    * General setup
    Compile also drivers which will not load (COMPILE_TEST) [N/y/?] (NEW)

  8. 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

  9. 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.

Leave a Reply

Your email address will not be published.