PS3 Ubuntu 10.04 – Summary Guide

OK. So I broke my Ubuntu installation on my PS3, again. Happens all too regularly, I’m afraid. And, I’m not smart enough to fix it once it is borked. So, here’s how I start from scratch to get a Ubuntu 10.04 installation working on my PS3, from nothing.

So, starting from the firmware 3.15 on PS3 Phat. Anything later and sorry, Sony has stolen the OtherOS feature from you. Too bad, you loose. Sony has screwed you.

First thing, you need to visit PSUbuntu to get some hints. Many on them are dated (in terms of the Ubuntu release described), but still a fountain of knowledge.

Step 1. Installing the OtherOS Bootloader. There are a number of them mentioned, but only one that I’ve found handles the ext4 file system, required / desired by later Ubuntu installation systems. The petitboot bootloader is available in different versions, but this one is the one I use It needs to be stored in a USB dongle in a /ps3/otheros/ directory so that the PS3 system can find it to install.

Step 2. Have the Ubuntu 10.04 LTS CD available and have it inserted when you reboot to OtherOS loader from the PS3 OS. The latest version can be obtained from here. I generally use the alternate version, but i guess the desktop version works just as well.

Step 3. Install the Ubuntu 10.04 system, following all the relevant prompts. Blah. Blah.

Step 4. First thing is to get some more swap. There is a full instruction here

Ripping off the instructions from PSUbuntu:

sudo gedit /etc/modules
add “ps3vram” at the end of the file

save the file and get back to the terminal
sudo gedit /etc/rc.local
scroll until you see these lines of code:

exit 0

Before add the following:
mkswap /dev/ps3vram
swapon -p 1 /dev/ps3vram

Step 5. Make the monitor work properly. The instruction here is a little outdated. The introduction of upstart into Ubuntu has made the older instructions obsolete.

First thing is to install the fbset tool.

sudo apt-get install fbset

And then use it according to the instructions here to find out the right amount of cropping necessary to make the screen fit. Once you have the right size (dependent on your monitor) then create a file like this in /etc/init/

# fbset – set system frame buffer
#
# This task is run on startup to set the system frame buffer for Pioneer 720p
# First you need to sudo apt-get install fbset
# then this file gets put in /etc/init/

description    “set system framebuffer”

start on startup

task
exec fbset -a -xres 1216 -yres 680 -vxres 1216 -vyres 680

Once this file is created, with the fbset characteristics appropriate to the monitor you’re using, then also create a soft link in /etc/init.d/ to the standard upstart script. Look at other soft links in the same /etc/init.d/ directory to get the idea.

sudo ln -s /lib/init/upstart-job /etc/init.d/fbset

This makes sure that the fbset command gets properly executed.

Last thing is to modify the file in /etc/kboot.conf to use the overscan mode which means adding 128 to the resolution you’ve selected. For 720p I am using the following line:

linux=’/boot/vmlinux initrd=/boot/initrd.img root=/dev/ps3da2 video=ps3fb:mode:131′

This should get the screen resolution set correctly.

Step 6. Compile a new kernel, for the Cell Broadband Engine. There are some instructions on generic Ubuntu Kernels here, which are accurate and simple (even for me).

I found that I only need to ask for these packages, and everything else is brought in too.

sudo apt-get install fakeroot build-essential qt3-dev-tools libqt3-mt-dev

Don’t forget to set the concurrency to make best use of dual-core PowerPC CBE.

export CONCURRENCY_LEVEL=3

When using the xconfig tool, there are two options that should be selected compile for POWER4 and optimise for Cell Broadband Engine. Also, the kernel tick can be set to 300Hz or 1000Hz to get a bit better responsiveness.

fakeroot make-kpkg –initrd –append-to-version=”your-version-identifier” kernel-image kernel-headers modules_image

Following the instructions, there are two additional steps that need to be completed to get the kernel to work properly.

Check you have the tools to build a initrd image

sudo apt-get install initramfs-tools

Build the initrd image following command for building the initrd image

sudo update-initramfs -c –k 2.6.3x.xx.custom

Version 2.6.3x.xx.custom is the directory name which appears in /lib/modules/ after installing modules)
The initrd image will be generated /boot/ directory

I create some soft links in the /boot directory, to save me having to modify the /etc/kboot.conf file

sudo ln -s vmlinux.2.6.3x.xx.custom vmlinux.custom

sudo ln -s initrd.2.6.3x.xx.custom.img initrd.custom.img

Then, create linkages in the /etc/kboot.conf file so that you can refer to the new kernel and initrd image from the boot command line. For example.

linux.custom=’/boot/vmlinux.custom initrd=/boot/initrd.custom.img root=/dev/ps3da2 video=ps3fb:mode:131′

