Kernel 2.4.17 for PlayStation 2 Mini-HOWTO 1.0

by Paul A. Pietromonaco ppietro@users.playstation2-linux.com

Created: February 5, 2004

Last edited: February 5, 2004


OVERVIEW:

In 2002, Sony began a "Broadband Navigator" service for the PlayStation 2. Part of this service included an open source Linux kernel from Monta Vista Linux.

Sony posted the source here:
http://www.sony.net/Products/Linux/Download/PlayStation_BB_Navigator.html

This Mini-HOWTO will show how to build, install and run this kernel on a PlayStation 2 Linux kit.


DIRE WARNINGS!!!:

This is advanced kernel hacking. You can render your PlayStation 2 unusable if you're not careful. The author of this document will assume no responsibility for any damage or loss of data you incur. Nor will any help be provided. This document is "AS-IS" - take it or leave it. If you don't feel comfortable hacking your kernel on your PlayStation 2, then don't do this!!!

YOU'VE BEEN WARNED!!


BEFORE YOU BEGIN:

This mini-HOWTO requires a cross-compiler. It should be set-up according to my Cross Compiling Mozilla guide. You need to have a reliable method for transferring files between your PlayStation 2 and your cross-compiling machine. Also - this has only been tested with PlayStation 2 Linux 1.0 as shipped from Sony. I haven't tested this with BlackRhino Linux.


INSTRUCTIONS:

  1. Log into your cross-compiling machine with a non-root user account.

  2. Download these two files into your home directory:

    kernel-headers-2.4.17_ps2-26.mipsel.rpm
    kernel-source-2.4.17_ps2-26.mipsel.rpm

  3. Execute the following commands to set up the build tree. Note that this will create a "usr" directory in your home directory:

    cd
    rpm2cpio kernel-headers-2.4.17_ps2-26.mipsel.rpm | cpio -ivd
    rpm2cpio kernel-source-2.4.17_ps2-26.mipsel.rpm | cpio -ivd
    cd usr/src
    ln -s linux-2.4.17_ps2 linux

  4. Don't forget to add the cross-compiling gcc directory to your PATH:

    export PATH=$PATH:/usr/mipsEEel-linux/bin

  5. Move to the build directory:

    cd
    cd usr/src/linux

  6. Execute the setup-ps2 script and follow the instructions:

    ./setup-ps2
    make oldconfig

  7. This step is tricky. You need to compile support fot the ext2 filesystem in the kernel. But - as shipped, the setup-ps2 script sets ext2 support as a module. Execute this command:

    perl -i.bak -pe "s/CONFIG_EXT2_FS=m/CONFIG_EXT2_FS=y/" .config

    This will change the CONFIG_EXT2_FS compiler flag from an "m" to a "y", and archive the original .config file as .config.bak

  8. Build the dependencies:

    make dep

  9. Build the kernel:

    make

  10. Build the modules:

    make modules

  11. Switch to SU and install the modules:

    su
    make modules_install

  12. NOTE: This will create a directory called /lib/modules/2.4.17_mvl21 . This directory will not run on your cross-compiling machine!!

  13. Remaining as SuperUser, tar/gzip up the modules directory for transfer to your PlayStation 2:

    cd /lib/modules
    tar cvf kernel-modules-2.4.17.tar 2.4.17_mvl21
    gzip kernel-modules-2.4.17.tar
    chmod a+rwx kernel-modules-2.4.17.tar.gz

  14. Transfer the kernel-modules-2.4.17.tar.gz file and the vmlinux file which is located in your "home directory"/usr/src/linux directory to your PlayStation 2

  15. Log out of your cross-compiling machine.

  16. Log into your PlayStation 2 as root

  17. Mount your memory card:

    mount /mnt/mc00

  18. Copy the vmlinux file to the memory card with a new name:

    cp vmlinux /mnt/mc00/vmlinu2

  19. Add an entry for the new kernel to your p2lboot.cnf file:

    vi /mnt/mc00/p2lboot.cnf

    and add this line. /dev/hda1 should be the location of your root directory.
    "Experimental"  vmlinu2 ""      203 /dev/hda1 ""        PS2 Linux Kernel 2.4.17
    

  20. Untar/gzip the modules in the /lib/modules directory:

    cd /lib/modules
    gzip -dc kernel-modules-2.4.17.tar.gz | tar -xvf -


  21. Create a new device for the 2.4.17 kernel mouse:

    mkdir /dev/input
    mknod /dev/input/mice c 13 63

At this point, if you only use text mode on the PlayStation 2, you're done. You can reboot the PlayStation 2 and select your new kernel. If you need XWindows support, then complete the next step before rebooting.

  1. Edit your /etc/X11/XGSConfig file:

    vi /etc/X11/XGSConfig

    Comment out this line:
        Device      "/dev/mouse"
    
    so that it looks like this:
    #    Device      "/dev/mouse"
    
    and add this underneath it:
        Device      "/dev/input/mice"
    
    When you run the original kernel (2.2.1), you will need to comment out the /dev/input/mice line, and uncomment the /dev/mouse line.

  2. OPTIONAL: If you haven't already done so, now is a good time to add wheel support. You can use my Mouse Wheel Mini-HOWTO for reference.



THANKS:

Some of this information was gathered from discussions on the PlayStation 2 Linux Community Linux for PlayStation 2 Community Kernel Discussion Forums. Also, the Linux 2.4.17 BB Kernel on PS2 Linux Kit page had some ideas.