Building a PlayStation 2 Linux kernel - frno7/linux GitHub Wiki
Make sure that you have
- an R5900 cross-compiler, or begin by installing an R5900 cross-compiler;
- a suitable initramfs, or begin by installing an initramfs root filesystem;
- a suitable Linux kernel configuration, for example
arch/mips/configs/ps2_defconfig.
Go to the Linux kernel source directory with cd linux. In the following, initramfs is assumed to be installed in ../initramfs relative to the linux directory.
To simplify the make commands used to compile the kernel, define the following environment variables, with Bash syntax:
export ARCH=mips
export CROSS_COMPILE=mipsr5900el-unknown-linux-gnu-
export INSTALL_MOD_PATH=../initramfs
export INSTALL_MOD_STRIP=1
The alternative is to supply these variables as arguments to make, rather than defining them as environment variables.
Verify that the CONFIG_INITRAMFS_SOURCE kernel configuration matches INSTALL_MOD_PATH, with grep CONFIG_INITRAMFS_SOURCE .config printing
CONFIG_INITRAMFS_SOURCE="../initramfs".
Assuming arch/mips/configs/ps2_defconfig is used as a kernel configuration, do the following commands to build the kernel and obtain its vmlinuz file:
make ps2_defconfig
make olddefconfig
make vmlinux
make modules
make modules_install
rm ../initramfs/lib/modules/*/{build,modules.*,source}
make vmlinuz
The Linux kernel vmlinuz file made with make vmlinuz should be about 4 MB, or less, depending on its configuration, and the size of the initramfs linked within the file.
Next, proceed by installing and booting PlayStation 2 Linux.
[!TIP] The
-joption, for example-j $(getconf _NPROCESSORS_ONLN), can be used to havemakebuild the kernel faster by using all available processors.
[!NOTE] The
make modules_installcommand installed kernel modules in the../initramfs/lib/modulesdirectory. The dependency files that were installed with the kernel modules can be removed to reduce the size of the initramfs, because Busybox will either ignore them or replace them with its own files, typically with itsdepmodcommand in../initramfs/sbin/init. Therefore, the dependencies and other unnecessary files are removed withrm.
[!TIP] Kernel hangs at boot: If your kernel hangs while booting then checking you have installed modules correctly to the initramfs by making sure
initramfs/lib/modules/*/kernelis populated. If itโs not then you need to check yourINSTALL_MOD_PATHvariable and then rerunmake modules_install && make vmlinuz
[!TIP] Text too small: By default the font size is set at
8x8which can be a problem to read with poor capture card, to remedy this runmake menuconfigand change the font size to8x16in the library routines section.