-
Notifications
You must be signed in to change notification settings - Fork 6
Installing a PlayStation 2 Linux initramfs root filesystem
The initramfs is an initial root filesystem to be compiled into the PlayStation 2 Linux kernel.
There are two alternative guides to installing an initramfs root filesystem:
- downloading a precompiled initramfs archive from the actions menu, for either PAL or NTSC systems, or
- installing an initramfs with Gentoo.
Next, proceed by building a PlayStation 2 Linux kernel.
-----%<-----
THE FOLLOWING WILL SOON BE DISCARDED FROM THIS ARTICLE -----%<-----
Make sure that you have
- an R5900 Busybox, or proceed by installing an R5900 Busybox;
- the input/output processor (IOP) modules as IRX files to be installed as firmware in the root filesystem, or proceed by installing PlayStation 2 IOP modules.
Contents
In case you were building the busybox following the building an R5900 Busybox from sources guide, move the folder _install
to the folder level near the kernel source folder; next, rename the folder _install
into initramfs/ps2
;
In case you were building the busybox following the building an R5900 Busybox using Gentoo Linux guide, copy the R5900 Busybox executable file into bin/
. If Busybox is dynamically linked, copy related libraries into lib/
.
In case you were building the busybox following the building an R5900 Busybox using Gentoo Linux guide, create the folder structure initramfs/ps2
so that it is reachable from the Linux kernel source directory using ../initramfs/ps2
. This is the root directory of the initial root filesystem. Now do cd initramfs/ps2
and then
mkdir bin dev etc lib mnt proc root sbin sys tmp usr usr/bin usr/sbin var
In case you were building the busybox following the building an R5900 Busybox from sources guide, you already have the properly named initramfs/ps2
. But you should check for the absent folders noted in Gentoo Linux'es busybox case above. So just create the absent one's folders.
Pay attention to the file and directory ownerships, the UID and GID. In the kernel configuation file .config
, set
CONFIG_INITRAMFS_ROOT_UID=1000
CONFIG_INITRAMFS_ROOT_GID=1000
if UID and GID are 1000, for instance. Review the Linux kernel documentation for CONFIG_INITRAMFS_ROOT_UID
and CONFIG_INITRAMFS_ROOT_GID
for details.
Create an init
text file with
#!/bin/busybox sh
/bin/busybox --install -s
/bin/mount -t devtmpfs devtmpfs /dev
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
exec /sbin/init $*
Then do chmod a+x init
.
Create an sbin/init
text file with
#!/bin/sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH
mount -t sysfs none /sys
mount -t tmpfs none /var
mount -t tmpfs none /tmp
mount -t proc none /proc
mkdir /dev/pts
mount -t devpts none /dev/pts
mount -t debugfs none /sys/kernel/debug
depmod
modprobe ps2fb mode_option=1920x1080p@60
modprobe sif
modprobe iop-memory
modprobe iop-module
modprobe iop-irq
modprobe sd_mod
modprobe ohci-ps2
modprobe ums-usbat
modprobe usbhid
modprobe hid-generic
uname -a
sh
while :
do
sleep 1
done
Then do chmod a+x sbin/init
. The mode_option
parameter to ps2fb
can be adjusted, or removed, as necessary. The depmod
command is most likely required to make kernel module dependencies compatible with the Busybox variant of modprobe
, as it seems incompatible with the counterparts in kmod that is used with make modules_install
. Most modprobe
commands can be omitted, if kernel module dependencies are working properly.
Go into initramfs/ps2
folder. Assume that all 3 folders are on the same level: initramfs
, iopmod
, linux
.
Do mkdir -p lib/firmware/ps2
and copy the IRX files to this directory, for example using
cp ../../iopmod/module/*.irx lib/firmware/ps2/
As the initramfs is to be compiled into our kernel AND initramfs requires the kernel modules installed, first, we must build the kernel before we finalize the initramfs that we'll embed - so proceed with Building a PlayStation 2 Linux kernel. Once the kernel is built initially, return here and install the kernel modules using
make ARCH=mips CROSS_COMPILE=mipsr5900el-unknown-linux-gnu- INSTALL_MOD_PATH=../initramfs/ps2 INSTALL_MOD_STRIP=1 modules_install
To enlight the resulting kernel which includes the initramfs, you may remove the unneeded for the launch modules from the initramfs/lib/modules/
directory
The INITRAMFS is to be installed when building a PlayStation 2 Linux kernel.