Build PS3-optimized kernel for Debian GNU/Linux
I present the different required steps to get an up-and-running kernel for Debian GNU/Linux running on the Playstation 3.
This method requires a fully working Debian GNU/Linux system on a powerpc platform, which means it does not cover cross-compilation issues. It has been tested on the PS3 itself.
Note: This method was working at the time it was written. The method should always be correct, even though file names may change with different version updates. I will try to keep this page as up-to-date as possible, but things may not work from one time to another. In this case, you will have to find out about the file names by yourself. In the rest of this article I will always use the most recent file names at the date of latest update.
Prepare the system
Your system must be prepared for Debian kernel compilation. You will also have to extract files from an ISO image. To get all the required tools, simply issue the command (as root):
apt-get install kernel-package device-tree-compiler build-essential libncurses5-dev fakeroot git-core
Get the kernel sources
You can either download the most recent official kernel sources from kernel.org, or fetch the official Sony sources from Geoff Levand's git repository. The latter version of the sources are likely to contain much more up-to-date specific patches for the PS3. In addition, fetching the sources from kernel.org is a straightforward process, thus this section only describes how to build the sources from the Sony sources.
First fetch of the sources
From one of your local user's home subdirectories, issue the command:
git clone http://www.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git
which will create a ps3-linux directory, and fetch a copy of the git repository in it.
Beware the latest revision of the sources you just downloaded are likely to be a working version of the sources, meaning it might contain bugs. You can switch to another git commit using the git checkout command. For instance, for fetching the (supposedly) stable release of the version 2.6.32, issue the command (from the ps3-linux directory):
git checkout v2.6.32
Remember you can list all the possible tag names for use with git checkout using the git tag command. Whenever you want to go back to the latest revision of the sources, use the master specific tag.
Subsequent fetches
If you alrady have a clone of the git repository, you can update it, first by cleaning the changes you made, with the command:
git checkout -f
Then, fetch and apply the latest upstream changes:
git pull
You can now get the new tag list, with the git tag command, and switch to any of them, using the git checkout command.
Kernel setup
The default ps3 configuration generally fits most needs for linux users on the ps3 (casual users as well as developers). You can generate the default configuration file by issuing the command from the ps3-linux directory:
make ps3_defconfig
After having setup the default ps3 configuration, you can eventually check and modifiy the configuration using the command:
make menuconfig
Kernel packages generation
Once the setup is done, you can generate the kernel image, headers and source packages using the commands:
echo \#\!/bin/sh > ./scripts/setlocalversion
make-kpkg --initrd --rootcmd=fakeroot --append-to-version=-ps3 --revision=20090728 kernel_image kernel_headers kernel_source
At every build, better use a different argument for the --revision argument. I generally use the current date as revision number.
If everything goes right, the package files will be found in the parent of the ps3-linux directory.
Packages installation and bootloader setup
In a Debian system, simply install the packages with the command:
dpkg -i linux-*-2.6.30*_20090728*.deb
Obviously, change the version and revision numbers to the correct ones.
This will install the kernel, and setup the bootloader with current kernel as the new one, and the "old" kernel as the previoulsy installed one.