Page 1 of 1

Installing Psl1ght on cygwin and creating PS3 Homebrews

Posted: Sat Aug 04, 2012 2:37 pm
by wololo
This is just a quick post to explain how I installed the PS3 SDK (PSL1ght) on my windows computer, with also a quick example to compile a homebrew and run it on a 3.55 CFW.

Image


This guide will help you install psl1ght and associated libraries on windows. Once installed, you will be able to create homebrews for the ps3 without needing any additional tool (except you favorite text editor).

Keep in mind that programming homebrews for the ps3 is much more easy to do on linux, and that by trying to do it on windows, you are already making it harder on yourself. If like me, despite this, you'd rather give it a try on windows, then keep reading.

There are many guides on how to install the PS3 SDK, but most of them assume you are running on linux, and the other ones are slightly outdated or incomplete.

First of all, I gave up on finding a pure Windows implementation of the PS3 SDK. We have minpsp for the PSP, but I couldn't find something similar for the PS3. The things I found that pretended to be pure "windows" solutions actually shipped with things such as mingw, and overall were not working out of the box (yeah, coming from the psp scene sets high expectations with the tools we have).
So I gave up on this idea, and installed cygwin, which is relatively well supported by the PSL1ght toolchain.

Requirements
Cygwin
Installing cygwin is pretty straightforward, just download it here and follow the default settings to install it, but add wget in the list of packages. This will give you access to some cygwin terminals, which are as close as you can get from a *nix terminal without running a virtual machine or installing Linux.

Installing PSL1GHT

The best windows tutorial I could find on how to do install the PS3 SDK (psl1ght) was found here. I'll duplicate it below for the sake of completeness, but the source might be more up to date than my tutorial when your read this. Please note that I ran into issues while following these steps, and I explain how I solved these issues. My additions to the tutorial are in italics

1. Install Cygwin & PSL1GHT Dependencies

* First, download the Cygwin Setup and install it with default options, except add wget from Web category to the install. [If you read the requirrements part above, you already have that.]

* Next, install apt-cyg package manager from the cygwin shell:
Type This

Code: Select all

wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg
chmod +x apt-cyg
mv apt-cyg /usr/bin
[note for noobs: if the first command fails, it probably means you forgot to install wget from the cygwin setup. Run the cygwin setup and add wget]

Now intall PSL1GHT dependencies and some useful packages:
Type This

Code: Select all

apt-cyg install autoconf automake bison flex texinfo libncurses-devel gcc4 make \
libelf0-devel python zlib-devel libtool libgmp-devel openssl-devel pkg-config \
git subversion mercurial patch bzip2 mc mpfr
2. Setup Your Environment

You need some environment variables to build and use PSL1GHT:
Type This

Code: Select all

echo 'export PS3DEV=/usr/local/ps3dev' >> ~/.bash_profile
echo 'export PSL1GHT=$PS3DEV/psl1ght' >> ~/.bash_profile
echo 'export PATH="$PATH:$PS3DEV/bin:$PS3DEV/ppu/bin:$PS3DEV/spu/bin"' >> ~/.bash_profile
. ~/.bash_profile
Note: it is recommended to use the settings suggested in the tutorial, but I personally put everything in my home folder rather than /usr/local

PS3DEV is where you will install everything
To install in your home directory set it to ~/ps3dev
You'll need more than 256MB ram to compile everything

3. Make Target Directory

Make PS3DEV directory and take ownership:
Type This

Code: Select all

mkdir $PS3DEV
chown $USER $PS3DEV
4. Make Source Directory & Start Building

