Skip to content

PlayStation 2 read only memory (ROM)

frno7 edited this page Apr 22, 2022 · 15 revisions

The PlayStation 2 has two read-only memory devices, ROM0 and ROM1, with some exceptions. Their most relevant service for the Linux kernel is supplying firmware to input/output processor (IOP) modules, used by most drivers for peripheral devices such as USB devices, controllers, and so on. Most ROM files are IRX objects based on the executable and linkable format (ELF). The Linux kernel automatically prelinks IRX objects found in ROM, as necessary, when loading IOP modules for device drivers.

ROM files are accessible via the rom-sysfs.ko sysfs kernel module. It gives information on ROM file names, sizes, and addresses. List of all ROM0 file names:

# cat /sys/rom/rom0/file/*/name | column
RESET       VBLANK      RMRESET     MCSERV      XSIFCMD
ROMDIR      IOMAN       OSDVER      PADMAN      XCDVDMAN
EXTINFO     MODLOAD     -           CDVDMAN     XCDVDFSV
ROMVER      ROMDRV      IOPBOOT     CDVDFSV     XFILEIO
SBIN        ADDDRV      OSDCNF      FILEIO      XSIO2MAN
LOGO        STDIO       -           CLEARSPU    XMTAPMAN
IOPBTCONF   SIFMAN      TBIN        UDNL        XMCMAN
...

A directory of ROM files usually has several files named -. Their purpose is to align the subsequent file with a page boundary of 4096 bytes.

Viewing for example the contents of the ROM file ROMVER using /dev/mem:

# grep -l ROMVER /sys/rom/rom0/file/*/name
/sys/rom/rom0/file/3/name
# cd /sys/rom/rom0/file/3
# dd if=/dev/mem bs=$(cat size) iflag=skip_bytes \
        skip=$(( $(cat data) )) count=1 status=none
0170EC20030227

For convenience, the ROMVER file is also available directly in sysfs:

# ls /sys/rom/rom0/version
date    number  region  type
# cat /sys/rom/rom0/version/*
2003-02-27
0x0170
Europe
CEX

CEX indicates that this is a retail machine, as opposed to for example DEX that would be a debug machine.

Simple shell scripts can be made. The sum of the sizes of all ROM0 files in for example a particular SCPH-50004 PlayStation 2 model is easily computed with a small Awk script:

# cat /sys/rom/rom0/file/*/size | awk '{ s += $1 } END { print s }'
3900175

Issues

See #12 and #72.