Building Kernel Guide: Difference between revisions
Jump to navigation
Jump to search
m fix warning formatting |
standalone argument |
||
Line 25: | Line 25: | ||
# After you cloned the kernel that you want to build go back into <code>build-stack</code> and run <code>./build-kernel.sh [name of your kernel directory]</code>. | # After you cloned the kernel that you want to build go back into <code>build-stack</code> and run <code>./build-kernel.sh [name of your kernel directory]</code>. | ||
#* Example: <code>./build-kernel.sh wii-linux-ngx</code>. | #* Example: <code>./build-kernel.sh wii-linux-ngx</code>. | ||
#* The <code>--standalone</code> argument can be used to build a kernel that doesn't require a loader, <code>arch/powerpc/boot/dts/wii.dts</code> needs to be edited accordingly with the boot device that will be used. | |||
# After the kernel compiles, you have to build the loader (small squashfs that the kernel boots, provides the boot menu). In the build-stack run <code>./build-loader.sh ../v<kernel version short>.ldr</code>. | # After the kernel compiles, you have to build the loader (small squashfs that the kernel boots, provides the boot menu). In the build-stack run <code>./build-loader.sh ../v<kernel version short>.ldr</code>. | ||
#* Example: <code>./build-loader.sh ../v4_19325.ldr</code>. | #* Example: <code>./build-loader.sh ../v4_19325.ldr</code>. |
Latest revision as of 21:32, 19 May 2025
This Guide will teach you how to cross-compile the Wii-Linux kernel and supporting elements.
Requirements
[edit]- An x86 or AArch64 device running GNU/Linux
Setup and Compile
[edit]- Install Crosstool-NG via package manager or compile it by cloning
git clone https://github.com/crosstool-ng/crosstool-ng
. - Make a directory to have all the files/folders to be in
- In that directory clone the Wii-Linux-Toolchain
https://github.com/Wii-Linux/wii-linux-toolchain
. - cd into the wii-linux-toolchain folder and run
mv ct-ng.config .config
and runct-ng build
.- The process will take a while depending on how bad your computer is.
- Once it's installed, it should make a directory in your home folder called
x-tools
.- You can optionally move this directory elsewhere first, if you don't find
x-tools
appealing.
- You can optionally move this directory elsewhere first, if you don't find
- You must now add it to your PATH. This varies per shell, and based on where you put it, but as an example:
- for bash:
echo 'PATH="$PATH:~/<path to ct-ng output>/powerpc-unknown-linux-gnu/bin"' >> ~/.bashrc && source ~/.bashrc
.
- for bash:
- After you have added it to your path, go back to the main directory and run
git clone https://github.com/Wii-Linux/build-stack && cd build-stack
. - Once you're in the build-stack folder, run
./setup.sh
and follow it's instructions, to make sure that you have all the necessary requirements installed. If it asks to clone and build various requirements, answer Yes unless you have a very specific reason not to. - After setup.sh finishes successfully, go back to the main directory, and now finally run
https://github.com/Wii-Linux/wii-linux-ngx -b <Branch You want>
.- The branch you clone is the source code to the kernel branch you are going to compile (this could be specialized kernels (like for OpenWRT, or just various versions of the main one). The following kernel branches are the ones currently supported:
wii-v4.5
wii-v4.14-openwrt
wii-v4.19
- The branch you clone is the source code to the kernel branch you are going to compile (this could be specialized kernels (like for OpenWRT, or just various versions of the main one). The following kernel branches are the ones currently supported:
- After you cloned the kernel that you want to build go back into
build-stack
and run./build-kernel.sh [name of your kernel directory]
.- Example:
./build-kernel.sh wii-linux-ngx
. - The
--standalone
argument can be used to build a kernel that doesn't require a loader,arch/powerpc/boot/dts/wii.dts
needs to be edited accordingly with the boot device that will be used.
- Example:
- After the kernel compiles, you have to build the loader (small squashfs that the kernel boots, provides the boot menu). In the build-stack run
./build-loader.sh ../v<kernel version short>.ldr
.- Example:
./build-loader.sh ../v4_19325.ldr
.
- Example:
- After the loader is done, you need to go install it. This consists of 2 parts:
- Installing the kernel+loader. A script has been provided to make this easier,
build-stack/copy-ssh.sh
. This provides an easy way to copy the kernel+loader to a remote machine in any directory. This could even be a Wii-Linux install.- Example 1 (copy to local machine's SD Card on /mnt):
./copy-ssh.sh root@localhost /mnt v4_19325 4.19.325-wii+ kernel v4_19325.ldr
- Example 2 (copy to Wii with SD Card on /boot):
./copy-ssh.sh root@wii.local /boot v4_19325 4.19.325-wii+ kernel v4_19325.ldr
- Example 1 (copy to local machine's SD Card on /mnt):
- ''Installing the kernel modules. The kernel modules are output as
modules.tar.gz
in your kernel directory. You will need to safely extract these to your Wii-Linux distro's rootfs. WARNING: Extracting directly to the rootfs WILL HOSE YOUR PERMISSIONS - DO NOT DO THAT. It will set the UID/HID of the root directory, and /usr, and /usr/lib, to the UID/GID of the user who built the kernel. Instead, you can extract it to a temporary directory, thenmv
orcp -r
the modules (temp_dir/usr/lib/modules/[kernel version]-wii+
into your rootfs.
- Installing the kernel+loader. A script has been provided to make this easier,