Ubuntu Linux and Symfony on a PlayStation 3

_DSC0007
As said previously on this blog, I now work at Splitgames.com, a company based in Paris, France providing services to gamers where I manage the development of our web projects. We use Symfony as a framework on which to base our projects. Of course, we play quite a bit of video games, have a few console systems laying around and I was wondering about how to bridge this two interests. By the way, if you like video games and Symfony we do have a few openings in our office in Paris. Email me if you are interessed at jobs@splitgames.com.

On my right I had a Playstation 3, on my left I had Symfony, the missing link would prove to be Ubuntu Linux.

Note: Running linux on a playstation 3 is not a hack, it doesn’t require any hardware modification, won’t disable any feature on your Playstation 3 and is not difficult to do.

Sony officially support running linux on your ps3 with dedicated tools present in the XMB ( Cross-mediabar, the UI of the Playstation 3).

Caveat: for installing Linux, you will need to format your hard-drive thus losing all the data on it. Fortunately, Sony made a backup utility so you can backup your game’s save data, game demos and other files very simply.

What’s needed ?

  • A CD-R ( or DVD-R, I used a DVR-RW ).
  • USB Keyboard and mouse.
  • USB drive or memory card if you want to backup your data beforehand.
  • Component or HDMI cable if you plan on using the linux GUI ( ie, not use your Playstation 3 as a headless server ).

As you can see, the Playstation 3 doesn’t require any special hardware to use linux as the Playstation 2 did.

Ubuntu Install

First, you have to download an iso image of Ubuntu for your PS3.

You can get it there :
http://cdimage.ubuntu.com/custom/20070608-feisty-ps3/ubuntu-7.04-desktop-powerpc+ps3.iso

While it’s downloading, it’s now a good time to backup your data if you’d like to.
Plug in a usb-hardrive or a memory card and:

In the XMB, go to Settings -> System Settings -> Backup Utility, follow the on-screen instructions.

Once the backup is done and the image has been burned on a CD/DVD, go back to the XMB, and then:

Settings > System Settings > Format Utility > Format Hard Disk.

Choose Yes.
Select “Custom partition setting”
and then “Allot 10GB to the Other OS”
followed by “Perform a Quick Format.”
Reboot the PS3 by pressing X on your controller.

You can now insert the Ubuntu CD on your Playstation 3

_DSC0012

Settings > System Settings > Install Other OS

Hit X when prompted to start the installer.

This step actually install a bootloader on your system from the CD, it doesn’t install the other operating system.

Next, Settings > System Settings > Default System ,select “Other OS” and reboot.
Don’t forget to plug in your keyboard and mouse.

You will then see a command prompt kboot: on the screen, just press enter to boot from the CD.

From now on, it’s a normal Ubuntu install, just click on the installer on the desktop, select the 10GB drive and wait, and then wait some more. The installation is quite slow, much slower than on a comparable computer ( I blame the blu-ray drive ).

Caveat: if you are not using the HDMI output on a HDCP compatible screen, the live CD is going to default to NTSC/PAL resolution. Basically, the screen resolution will be too low for the installer application to display all of its window. Just press the “ALT” key on your keyboard and drag the window with the mouse to access the buttons on the lower side of the window.

After the installation finished and I rebooted into my ubuntu system, I had to make some configuration modification to display a decent resolution over Component cables. See the Notes at the end for the solution to this issue.

Installing Symfony

Screenshot
Now that you have a fully functional Ubuntu installation, there is a few steps left to accomplish before installing your development environment.

First, launch a terminal and get Super-User privileges and install the essential packages

reefab@reefab-desktop:~$ sudo -s
root@reefab-desktop:~# apt-get install php5 php5-cli php5-mysql php-pear

Screenshot-2
Next, install Symfony using Pear, ( the PHP package manager, the cleanest way in my opinion ).


root@reefab-desktop:~# pear channel-discover pear.symfony-project.com
root@reefab-desktop:~# pear install symfony/symfony

Screenshot-3
Now create a directory inside /var/www/ that will house your applications.


root@reefab-desktop:/var/www# mkdir symfony-test

And create your project and one application.


root@reefab-desktop:/var/www/symfony-test# symfony init-project test
root@reefab-desktop:/var/www/symfony-test# symfony init-app frontend

We now need to make some configuration in Apache to enable this application.

Create a new file in the site-available/ directory of the apache configuration


root@reefab-desktop:/var/www/symfony-test# vi /etc/apache2/sites-available/symfony-test


<VirtualHost *:80>
ServerName symfony-test
DocumentRoot "/var/www/symfony-test/web"
DirectoryIndex index.php
Alias /sf /usr/share/php/data/symfony/web/sf
<Directory "/usr/share/php/data/symfony/web/sf/">
AllowOverride All
Allow from All
</Directory>
<Directory "/var/www/symfony-test/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>

And enable this site:


