Building Kernel Guide: Difference between revisions
Jump to navigation
Jump to search
Selimgozel1 (talk | contribs) A semi-simple guide to help compile wii-linux kernel's |
Try to clean up this absolute mess |
||
Line 1: | Line 1: | ||
This Guide will teach you how to compile the Wii-Linux kernel | This Guide will teach you how to cross-compile the [[Wii-Linux]] kernel and supporting elements. | ||
== Requirements == | == Requirements == | ||
* | * An x86 or AArch64 device running GNU/Linux | ||
Line 9: | Line 9: | ||
# Install Crosstool-NG via package manager or compile it by cloning <code>git clone https://github.com/crosstool-ng/crosstool-ng</code>. | # Install Crosstool-NG via package manager or compile it by cloning <code>git clone https://github.com/crosstool-ng/crosstool-ng</code>. | ||
# Make a directory to have all the files/folders to be in | # Make a directory to have all the files/folders to be in | ||
# In that directory clone the Wii-Linux-Toolchain <code>https://github.com/Wii-Linux/wii-linux-toolchain | # In that directory clone the Wii-Linux-Toolchain <code>https://github.com/Wii-Linux/wii-linux-toolchain</code>. | ||
# cd into the wii-linux-toolchain folder and run <code>mv ct-ng.config .config</code> and run <code>ct-ng build</code>. | # cd into the wii-linux-toolchain folder and run <code>mv ct-ng.config .config</code> and run <code>ct-ng build</code>. | ||
#* The process will take a while depending on how | #* 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 | # Once it's installed, it should make a directory in your home folder called <code>x-tools</code>. | ||
# After you | #* You can optionally move this directory elsewhere first, if you don't find <code>x-tools</code> appealing. | ||
# Once | # You must now add it to your PATH. This varies per shell, and based on where you put it, but as an example: | ||
# After setup.sh finishes successfully go back to the main directory and now finally run <code>https://github.com/Wii-Linux/wii-linux-ngx | #* for bash: <code>echo 'PATH="$PATH:~/<path to ct-ng output>/powerpc-unknown-linux-gnu/bin"' >> ~/.bashrc && source ~/.bashrc</code>. | ||
#* The branch you clone is the kernel you are going to compile, the following kernel | # After you have added it to your path, go back to the main directory and run <code>git clone https://github.com/Wii-Linux/build-stack && cd build-stack</code>. | ||
#** wii-v4.5 | # Once you're in the build-stack folder, run <code>./setup.sh</code> 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. | ||
#** wii-v4. | # After setup.sh finishes successfully, go back to the main directory, and now finally run <code>https://github.com/Wii-Linux/wii-linux-ngx -b <Branch You want></code>. | ||
#* 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: | |||
#** <code>wii-v4.5</code> | |||
#** wii-v4.19 | #** <code>wii-v4.14-openwrt</code> | ||
# After you cloned the kernel you want to build go back into build-stack and run <code>./build-kernel.sh [name of your kernel directory | #** <code>wii-v4.19</code> | ||
#* Example: <code>./build-kernel.sh wii-linux-ngx | # 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 the | #* Example: <code>./build-kernel.sh wii-linux-ngx</code>. | ||
#* Example: <code>./build-loader.sh ../ | # 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 loader is done go to | #* Example: <code>./build-loader.sh ../v4_19325.ldr</code>. | ||
#* Example: <code> | # 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, <code>build-stack/copy-ssh.sh</code>. 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): <code>./copy-ssh.sh root@localhost /mnt v4_19325 4.19.325-wii+ kernel v4_19325.ldr</code> | |||
#** Example 2 (copy to Wii with SD Card on /boot): <code>./copy-ssh.sh root@wii.local /boot v4_19325 4.19.325-wii+ kernel v4_19325.ldr</code> | |||
#* ''''Installing the kernel modules''. The kernel modules are output as <code>modules.tar.gz</code> 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, then <code>mv</code> or <code>cp -r</code> the modules (<code>temp_dir/usr/lib/modules/[kernel version]-wii+</code> into your rootfs. |
Revision as of 19:33, 18 May 2025
This Guide will teach you how to cross-compile the Wii-Linux kernel and supporting elements.
Requirements
- An x86 or AArch64 device running GNU/Linux
Setup and Compile
- 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
.
- 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,