_____ ___ ____
____| | ____| PS2Dev Open Source Development Guide
| ___| |____ GUIDE Ver. 0.8 2002/03/17 By now3d
---------------------------------------------------------
EARLY VERSION ! PLEASE EMAIL new sections and constructive comments to: guide AT anarchists.co.uk
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License'', available from
www.gnu.org/Updates available from
ps2dev.sourceforge.net/This FAQ concerns only Legal Playstation 2 Development See the above site for a newer version of this document
if you think this is an old version.
If you think this FAQ needs another section adding please email us it and it will be included.
We have a mailing list at topica
Subscribe Address: ps2dev-subscribe@topica.com
Unsubscribe Address: ps2dev-unsubscribe@topica.com
List Info:
www.topica.com/lists/ps2devMany people visit #PS2Dev this is on EFNet IRC servers. Go to
www.irchelp.org/irchelp/networks/efnet.txtfor a list of servers in your area. Asking for pirate software will get you banned, go to another PS2 channel if you are this
way inclined.
Read this FAQ and the rest of the infomation on our site before asking questions on the channel. Newbies to this
scene are welcome, people who want others to do the grunt work for them even though there is info on our site please
stay away
Questions that have been asked and answered too many times
-----------------------------------------------------
Q: Can the ps2 run programs from the memory card
A: Not unless you ask sony to encrypt your program first. There is no work around, please do not ask.
Q: Can I develop on ps2 without a mod.
A: Yes, but its more diffictult to boot your own code with a knife in the drive! (proced at your own risk)
Q: Can we send you pirate software by 3rd party companys.
A: No, such requests will not be welcome and could get you reported to said 3rd party company and your ISP.
Section 1: Background
---------------------
There are several ways to get into Legal PS2Dev
i) If sony gives you a licence (after you sign the NDA) then you will get a nice T10K dev kit, DEBUG and other TEST
machines.
ii) Download the 100% legal GNU compiler and linker packages from our site above and install them on your machine as detailed
in later sections.
They fully support the MIPS R5900 EE cpu and also the IOP. These sources came into our hands thanks to snsys.com and
the GPL. (see mailing list archive for full info if interested)
iii) There could be illegal solutions to these problems, but then we are not the right people to ask about that
New people to this scene are welcome, but people who want to go the illegal route need not apply. Kindly push / hold
the power button on your computer for 10 seconds, then release and do not come back to this site again. Thank you.
Section 2: Setting up the compilers
-----------------------------------
Any UN*X machine should work with this, even Cygwin.
If using Cygwin see
ps2dev.livemedia.com.au/ All cygwin info is from oobles.
It's based on Oobles info, my info, csh and comments from ppl in #ps2dev and the ps2dev email list.
I'm using Mandrake so install gperf as its not installed as standard on mdk
All files should be located as following, currently everyone uses different Makefiles and directory
structures follow this as a guide, it eases devlopment if everyone follows a standard.
[ps2dev root]
/usr/local/ps2dev/ (this is a symbolic link to the current libary src, a al linux src)
/usr/local/ps2dev/bin/ (misc binaries)
/usr/local/ps2dev/ee/ (ee compiler etc)
bin, include, lib sub-dirs
/usr/local/ps2dev/iop/ (iop compiler etc)
bin, include, lib sub-dirs
/usr/local/ps2dev/ps2lib (this is a symbolic link to the current libary src, a al linux src)
common, inlcude, ee, iop
Libs are prebuilt by gustavo so should should not need to recompile. (perhaps you do
)
compiler dir "ee" could also be a symbolic link to the current compiler you are using etc
build the files as follows
mkdir /usr/local/ps2dev
mkdir /usr/local/ps2dev/bin
Now, setup the paths, make a file /etc/profile.d/ps2dev.sh etc
If your setup different, you could put it in $HOME/.bash_profile
vi /etc/profile.d/ps2dev.sh
PS2DEV=/usr/local/ps2dev
EE=$PS2DEV/ee
IOP=$PS2DEV/iop
PS2LIB=$PS2DEV/ps2lib
PATH=$PATH:$PS2DEV/bin:$EE/bin:$IOP/bin
export PS2DEV EE IOP PS2LIB PATH
if you need compile as r00t check your .bash_profile file to make sure it does not overwrite the PATH
You can install to other paths, such as your home dir if you do not own the machine you are developing on.
Makesure you set the correct paths and then export them to your bash shell, as these variables are now
used to standardise the commands used in Makefiles etc. Then of cause your $HOME will need to be mounted
with the exec option, often $HOME is mounted with noexec for security.
Installing the EE Compiler
--------------------------
Get
ps2dev.sourceforge.net/downloads/ee/gnu-ee-binutils-gcc-1.1.tar.gzCygwin users ONLY. In the Cygwin shell do the following:
cd gnu-ee-binutils-gcc
mkdir intl
cd intl
cp /gettext-0.10.35/intl/libintl.dll.a ./libintl.a
cd ~
Cygwin users ONLY. Now we need to modify one file to stop a linking problem later. Using vi, notepad, edit or other text
editor open the file "gnu-ee-binutils-gcc/gas/listing.c" and search for 'isascii'. Remove the two underscores at the start
of the word (ie '__isascii (c)' becomes 'isascii (c)'). Save the file. Note In notepad you the fill will have no carriage returns
only square blocks.
The EE cpu is a little endian 64bit mips cpu (elf32l5900)
./configure --prefix=$EE --target=mips64r5900-sf-elf
make LANGUAGES="c"
make install
sce and sky are "vendor names" (in the middle of the target) used by sony and SN Systems, we are using sf for our standard
version.
Some files don't have the ee prifix so we create symbolic links, better than just copying the file SN style
cd $EE/bin
ln -s mips64r5900-sf-elf-addr2line ee-addr2line
ln -s mips64r5900-sf-elf-ar ee-ar
ln -s mips64r5900-sf-elf-as ee-as
ln -s mips64r5900-sf-elf-c++filt ee-c++filt
ln -s mips64r5900-sf-elf-gasp ee-gasp
ln -s mips64r5900-sf-elf-gcc ee-gcc
ln -s mips64r5900-sf-elf-ld ee-ld
ln -s mips64r5900-sf-elf-nm ee-nm
ln -s mips64r5900-sf-elf-objcopy ee-objcopy
ln -s mips64r5900-sf-elf-objdump ee-objdump
ln -s mips64r5900-sf-elf-protoize ee-protoize
ln -s mips64r5900-sf-elf-ranlib ee-ranlib
ln -s mips64r5900-sf-elf-readelf ee-readelf
ln -s mips64r5900-sf-elf-size ee-size
ln -s mips64r5900-sf-elf-strings ee-strings
ln -s mips64r5900-sf-elf-strip ee-strip
ln -s mips64r5900-sf-elf-unprotoize ee-unprotoize
The compiler internally uses the long version for some commands but us humans prefer the short version.
now compile the crt0.s from funslower
ee-as -mcpu=5900 -EL crt0.s -o crt0.o
cp crt0.o $EE/mips64r5900-sf-elf/lib
of use the precompiled one included with ps2lib
cd $PS2LIB/ee/lib
cp crt0.o $EE/mips64r5900-sf-elf/lib/
This is so that so that ee-gcc (which calls ee-ld) can find it
*note if you call ee-ld sometimes it will not find it. Any oen know why? or if there is a config file
to specify which dir to check for linking?
avoid linking with this each time -L$EE/lib/gcc-lib/mips64r5900-sf-elf/2.9-ee-991111b
by copying the lib into the $PS2LIB dir
cp $EE/lib/gcc-lib/mips64r5900-sf-elf/2.9-ee-991111b/libgcc.a $PS2LIB/ee/lib
then you can avoid this error during compilation
"ee-ld: cannot open -lgcc: No such file or directory"
Once everone one "standardises" their dir structure it will be simpler to give out
source and get it compiled quickly on other peoples machines. Assuming you the
reader of this guide is not one of the people who release binary only programs.
Until then some examples of hacks to get code to compile
A linkfile is required as well, use the "linkfile" from funslower again.
add -Tlinkfile to the Makefile linking command as required or copy to a path and give the full path each time.
There are often dependency problems as well so do something like
hello_LDADD = -lc -lm -lkernel -lc
You will need to change a few Makefiles eg pukkos one, we will probably host working versions on sourceforge
PSX2LIBDIR = $PS2LIB
LIBDIR = -L. -L$(PSX2LIBDIR)/ee/lib \
-L$EE/lib/gcc-lib/mips64r5900-sf-elf/2.9-ee-991111b
ps2lib by gustavo scotti Makefiles need modifying, this below is done by default in the SF tgz.
DEFS = -I. -I$(top_builddir)/include -I../include -I $(EE)/include
Installing the DVP Assembler
----------------------------