This takes a long time on most systems
[We're talking hours here depending on your machine, when you run toolchain.sh]

Make PS3SRC directory and take ownership:
Type This

Code: Select all

export PS3SRC=/usr/src/ps3dev
mkdir $PS3SRC
chown $USER $PS3SRC
The build directory can be anywhere you have space
It will require about 2.3G when everything is fully built

Now build the toolchain:
Type This

Code: Select all

git clone git://github.com/ps3dev/ps3toolchain.git $PS3SRC
cd $PS3SRC
./toolchain.sh
During the build PSL1GHT and ps3libraries will be automatically downloaded and installed.
If you got problems on Windows 7, try to activate the Guest-User (I got permission errors otherwise on tar)

Toolchain.sh troubleshooting
I ran into several issues while running toolchain.sh. Since everytime you run the full toolchain, it can take lots of time, errors are really frustrating... here's what I ran into:

Freetype error:
fatal error: freetype/config/ftheader.h: No such file or directory

This is a "bug" in the freetype library, which does not create the include folder at the right position. (the include folder ends up in includes/freetype2/freetype instead of includes/freetype).
This is solved by creating a symlink to the right folder:

Code: Select all

cd /usr/local/ps3dev/portlibs/ppu/include/
ln -s freetype2/freetype . 
(replace /usr/local/ps3dev with wherever you decided to put your ps3dev folder)

File "/usr/local/ps3dev/bin/pkg.py", line 229, in <module>
import pkgcrypt
Importerror: Permission Denied


PSL1ght Makefile doesn't set pkgcrypt as executable, this error prevents Python under cygwin to import pkgcrypt module in pkg.py script.

to fix this:

Code: Select all

chmod +x /usr/local/ps3dev/bin/pkgcrypt.dll
Then run only the last part of the toolchain:

Code: Select all

toolchain.sh 9
(Otherwise, the toolchain will recreate the pkgcrypt.dll file with incorrect permissions again...)

After fixing these 2 issues, I was able to compile and install psl1ght as well as the ps3 libraries without any issue

Compiling a homebrew
There are samples in the /usr/src/ps3dev/build/psl1ght/samples/ folder, but they "only" let you compile self files. This is good, but it seems to me the "best" way to distribute a homebrew is with a .pkg file.
Instead of trying and figuring it out by myself how to create a .pkg once I have a .self file which is not my goal for now, I instead downloaded an additional sample from this page.
The tutorial on that page does not really matter to me for now, what mattered to me was the sample that is provided there. You can download it here

I extracted that zip into a folder of my choice (~/SDL_PS3_Example) and then typed:

Code: Select all

cd ~/SDL_PS3_Example
make
make pkg
This created a bunch of files for me, including a .pkg file (SDL_PS3_Example.pkg).
The actual homebrew is the .self file that gets generated, but the .pkg file is probably what you'll end up distributing

Installing the homebrew on your PS3
Copy the .pkg file on a usb stick
On a 3.55 CFW, there should normally be a "install package files" option in your game menu, launch it from the XMB
Your pkg file should appear in the list. click on it to install it
That's it, your homebrew is installed and ready to run.

Most information compiled from the following websites: psxbrew.net, psl1ght.net
Many thanks go to alnitak for the 3.55 ps3!

Re: Installing Psl1ght on cygwin and creating PS3 Homebrews

Posted: Sat Aug 04, 2012 3:05 pm
by Acid_Snake
Nice tuto. Does this mean you finally got a hacked PS3?

[deleted]

Posted: Sat Aug 04, 2012 10:48 pm
by oam99
[deleted]

Re: Installing Psl1ght on cygwin and creating PS3 Homebrews

Posted: Thu Nov 01, 2012 7:04 pm
by noogood
dang...relocating scons on this is pain in the ***

Re: Installing Psl1ght on cygwin and creating PS3 Homebrews

Posted: Thu Nov 01, 2012 11:42 pm
by cbepx
Nice! Good job, Thank you very much!

Re: Installing Psl1ght on cygwin and creating PS3 Homebrews

Posted: Thu Feb 07, 2013 8:53 am
by jkonar
It's very usefull and thanks for it!:)

Re: Installing Psl1ght on cygwin and creating PS3 Homebrews

Posted: Wed Jan 08, 2014 9:36 pm
by DR460N
Thanks. Great Tutorial

Re: Installing Psl1ght on cygwin and creating PS3 Homebrews

Posted: Sat Feb 01, 2014 11:17 am
by Zecoxao
i get this:

Code: Select all

../../gcc/doc/cppopts.texi:806: @itemx must follow @item

Re: Installing Psl1ght on cygwin and creating PS3 Homebrews

Posted: Mon Sep 07, 2015 9:49 am
by Zecoxao
a little bump:

Code: Select all

apt-cyg install autoconf automake bison flex texinfo libncurses-devel make libelf-devel python zlib-devel libtool libgmp-devel openssl-devel pkg-config git subversion mercurial patch bzip2 mc mpfr gcc-g++
correct code to install packages

https://github.com/jevinskie/ps3toolcha ... d-greatest this branch should build ps3toolchain just fine.

edit: fails on sdl_psl1ght_libs.sh on last stage, because ./configure can't determine the build environment (cygwin)