Ok now I’ve found that I need to rebuild the initramfs on the original and old linux versions, otherwise they won’t boot. Costs nothing except a few seconds to do this anyway.

sudo update-initramfs -c –k all

Step 7. Ok. Now go to town. Everything else works perfectly on my machine. Update it. Add multimedia.  Whatever.

Wii Linux & Homebrew – Summary Guide

I’m writing this down so that the steps I’ve taken to get a full debian Lenny GNU/Linux machine onto my Wii don’t get forgotten in the haze of my memory.

When the Wii and PS3 were just released, back in 2006, I had one on pre-order and picked it up just before Christmas. I remember considering the use case for a console in my home. Whilst I could appreciate the PS3 for its ability to play Blueray (at that time still in competition with DVD-HD), and to be a Linux compute device, I really couldn’t see anyone at our home sitting in front of the lounge screen button mashing on a controller. The Wiimote however was another story…

Over the past four years we’ve collected a shelf full of Wii games, all of which are fun because of the Wiimote. We can shoot, fish, bowl, and bat, all because of the Wiimote. It was a great decision back then, which I’ve never regretted. Because of its utility as a games machine, until now I had restrained myself from hacking about on the Wii, so not to spoil the user experience.

I’ve also purchased a PS3, which I purchased second hand when I heard that the PS3slim would no longer support OtherOS. It plays Blueray, and runs Ubuntu. I’ve never purchased a game for it and, given Sony’s decision to force me to choose between the OtherOS feature or the PlayStation Network, I will NEVER buy anything from Sony again. But I digress…

As background, my Wii was purchased in 2006 and therefore has the oldest boot1 and boot2 code. Unfortunately, I’ve upgraded the System Software at every opportunity, so it is currently running the current System version 4.3. It is Australian released, which means that it is a European version in terms of firmware.

The destination for this process is to have a GNU/Linux operating system, including a windowing desktop, running on the Wii. Whilst I’ve been using Ubuntu for most of my home computers, the initial target for this build is debian Lenny.

Finding the first vulnerability – Indiana Pwns – Using LEGO Indiana Jones

Investigating the alternatives for hacking the Wii revealed that of all of the alternatives mentioned, there was only one that would work for my device, on System version 4.3.

Taken from the WiiBrew description:

The Indiana Pwns is a safe way to enable homebrew  on a Wii without hardware modification. The Indiana Pwns is achieved by playing a hacked game save for LEGO Indiana Jones which executes a homebrew application from an external SD card. The Indiana Pwns was created by Team Twiizers.

This is actually the most expensive and time intensive part of the entire process. Expensive, because you have to buy a (imho stupid) game. Time consuming because you have to play through the first section until it allows you to save game, before you can use the vulnerability. But, don’t worry there is a walk through available to speed things along, and you actually can’t ever die in a LEGO game.

Once you’ve saved a game, then use the Indiana Pwns code to load the Homebrew Channel loader and the BootMii code.

EDIT: Just in; Team Twiizers and roto have created the Return of the Jodi exploit. This exploits the same buffer overflow issue as Indiana Pwns, but the game is more available in stores.

BootMii & boot2

BootMii is the path to get total control over the Wii hardware. Because I have an older Wii, released before 2008, I can use the boot2 method to get early control before the Wii System is even loaded. This method provides the best (fastest and most complete) access to hardware, and is the most proof against Nintendo removing my good work. 

As I have System Menu 4.3 I actually have boot2v4 installed. So its clear that the BootMii code can modify this most recent version of the boot2 code with no issue.

BootMii boot2 is written to the Wii as part of the Homebrew Channel installer program, and once it is installed we pwn the Wii, and we can choose to load the Wii System Menu or boot to another operating system, such as debian GNU/Linux, depending on which SD card we have in the slot.

Once BootMii is installed, there is no reason to ever see it again. However, from the Homebrew Channel (which we get to next) there is a option to open it, and it has a configuration file that can be modified to get it to change is boot options. For example, I configured it to boot directly to the Wii System Menu, so that the User Experience is exactly as Nintendo intended. Alternatively, when I use my debian SD card, it boots straight into debian GNU/Linux.

Homebrew Channel (as a diversion), and Homebrew Browser

While we’re going along with this hacking thing, why not install something useful for the whole family. The Homebrew Channel opens the Wii to the world of FOSS games, media players, and utilities.

The Homebrew Channel loads any application copied onto the SD card, and even easier the Homebrew Browser is a live updating online market of free stuff for the Wii. So far we love Jelly Car the most of any of the games we’ve tried on Homebrew.