root@reefab-desktop:/var/www/symfony-test# a2ensite
Which site would you like to enable?
Your choices are: default symfony-test
Site name? symfony-test
Site symfony-test installed; run /etc/init.d/apache2 reload to enable.
root@reefab-desktop:/var/www/symfony-test# /etc/init.d/apache2 reload

the “symfony-test” hostname doesn’t exists so you may have to edit your /etc/hosts file and add it at the end of the line 127.0.0.1 or the one that start with the ip address of your system.

Example:


127.0.0.1 localhost symfony-test

Now point your browser to http://symfony-test/ and there you are, a fully functional symfony installation on your Playstation 3 !
Screenshot-4

Notes

If you have a hdmi hdcp compatible display, you can just skip this part.

First, go to a system Console ( press CTRL-ALT-F1 for example ).
You may have an issue with debug message scrolling on the screen and preventing you to actually see what you are typing.

So, you will have to login in and typing “dmesg -n 1″ to stop the kernel message being displayed on the consoles.

Now, use sudo to gain super-user privileges:

sudo -s

I then used the “ps3videomode” utility, just run it once to get a list of all video mode supported.

Then, you’ll have to try some to get on that will works on your display, if the screen become garbled, just press the up arrow and change the number to the default mode. This can get tricky.

I used vidmode number 4: YUV60Hz – 1080i

Now you have to edit /etc/kboot.conf and edit the default entry so it reads:

linux='/boot/vmlinux-2.6.16 initrd=/boot/initrd.img video=ps3fb:mode:##'

with ## being the vidmode you found. Then edit your xorg to add the resolution.

Your system will now have the correct resolution.

by Reefab / August 21, 2007
categories: Software, Symfony

11 Comments

  1. The Sour Mango says:

    thank you so much.. great guide!

  2. COil says:

    Nice tutorial fab :)
    Little post about it on my blog
    –> http://www.coilblog.com/index.php/2007/09/04/23-psymfony3

    PS: Seems there are problems with comments display in your blog

  3. zabadia says:

    thanks man… hey, nice pad.

  4. Mathew7 says:

    Hello, I have a way to improve the speed of the installation process. Using another computer, make a USB stick with a swap partition. 256MB should be enough. So you even can boot the liveCD (as opposed to alternate and straight to install boot). I saw it with XUbuntu: on the user choice, I had to wait around 10-15 seconds to change focus of the fields. With the USB stick, I saw the system was almost instant (less than 1s). And I also saw a lot of access to the stick. What really surprised me whas that when I booter the liveCD with the stick plugged, the swap partition was automatically activated.

  5. Reefab says:

    Thanks Mathew7, nice tip.

  6. steven says:

    good work !
    do you know if it’ok to run PC game on ps3?
    thanks man for that !
    have fun !

  7. Mathew7 says:

    steven, it seems many of you do not get it. PowerPC (on which PS3 is based) has a totally different architecture (instructions) than PC (Intel/AMD based systems). You can play Windows games under linux (only x86/amd64) with Wine because Wine only emulates the .dll files which windows provides. The actual code is executed as is (in the games .exe and .dll). So you cannot use Wine under PS3 to emulate Windows.

    Just because you can run a Windows game under linux, and PS3 can run linux does not mean you can run a windows game under PS3, because the PC linux and PS3 linux are different (although compiled from the same source).

    An analogy would be like: you can put gasoline in a gasoline engine and you drive that engine; since you can also drive a diesel engine, it does not mean you can put gasoline in the diesel engine and expect to work.
    The difference to my analogy is that a diesel engine will be damaged (permanently) by the gasoline, while the PS3 will not be affected by your try.

    PS: I wonder how much time it will take for someone to make a wine-type emulator for PS3? Oh! wait! maybe this is the reason why the graphics chip is locked by Sony.

  8. Joe says:

    “PS: I wonder how much time it will take for someone to make a wine-type emulator for PS3? Oh! wait! maybe this is the reason why the graphics chip is locked by Sony.”

    The reason, under no uncertain terms, is because of licensing issues. It’s not marketing, it’s not some vague notion of stifling competition with Microsoft or something.

    Hopefully, a deal can be struck between Sony/ATI/Others to allow access to the hardware so we can get accelerated X and neat desktop effects. We’re not likely to ever see anything other than that on PS3 Linux because of limitations (mostly RAM.) PS3 games can get by on the limited RAM because the normal game operating system is extremely low-overhead with a very effecient set of API’s – when you run Linux on top of that, the overhead is much higher.

  9. Nicklas says:

    Hello.
    I just tried to install ubuntu om my ps3 60gb system, two times i came to 82% and then it said something about a mirror. wrong release or something like that. and later that evening i tried psubuntu. That version i could not even start to install.
    I have the latest configuration in my ps3 what can be wrong?
    Ubuntu 7.10 did i burn twice and the same error message came. :(

  10. Not that I’m totally impressed, but this is a lot more than I expected for when I stumpled upon a link on Digg telling that the info is awesome. Thanks.

Leave a Reply

delicious
Recently listened to: