Setup a build environment for compiling and running homebrew for PS3

Ubuntu PS3 Logo

This the first of a series of articles I’ll write with the intent of build Scogger for PS3. Hope to finish this work before 2012.

Last update 22-jan-11 see changelog

Preface

With the breaking out of PSJailbreak this summer, the homebrew sceene didn’t wait so long to appear on Playstation3.

So we are finally talking about the possibility to run our own unsigned  code, using any of the available dongles  (you can even build one yourself).

Before actually start writing our application it is necessary to build our development envirement. For doing this we need a toolchain and a SDK: I’ll use ps3chain ps3toolchain and PSL1GHT.

The latter one is very young (project started 29-oct-10) and continously mantained, so the are chances that something may not work as you would expect.

Updating git daily, reporting bugs and contributing is appreciated :)

Prerequisites

First of all we need to set our PS3 dev directory and some system variables, as well as all software needed to build our toolchain.

This guide is written for user with Ubuntu 10.10 32bit, but also other Linux distribution are supported, I think.

Let’s start from software needed to build the toolchain:

sudo apt-get install autoconf automake bison flex gcc make wget
git libppl0.10-dev libcloog-ppl-dev libelf-dev
libncurses5-dev texinfo build-essential libgmp3-dev
python zlib1g-dev pkg-config libtool python-dev

I’ve set my PS3 dev directory to ~/dev/ps3

mkdir -p ~/dev/ps3

Add these lines at the end of ~/.bashrc for setting needed system variables

export PS3DEV=$HOME/dev/ps3
export PSL1GHT=$PS3DEV/psl1ght
export PATH=$PATH:$PS3DEV/bin:$PS3DEV/host/ppu/bin:$PS3DEV/host/spu/bin:$PSL1GHT/host/bin

Update bashrc for apply changes:

. .bashrc

Finish :)

Installing the ps3toolchain toolchain

Let’s clone ps3chain git repository:

cd $PS3DEV
git clone git://github.com/ooPo/ps3toolchain.git

Execute the automated script frorm the ps3toolchain directory just cloned:

cd ps3toolchain
./toolchain.sh

Have a loooooong break, then if you don’t see any error you can say to all your friends that the toolchain is installed :)

Installing the ps3chain toolchain (alternative to ps3toolchain, not supported right now)

Let’s clone ps3chain git repository:

cd $PS3DEV
git clone git://github.com/HACKERCHANNEL/ps3chain.git

Execute the automated script frorm the ps3chain directory just cloned:

cd ps3chain
./buildit.sh all

Installing the PSL1GHT SDK

Update: This step is no longer needed, as ps3toolchain install psl1ght also.

Now clone the psl1ght git repository:

cd $PS3DEV
git clone git://github.com/HACKERCHANNEL/PSL1GHT.git

Add these lines at the end of ~/.bashrc for setting needed system variables:

Build and install it:

cd $PS3DEV/PSL1GHT/psl1ght
make
make install

That’s all! :)

Compiling external libraries (libpng, zlib…)

Update: This step is no longer needed, as ps3toolchain install external libraries too.

We need to checkout another git, containing libs and patches for make them (almost) functional on a PS3 dev environment:

  • cairo (COOL)
  • fontconfig, freetype
  • jpeg
  • ogg/vorbis
  • png
  • xml2
  • pixmap
  • libzip
cd $PS3DEV
git clone git://github.com/ooPo/ps3libraries.git
cd ps3libraries/

Launch the script libraries.sh

./libraries.sh

And it will download libraries, patch them, compile, then install.

Compiling and running samples

Samples are included in PSL1GHT samples directory:  I suggest to start with VideoTest.

cd $PS3DEV/ps3toolchain/build/psl1ght/samples/video/videoTest
make pkg

This command will compile the application and create a .pkg file that can be installed on your jailbroken PS3.

Copy it over  a USB pendrive, start the PS3 in jailbreak mode, go to “Install package files”, select your app, install and finally run it!

A nice gray to red gradient screen will appear, press X to exit.

Using ps3load

The above process is fine, but a bit slow. There is a smart way though: compile and launch via wifi using ps3load.

Ps3load is a tool like Nintendo Wii Wiiload that let us launch executables over the network.

First of all set this environment variables as we did with other ones, specifying your PS3 ip address (for example 192.168.0.10):

export PS3LOAD=tcp:192.168.0.10

Compile and install ps3load under network/ps3load directory, just like the previous videoTest.

Please note: since it uses zlib you need to compile the above ps3libraries otherwise you’ll get compilation errors!

Once loaded on PS3 you’ll be welcomed (at least for now) with a nice black screen: this is normal.

You can now compile other samples with usual make command, then run over the network with:

make run

A lot easier, uh?

Hello World!

You can start your own “hello world” program using the template under $PS3DEV/ps3toolchain/build/psl1ght/template directory.

Here it is mine (using libpng):

hello world running on PS3

Happy coding!

Thanks

Trap15, ooPo, Aaron, Seigher and others for ps3toolchain, ps3chain and ps3libraries

AerialX, phiren, MattP and others for PSL1GHT and suggestions :)

Changelog

  • 22-jan-11: new paths required by psl1ght, no longer ps3libraries and psl1ght manual compilation, support for new build path
  • 13-dec-10: Added python-dev dependence thanks to Cyberw0rm
  • 22-nov-10: using ooPo’s ps3toolchain instead of ps3chain: it is updated and let me build ps3load
  • 21-nov-10: added other packages to prerequisites, thanks to KDSBest
About these ads

~ di Scognito su novembre 4, 2010.

