Skip to content

Installing an R5900 cross compiler with Gentoo

Immolo edited this page Sep 12, 2023 · 2 revisions

The R5900 is the main processor of the PlayStation 2 and this R5900 cross compiler guide is specific to Gentoo Linux.

A Gentoo Linux R5900 cross compiler can used to compile a Linux kernel, IOP modules, programs and libraries, in addition to building Gentoo Linux for the PlayStation 2 for a complete operating system.

Install the Gentoo Linux package sys-devel/crossdev and review the crossdev and cross build environment guides explaining how to configure for example a profile and an overlay. Once these steps have been taken, do

crossdev -s4 -t mipsr5900el-unknown-linux-gnu

to obtain a mipsr5900el-unknown-linux-gnu cross compiler.

Alternatively, by applying a patch a musl C standard library supporting the R5900 can be obtained with the target mipsr5900el-unknown-linux-musl. Place the patch in /etc/portage/patches/cross-mipsr5900el-unknown-linux-musl/musl/r5900-ll-sc.patch and then do

crossdev -s4 -t mipsr5900el-unknown-linux-musl

to obtain a mipsr5900el-unknown-linux-musl cross compiler. Programs compiled with Musl are typically much smaller than with GNU libc, and often also work better with static linking.

For reference, see the Docker crossdev installation script.