Kernel/Building kernel

From linux-wiiu Wiki
Jump to navigation Jump to search
Building a kernel image
Last update 05.04.2021
Required OS Linux

WSL works too

Dependencies git









File types
Input kernel source
Output kernel dtbImage
Kernel source Linux 4.19

This page walks you through building a linux-wiiu kernel image from the source.


This page assumes you have the following:

  • A GNU/Linux environment
  • An internet connection
  • Sudo access


  • Basic knowledge of how to use GNU/Linux

The process

Installing necessary dependencies

This section assumes your package manager is apt. If you use a different package manager, some packages may be different and you should modify the commands accordingly.

First we'll install the dependencies by opening a terminal (Ctrl-Alt-T) and running the following command:

sudo apt install git gcc-10-powerpc-linux-gnu gcc-powerpc-linux-gnu make gcc flex binutils bison libssl-dev

Hopefully it finds all the packages and you can move on to the next step.

Downloading kernel source

You could manually download the kernel source but we'll do it using git. We'll download the 4.19-rewrite branch like this:

git clone --depth 1 -b rewrite-4.19

And change to the downloaded source using:

cd linux-wiiu

After that completes, you can move on to the next step. This is also the time to apply any patches you may want or need to to the kernel source, make sure to change back to here afterwards.

Building the kernel

In the next section, the -j2 sets the amount of cores the compiler will use. Set this according to your CPU core count. (for example, -j8 for 8 cores)

First we'll generate the config files by running

make wiiu_slim_defconfig ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- CROSS32_COMPILE=powerpc-linux-gnu- -j2

Using the slim defconfig creates a module-based kernel with a few more drivers and such that won't fit in a standalone binary, but requires you to be able to install the modules to your linux filesystem (Windows users may struggle with this, as Windows can't read ext4 drives). If you'd like an all-in-one kernel image without modules, use wiiu_defconfig in place of wiiu_slim_defconfig.

Afterwards we'll start the kernel compilation, this may take a while:

make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- CROSS32_COMPILE=powerpc-linux-gnu- -j2

Now, if everything went well, the kernel dtbImage.wiiu will be in arch/powerpc/boot/dtbImage.wiiu . For modular kernels using wiiu_slim_defconfig, get the modules out by doing something like the following:

mkdir modules
make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- CROSS32_COMPILE=powerpc-linux-gnu- INSTALL_MOD_PATH=modules modules_install -j2

The modules folder should now have modules ready to copy into your rootfs' /lib/modules folder.

All done!