PS3 [guide] build a PS3 toolchain on macOS

Discussion in 'Homebrew Development' started by bucanero, Aug 14, 2019.

  1. 19
    24
    7
    bucanero

    bucanero Forum Noob

    Joined:
    Jun 29, 2019
    Messages:
    19
    Likes Received:
    24
    Trophy Points:
    7
    Gender:
    Male
    Location:
    Argentina
    Home Page:
    I finally managed to write down my experience building the open-source PS3 toolchain on macOS Mojave. I hope it helps anyone who wants to start doing some development on the PlayStation! :)

    This post will guide you to build an open-source PS3 development environment on macOS from the ground up, and show you how to compile and run your first PS3 homebrew app.

    For reference, I've also published it on my blog: http://www.bucanero.com.ar/2019/08/14/building-your-ps3-dev-environment-on-macos/
    Prerequesites

    • macOS (currently v10.14.6 Mojave)
    • Xcode (currently v10.3)
    • Homebrew (package manager)
    Setting up the requirements

    Xcode

    1. Download the latest Xcode from the Apple Mac Store.
    2. Install Xcode
    3. Run Xcode for the first time, and allow the application to install all the required libraries and complete the initial setup.
    Homebrew (package manager)

    1. Install the Homebrew package manager from brew.sh , by running the following command from a Terminal window:
    Code:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    Install required packages

    Once Homebrew is ready, we use it to install the required packages that will allow us to build the PS3 toolchain, by running the following commands from a console window:

    Code:
    brew install autoconf
    brew install automake
    brew install openssl
    brew install libelf
    brew install ncurses
    brew install zlib
    brew install gmp
    brew install wget
    brew install pkg-config
    Building the PS3 toolchain and libraries

    To build the PS3 toolchain and the open-source libraries (including PSL1GHT), first we need to create a new folder:

    Code:
    sudo mkdir /usr/local/ps3dev
    Next, we check out the build scripts and start the building process:

    Code:
    git clone https://github.com/bucanero/ps3toolchain.git
    cd ps3toolchain
    ./toolchain-sudo.sh
    Now your system will start downloading and building the GCC cross-compiler toolchain for the PS3, and continue with the PSL1GHT library.
    Please note that depending on your hardware, available memory, and network connection speed, this can take a while.

    Building your first sample

    If everything goes as expected, when the toolchain script finishes, you’ll have a complete PS3 development environment ready to begin coding your own PlayStation homebrew apps and games.
    Next, let's build a basic PSL1GHT sample app and test the toolchain:

    Code:
    cd build/psl1ght/samples/graphics/blitting/
    make
    You should see an output similar to:
    Code:
    bitmap.c
    main.c
    linking ... blitting.elf
    CEX self ... blitting.self
    ELF header size @ 40
    8 program headers @ 40
    23 section headers @ 51478
    deflated...processing segment 0 with rlen 26388 len 10cab offset 0...encrypted...
    deflated...processing segment 1 with rlen 5140 len 14e9 offset 30000...encrypted...
    deflated...processing segment 2 with rlen 30f0 len e5e offset 40000...encrypted...
    deflated...processing segment 3 with rlen 1260 len 218 offset 50000...encrypted...
    processing segment 4 with rlen 0 len 0 offset 51260...encrypted...
    processing segment 5 with rlen 0 len 0 offset 35140...encrypted...
    processing segment 6 with rlen 0 len 0 offset 0...encrypted...
    deflated...processing segment 7 with rlen 28 len 22 offset 26360...encrypted...
    segments enumerated
    built crypt data
    file built
    self written in memory
    Running your first sample

    To run and test your code, we run the PS3Load app on a host PlayStation 3, and send our compiled binary code over the network.
    Install PS3Load on your PS3

    1. Download the PS3Load v0.2 host app from Brewology.com
    2. Install the .pkg file on your PS3
    3. Connect the PS3 to your LAN network (Wi-Fi or Ethernet)
    4. Run PS3Load from the XMB (in the Network tab)
    Send your sample code

    When the host PS3Load app is running, you’ll see the IP address of your PS3 on the screen. Take note of it, so we can setup our dev environment:

    Code:
    export PS3LOAD=tcp:192.168.0.30
    Last but not least, we are ready to send the binary file and see our first sample app running on the PlayStation:
    Code:
    /usr/local/ps3dev/bin/ps3load blitting.fake.self
    At this point, you should be watching a nice “PSL1GHT” demo on your PS3 screen. [​IMG]
    Congrats! you’ve reached the end of this guide and hopefully you’re now ready to start coding some great homebrew apps and games for the PS3.
     
    Last edited: Aug 14, 2019
  2. 5,604
    2,696
    497
    atreyu187

    atreyu187 Retired Old Hunter Moderator

    Joined:
    Sep 29, 2014
    Messages:
    5,604
    Likes Received:
    2,696
    Trophy Points:
    497
    Gender:
    Male
    Occupation:
    Scholar of Byrgenwerth
    Location:
    Cainhurst Castle
    Home Page:
    Nice to see you outside of the Dreamcast scene it's been a few years but as a Mojave OSX user thanks for this as well.
     
  3. 1,281
    833
    222
    nCadeRegal

    nCadeRegal Moderator

    Joined:
    Jul 1, 2015
    Messages:
    1,281
    Likes Received:
    833
    Trophy Points:
    222
    Gender:
    Male
    I'm gonna sticky this thread so it doesn't get buried. Thanks for the guide!
     
    bucanero and pinky like this.
  4. 19
    24
    7
    bucanero

    bucanero Forum Noob

    Joined:
    Jun 29, 2019
    Messages:
    19
    Likes Received:
    24
    Trophy Points:
    7
    Gender:
    Male
    Location:
    Argentina
    Home Page:
    I'm glad if this quick guide helps the PS scene :encouragement:
    oh, indeed it has been a while since my last Dreamcast release :biggrin:, and I've been out of coding for a long time too

    I'm quite rusty since those old days, and I'm not sure how far I'll go with my homebrew ideas, but thanks to PS3HEN I decided to jump into the PS3 dev and see what happens. :peaceful:

    I'll share my progress when I've something useful to release
    cheers!
     
    nCadeRegal and atreyu187 like this.
  5. 19
    24
    7
    bucanero

    bucanero Forum Noob

    Joined:
    Jun 29, 2019
    Messages:
    19
    Likes Received:
    24
    Trophy Points:
    7
    Gender:
    Male
    Location:
    Argentina
    Home Page:
    you're welcome, I hope it helps to bring more devs to the party! :biggrin:
     
    atreyu187 likes this.

Share This Page