📜 ⬆️ ⬇️

Playstation 2: Hello World

Good day to Habr!
Surely, for many of us, an old woman playstation lying around in the bins. In this article I want to introduce you to the fascinating world of programming. We will prepare an altlinux distribution for development, which includes setting up the environment and the SDK, as well as compiling the first Hello World. Interesting? Then let's go.




Distributive


Since we have ps2 on Linux, it is therefore more convenient to develop, also under Linux. For this, I chose altlinux. You can try another one, but I will describe this one. So.
Download the altlinux image. I downloaded the i686, because the other one I did not want to get into the Virtual Box. And install on the target system with developer tools.
After installing and configuring the network, check if packages are available.
')
gcc, make, patch, subversion, wget

Also install Git, because ps2sdk is on github.

PS2SDK


Here it is more interesting, it turns out, there is an open SDK, which realizes almost all the features of Ps2. The only thing there is a problem with the USB driver, as well as with the GS. Very great things can not be done, but we do not need it? ;)

Sources are at github.com/ps2dev . Actually from there we will swing them. Rather, we are not, and tulcheyn that will help us easily enter the water.

To install the toolchain, we need to perform the following steps:

Go to the user directory, and under the console run

 git clone https://github.com/ps2dev/ps2toolchain 

And in the end we have a toolchain downloaded which will easily help us to install the SDK.

It remains to register the environment for our console. To do this, we need to create a script in /etc/profile.d/ I called it ps2sdk.sh

We write in the console:
 mcedit /etc/profile.d/ps2sdk.sh 

And we put there the following lines:
 export PS2DEV=/usr/local/ps2dev export PATH=$PATH:$PS2DEV/bin export PATH=$PATH:$PS2DEV/ee/bin export PATH=$PATH:$PS2DEV/iop/bin export PATH=$PATH:$PS2DEV/dvp/bin export PS2SDK=$PS2DEV/ps2sdk export PATH=$PATH:$PS2SDK/bin 

After that we execute:
 chmod 0777 /etc/profile.d/ps2sdk.sh cd /home/[youUser]/ps2toolchain/ ./toolchain.sh 

It will take a long process of downloading and compiling, in the end everything should turn out without errors. Now I can congratulate you, you can develop for PS2.

Playstation 2


Now let's dive into the world of playstation. I hope you are as lucky as you and I have a modchip. If not, the development will be difficult, but in principle real. There are several ways to run your application on Sonya, here are some of them:
  1. Boot cd with uLaunchELF
  2. MemoryCard uLaunchELF
  3. PS2Link

In the first two ways, we can also record our software instead of uLaunchELF. It is noteworthy that if we have uLaunchELF (I will post the iso image at the end of the article), then we can run our programs from a flash drive. For starters, I think this is a wonderful way, so let's use it. The only thing is that after booting from the disk, you can move BOOT.ELF to the memory card (mc0: /BOOT/BOOT.ELF), now if you are the owner of the chip mod you just have to hold R1 while loading the console.

Let's imagine that you have recorded a disc, and now run to your Sonya and turn it on, has uLaunchELF loaded? Then everything is fine. You can not turn it off, now we move on to the most interesting, the first compilation of the application.



Hello World!


Now we just need to copy the examples from the ps2sdk folder to our home directory. To do this, we write in the console

 cp –r /usr/local/ps2dev/ps2sdk/samples ./ cd ./draw/teapot make 

If you saw it means everything went well.



Now if you have a ps2, then drop the teapot.elf file (/ home / [youuser] /samples/draw/teapot/teapot.elf) into the root of the flash drive. If not, use the emulator. In the end, it will look like this:





Eventually


PS2 development is pretty simple. She has great potential and I think we will reveal it to you.
as I have promised:
Iso disk image uLaunchELF - kupimoloka.ru/ulaunchelf.zip
PS2SDK - github.com/ps2dev

In the following articles


Source: https://habr.com/ru/post/168863/


All Articles