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 16, 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 (i.e. /home/username):

    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. It will tell you to "make oldconfig", but don't do that yet:

    ./setup-ps2

  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. This step is tricky, too. You now need to add support for the devpts filesystem in the kernel. Execute this command:

    perl -i.bak2 -pe "s/#\ CONFIG_DEVPTS_FS\ is\ not\ set/CONFIG_DEVPTS_FS=y/" .config

    This will change the CONFIG_DEVPTS compiler flag from undefined to a "y", and archive the original .config file as .config.bak2

  9. Yet another tricky step. It's really good to setup UNIX 98 PTYs support. Execute this command:

    perl -i.bak3 -pe "s/#\ CONFIG_UNIX98_PTYS\ is\ not\ set/CONFIG_UNIX98_PTYS=y/" .config

    This will change the CONFIG_UNIX98_PTYS compiler flag from undefined to a "y", and archive the original .config file as .config.bak3

  10. Now, go ahead and make the oldconfig. There will be a question about "Maximum number of Unix98 PTYs in use." Take the default by typing the Enter key:

    make oldconfig
    (Much stuff scrolls by)
    Maximum number of Unix98 PTYs in use (0-2048) (CONFIG_UNIX98_PTY_COUNT) [256] (NEW) [Enter Key]
    (Much more stuff scrolls by)

  11. Build the dependencies:

    make dep

  12. Build the kernel:

    make

  13. Build the modules:

    make modules

  14. Switch to SU and install the modules:

    su
    make modules_install

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

  16. 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+rw kernel-modules-2.4.17.tar.gz

  17. Transfer the kernel-modules-2.4.17.tar.gz file, and the System.map and vmlinux files which are located in your /home/username/usr/src/linux directory to your PlayStation 2. For the purposes of this Mini-HOWTO, I'll assume the files are copied to the PlayStation 2's /root directory

  18. Log out of your cross-compiling machine.

  19. Log into your PlayStation 2 as root

  20. Mount your memory card:

    mount /mnt/mc00

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

    cp /root/vmlinux /mnt/mc00/vmlinu2

  22. 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
    

  23. Copy the vmlinux and System.map files to your PlayStation 2 /boot directory. HOWEVER - You must give them a new name that matches the operating system release (uname -r):

    cp /root/vmlinux /boot/vmlinux-2.4.17_mvl21
    cp /root/System.map /boot/System.map-2.4.17_mvl21

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

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

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

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

  26. OPTIONAL: If you need XWindows support, then edit your /etc/X11/XGSConfig file:

    vi /etc/X11/XGSConfig

    Comment out this line with a "#":
        Device      "/dev/mouse"
    
    and add this underneath it:
        Device      "/dev/input/mice"
    
    so that it looks like this:
    #    Device      "/dev/mouse"
        Device      "/dev/input/mice"
    

  27. 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.


  28. Reboot and select Experimental from the PlayStation 2 Linux boot menu


RETURNING TO NORMAL 2.2.1 KERNEL:

  1. Log into your PlayStation 2 as root user.

  2. If you did Step 25 above, edit your /etc/X11/XGSConfig file to switch back to the older mouse device:

    vi /etc/X11/XGSConfig

    Uncomment out this line by deleting the "#":
    #    Device      "/dev/mouse"
    
    and comment out this line with a "#":
        Device      "/dev/input/mice"
    
    so that it looks like this:
        Device      "/dev/mouse"
    #    Device      "/dev/input/mice"
    

  3. You need to relink the /boot/System.map file to /boot/System.map-2.2.1_ps2:

    cd /boot
    rm System.map
    ln -s System.map-2.2.1_ps2 System.map

  4. Reboot your PlayStation 2, and select the normal boot from the PlayStation 2 Linux boot menu.


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 that got me started.