22 Risposte to “Setup a build environment for compiling and running homebrew for PS3”

  1. Sadly, because of our rapid development, this is Already out of date.

    Before you can start compiling sample that require zlib and libpng you need to to install ps3libraries. And right now you need to install my fork at https://github.com/phire/ps3libraries/tree/ which has a few bugfixes that OoPo hasn’t merged yet.

  2. Hi Phiren! I’ll try to update as often as I can.
    If the document is old, it means that the development is going on and that’s a good news :)

  3. Your link to PSL1GHT at the top is outdated, my original repo isn’t being used anymore.

    Also, zlib (zlib1g-dev Ubuntu package) and Python 2.x are required for PSL1GHT’s tools.

  4. Article updated with all fixes thanks to Phiren and Aaron :)

  5. help , i have just started setting up but i am stuck:

    git libppl0.10-dev libcloog-ppl-dev libelf-dev

    i get { git: ‘libpp10.10-dev’ is not a git command. see ‘git –help’. }

    BTW i am a linux newb that wants to be ps3 legal :)

    thanks in advanced.

  6. that command is all in one line…but I suggest you to understand linux a bit before :)

  7. ooPo didn’t work on ps3chain, I did :P

  8. trap15 thanks, fixed now!

  9. Hello,
    thx for this great tutorial. Got the video test working. But when trying to make the ps3load sample I get the errors you mentioned. How shall I compile zlib to make that run?

    thx in advance!
    Rob

  10. Hi Rob, I’ve updated the tutorial to use ps3toolchain instad of ps3chain. Now everything works, please delete everything and recompile from scratch.

  11. How are you getting newlib-1.18.0 to compile?
    I have nothing but issues with this when compiling oops’s and hackerchannel toolchain…

    Any incite to this would be very helpful.

    Error:

    /../../../../../newlib/libc/sys/lv2/crt0.c
    ../../../../../../newlib/libc/sys/lv2/autolock.c:16: error: wrong number of arguments specified for ‘constructor’ attribute
    make[6]: *** [lib_a-autolock.o] Error 1
    make[6]: *** Waiting for unfinished jobs….
    make[6]: Leaving directory `/home/evilsperm/dev/ps3/ps3toolchain/build/newlib-1.18.0/build-ppu/ppu/newlib/libc/sys/lv2′
    make[5]: *** [all-recursive] Error 1
    make[5]: Leaving directory `/home/evilsperm/dev/ps3/ps3toolchain/build/newlib-1.18.0/build-ppu/ppu/newlib/libc/sys’
    make[4]: *** [all-recursive] Error 1
    make[4]: Leaving directory `/home/evilsperm/dev/ps3/ps3toolchain/build/newlib-1.18.0/build-ppu/ppu/newlib/libc’
    make[3]: *** [all-recursive] Error 1
    make[3]: Leaving directory `/home/evilsperm/dev/ps3/ps3toolchain/build/newlib-1.18.0/build-ppu/ppu/newlib’
    make[2]: *** [all] Error 2
    make[2]: Leaving directory `/home/evilsperm/dev/ps3/ps3toolchain/build/newlib-1.18.0/build-ppu/ppu/newlib’
    make[1]: *** [all-target-newlib] Error 2
    make[1]: Leaving directory `/home/evilsperm/dev/ps3/ps3toolchain/build/newlib-1.18.0/build-ppu’
    make: *** [all] Error 2
    ../scripts/003-newlib-1.18.0-PPU.sh: Failed.

  12. […] […]

  13. I have newlib-1.18.0 correctly installed, don’t know what to say…did you update git? On november 21 git it worked…

  14. Yeah everything is up to date. I just did a fresh pull on both oopo’s and hackerchannel.
    I have also ripped the source for newlib-1.18.0 directly from ubuntu to see if I can get that to compile by it self and it fails with the same error, so it has to be an issue with newlib-1.18.0 because I couldn’t imagine it has anything to do with my VM.

    I am going to try to move to the beta of ubuntu 11.04 and see if I can get it to compile newlib-1.18.0-6 but ‘m not going to hold my breath. I would love to get this up and running already because I have some use for kammy right now and I would like to fully move away from the leaked SDK’s

  15. […] […]

  16. UPDATE : Python-Dev is needed to compile.

  17. Thanks, added!

  18. […] Setup a build environment for compiling and running homebrew for PS3 November 2010 17 comments and 2 Likes on WordPress.com 5 […]

  19. i get this error while compiling psl1ght

    make
    make[1]: Nothing to be done for `all’.
    make[1]: Nothing to be done for `all’.
    make[1]: Nothing to be done for `all’.
    make[1]: Nothing to be done for `all’.
    make[1]: Nothing to be done for `all’.
    make[2]: `/home/jacob/dev/ps3/PSL1GHT/psl1ght/libpsl1ght.a’ is up to date.
    [CC] libsysutil.c
    /home/jacob/dev/ps3/PSL1GHT/psl1ght/libc-glue-ppu/source/libsysutil.c:2:31: fatal error: sysutil/msgdialog.h: No such file or directory
    compilation terminated.
    make[2]: *** [libsysutil.o] Error 1
    make[1]: *** [build] Error 2
    make: *** [all] Error 2

  20. […] […]

  21. […] Diese Anleitung funktioniert mit der derzeit aktuellen Ubuntu-Version und den derzeit erhältlichen aktuellsten ps3toolchains. Die Basis dieser Anleitung ist folgende: Scognito […]

  22. […] I grab a VM with Ubuntu for testing out the PSL1GHT SDK. If you follow the instructions over at Scognito’s Blog, you really only need to run 5 lines of commands and you’re already ready to program! I […]

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

 
Iscriviti

Ricevi al tuo indirizzo email tutti i nuovi post del sito.

%d blogger cliccano Mi Piace per questo: