PSL1GHT v2 PS3 SDK on Ubuntu VM

INTRODUCTION

If you are interested in PS3 development, whether that’s coding your own homebrew, or simply compiling preexisting source code from other projects, you need to set up your own PS3 developing environment. This tutorial is a step-by-step, zero assumptions guide on how to get started in this potentially harrowing undertaking.

At the most basic level, creating PS3 apps consists of installing C++ compiler tools and a PS3 software development kit (SDK). All of these tools are oriented towards a Linux environment, so if you’re on a Windows machine then the only practical options are to dual-boot to a true Linux install, run Cygwin (which is a Linux like environment for Windows), or run Linux inside a virtual machine.

Cygwin can be a nightmare to configure, and dual-booting requires hard drive partitioning, but a virtual machine will give you a more-or-less native Linux without undue hardware preparation, so that’s what we will be choosing.

 

VIRTUAL MACHINE INSTALLATION

First thing we need to get is VMware Player. This is a freely available program to run our virtual machine. Go to VMware’s download page and download the most current VMware Player.

Next thing we need is an Ubuntu VMware image. Since a lot of PSL1GHT tutorials are oriented towards Ubuntu 10.10 and it’s known to work, we’ll be grabbing an archived version from Sourceforge. Yes, 10.10 is obsolete, but it also has a light footprint and runs well for our needs.

Note: You can opt to create a new blank VMware image and do a normal install from an Ubuntu 10.10 ISO if you don’t care to use, find, or download a Ubuntu specific VMware image — whatever is easiest.

Install VMware Player, extract the Ubuntu image, and then boot the Ubuntu VM with VMware Player.

You’ll likely see an “SMbus not found” error during boot. This is just a side-effect of the VM process and nothing to be concerned about. We’ll be fixing it later, but you can ignore it for now.

You’ll have to go through the installation process, but the only thing you need to really watch out for is that you cannot use spaces or capital letters in your Ubuntu username. Everything else is self-explanatory or the default settings.

You’ll be prompted to update the VMware Tools. Update them if you’re feeling savvy, or ignore it.

 

UBUNTU CONFIGURATION

Once we’ve finished setup and booted into Ubuntu, we need to install our compiler software and its related tools and dependencies. But here’s the problem:

10.10 is out-of-date and has reached its End of Life. That means all the update servers have been removed and you won’t be able to install any software packages or updates. Don’t worry, because the updates have been archived and we’ll simply tell Ubuntu where to find those archive servers so we can party like it’s 2011 again.

Go to the Applications menu, and open the Text Editor app (under Accessories). Open the file /etc/apt/sources.list (in File System). You’ll see all sorts of entries that involve links to servers. Those servers are no longer there, so we need to change all those entries to old-releases.ubuntu.com instead. We’ll use Terminal to do this, but I wanted you to see what we are changing, and why.

Close the file and Text Editor, and then run Terminal (in Applications/Accessories menu). Now we’re going to use an automated search to look for the outdated server entries in sources.list and replace them with the archive servers.

Any commands starting with sudo are running as a super-user, so you’ll have to provide your Linux user password when prompted — much like UAC under Windows.

sudo sed -i s/us.archive.ubuntu/old-releases.ubuntu/g /etc/apt/sources.list
sudo sed -i s/security.ubuntu/old-releases.ubuntu/g /etc/apt/sources.list

Now that we’ve replaced the old us.archive servers with the old-releases servers, we need to update our package installer program, so it will know what to do when we ask it to install our tools.

sudo apt-get update

 

INSTALLING COMPILER AND HELPER PACKAGES

Now that Ubuntu is squared away, it’s time to really get on with setting up our coding environment. We need to install Git, which is a program that helps keep track of all the revisions of source code floating around.

sudo apt-get install git

Now we’re going to grab and install a whole slew of tools. We’re starting with a fairly blank slate, so we must install various Linux tools that will let us compile source code (which is just a textual recipe) into a useable file — a.k.a. an executable binary.

These programs consist of a C++ compiler (gcc), a compiler helper for “makefiles” (automake), and a few others. These are generic tools and are generally needed, regardless of what you are compiling — PS3 code or otherwise.

sudo apt-get install autoconf automake bison flex texinfo libncurses5-dev gcc g++ make wget libelf-dev python2.6-dev python-dev zlib1g-dev libtool git-core libgmp3-dev libssl-dev pkg-config

 

PS3 SPECIFIC TOOLS

Our general coding environment is complete, now we need to get our PS3 specific packages installed, and our project directories created.

Make a temporary working directory to store two Debian packages we’ll be downloading:
mkdir tmp_psl1ght

Change to that directory:
cd tmp_psl1ght

Use wget (which we installed via apt-get earlier) to grab those two Debian packages from a webserver:
wget https://mirrors.mediatemple.net/debian-archive/debian/pool/main/e/elfutils/libelf-dev_0.148-1_i386.deb
wget https://mirrors.mediatemple.net/debian-archive/debian/pool/main/e/elfutils/libelf1_0.148-1_i386.deb

Those packages are for manipulating ELF files, which are the executable binaries for PS3 (the end result of compiling source code). You’ll typically be turning those into SELF or eboot.bin files and then bundling and launching them via PKG files, which is how PS3 homebrew is usually distributed.

Since Debian packages don’t need to be compiled, we can install them straight away:
sudo dpkg -i libelf-dev_0.148-1_i386.deb libelf1_0.148-1_i386.deb

bashrc is a script that is automatically run by Linux. We can use that automation to configure things for us that we’re going to use every time we go to code PS3 stuff. Let’s create some aliases for a few directories that we’re going to reference all the time and then add them into bashrc:
echo 'export PS3DEV=/usr/local/ps3dev' >> ~/.bashrc
echo 'export PSL1GHT=$PS3DEV/libpsl1ght' >> ~/.bashrc
echo 'export PATH="$PATH:$PS3DEV/bin:$PS3DEV/ppu/bin:$PS3DEV/spu/bin"' >> ~/.bashrc

Now that we’ve altered bashrc, we should actually run it to put the changes into effect:
. ~/.bashrc

Since we’ve created aliases for commonly used directories, and–thanks to running the script–Linux is now aware of what those aliases are, let’s put them to use. Remember, we only need to use the alias instead of the full path. Convenient!

Create a PS3 directory to store all your coding projects, and then take ownership of it:
sudo mkdir $PS3DEV
sudo chown $USER $PS3DEV

We’re going to create another alias to make life easy. It’s a working directory for building the ps3toolchain, and since it’s not going to be used all the time, we don’t have to add it to bashrc; it’s only for the here-and-now.

export BUILDDIR=/usr/src/ps3toolchain

Use Git to grab the ps3toolchain source code, and store it into our temporary build directory:
sudo git clone https://github.com/ps3dev/ps3toolchain.git $BUILDDIR

Take ownership of the entire build directory and all its contents:
sudo chown -R $USER $BUILDDIR

Change our directory to the build directory:
cd $BUILDDIR

Now here comes the fun. Just like running bashrc, we’re going to run another script. This one creates the entire PS3 toolchain. This takes hours, so go plan out your project or brush up on your coding.

Cross your fingers and pray for no serious errors:
./toolchain.sh

 

PSL1GHT INSTALLATION

As you can see, that step was quite involved. If you’re still hanging in there, then ask Git to grab PSL1GHT and drop it into the /usr/src/psl1ght directory:
sudo git clone https://github.com/ps3dev/PSL1GHT.git /usr/src/psl1ght

Take ownership of the directory and all its contents:
sudo chown -R $USER /usr/src/psl1ght

Change to the PSL1GHT source code directory:
cd /usr/src/psl1ght

Now make PSL1GHT from its source, and set it all into motion:
make all install

Take ownership of various directories and their contents:
sudo chown -R root:root $PS3DEV $BUILDDIR /usr/src/psl1ght

Create a ps3dev directory in your “home” directory:
mkdir ~/ps3dev

Copy PSL1GHT sample programs into our new ps3dev directory:
cp -r $BUILDDIR/build/psl1ght/samples ~/ps3dev

Change to our sample code directory and create binaries from the sample source code:
cd ~/ps3dev/samples
make

Change to our “home” directory and do some housekeeping (it should free up about 3 gigs of space):
cd ~
sudo rm -rf $BUILDDIR /usr/src/psl1ght

 

AFTERMATH

WHEW! That was a ride. Now go study PSL1GHT and build some code.

Oh… remember that SMbus error Ubuntu gives at boot? Here’s the fix:
sudo su
sudo echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist.conf

Reboot and enjoy.

Bookmark the permalink.