Update: Until recently I was not able to find an application to play DVDs from my Wii. The System Menu 4.3 code prevented use of IOS202 and other methods. However WiiMC 1.1 has just been released, that uses IOS58 to get access to the USB, and it works perfectly. Will even install a Channel on the main menu, so that there is no need to go into the Homebrew Channel to launch WiiMC. It also plays SMB shares, so that NAS stored video, music and pictures can be played.

But, I digress…

GC-Linux Mike Kernel

Well, every GNU system needs a kernel, and in our case it is supplied as the MIKE kernel by GC Linux. Most of the devices and modifications for the Wii platform have been integrated into the Linux main line code as of 2.6.33.

Until then GC Linux have prepared two alternative kernels based on IOS, if you’ve a new Wii and can’t get to boot2, or based on MINI (the simple open alternative for IOS) which can launch directly from boot2, and has higher performance & hardware compatibility.

The Kernel images also differentiate based on the screen resolution you’re using. Given that you’ve a component cable to connect the Wii to your big screen, then you’ll need one of the 480p versions (PAL or NTSC) for MINI.

Whiite Linux

Whiite Linux is a full implementation of GNU/Linux for the Wii. There are two components necessary for this. As the kernel component is taken care of by the GC Linux MIKE, the other component required is a file system, and that is available as a tarball.

The instructions on the GC Linux installation page are complete. Well, at least they are now I’ve added the piece about setting the locale correctly. Without a locale set, perl gets really borked, and then applications that draw character based windows on the text screen (such as aptitude) don’t look
good at all (bordering on unusable).

You’ll also need to have some swap configured. the Wii only has 24MB + 64MB of RAM, and this will run out quickly if you start to have some services running.

So you can get comfortable with Whiite Linux now. apt-get as much stuff as you want.

xfce Desktop & Xorg Drivers

To get desktop running is a little more complicated. I choose to use xfce, as it is easily supported by debian in a package, that gets everything needed. It will take a while to download, and install, but this saves caring about what is installed, and what not.

apt-get install xfce-desktop

As part of this install, there will be questions about setting up xorg. Try to answer them benignly and sensibly, but don’t worry as it will fail in the end, and continue.

Now that we have everything we need need for the desktop installed, we have to worry about the special driver for Xorg on the Wii, called xf86-video-cube. There are some good instructions from Wiibrewfan4, that I’ve partially reproduced here, on how to prepare and install that driver.

Before doing that however, it is important to have a gcc, and make, and the standard utilities available.

apt-get install gcc, make

Now for getting the xf86-video-cube code and getting it ready.

Install cvs-client in order to get the lastest build of nuvalo’s cube xorg driver.

apt-get install cvs

Configure a cvs root somewhere where you have some space.

Get the source:

cvs -d:pserver:anonymous@gc-linux.cvs.sourceforge.net:/cvsroot/gc-linux login

cvs -z3 -d:pserver:anonymous@gc-linux.cvs.sourceforge.net:/cvsroot/gc-linux co -P xf86-video-cube

Before compiling Nuvalo’s cube_driver for Xorg, please install the following packages:

apt-get install module-init-tools pkg-config xserver-xorg-dev x11proto-randr-dev libxrandr-dev x11proto-video-dev x11proto-fonts-dev

cd to xf86-video-cube/ and type:

./configure && make && make install

configure will check that you have all the right pieces available, so watch its progress carefully, and just apt-get install anything that seems to be missing.

Following make install the driver installs itself to wrong location, so:

cp /usr/local/lib/xorg/modules/drivers/cube_driver.* /usr/lib/xorg/modules/

The last step is to configure the /etc/X11/xorg.conf file.

Because of the previous failure to configure xorg properly, there won’t be an xorg.conf file in the system. we can generate on with

dpkg-reconfigure xserver-xorg

Follow the questions as best as possible, which will generate a simple file, which can be edited as follows. I’ve attached my xorg.conf file for info.

Edit the file “/etc/X11/xorg.conf” and add a new video section:

Code:

Section “Device”
Identifier “WII/Gc Card”
Driver “cube”
EndSection

Edit the module section, and leave it as this:

Code:

Section “Module”

Load “dbe”
Load “ddc”
SubSection “extmod”

# Option “omit xfree86-dga”
# Option “omit XFree86-VidModeExtension”

EndSubSection
Load “type1”
Load “freetype”
Load “dri”

EndSection

Edit the screen section, and replace the next options:

Code:

Section “Screen”
….
Device “WII/Gc Card”
….
DefaultDepth 16
Subsection “Display”

Modes “640×480”

EndSubsection
EndSection

Now, reboot the Wii, and automagically it should boot to a debian X login prompt.

And, if you’re like me and didn’t add any additional users, you won’t be able to log in as root until you modify the session parameters.

Fun and games

Ok from this point things left to do are: get the Wiimote working and try to migrate to Ubuntu using debootstrap.

Both are subjects of further notes.