Tutorial: How to setup a ps2dev env in cygwin

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Tutorial: How to setup a ps2dev env in cygwin

Post by Lukasz »

Update #2
I've now written a full tutorial on how to install the toolchains in cygwin using toolchain.sh. http://ps2dev.lukasz.dk/cygwintutorial.html


Updated - No longer supported

This small tutorial will show you how to setup a ps2dev env in cygwin.

First of all you need to install cygwin with http://www.cygwin.com/setup.exe.

Now download this file http://cygwin.lukasz.dk/cygwin-toolchain.sh and save it in a directory in cygwin (home dir for instance) and now log into cygwin and change to the directory where you have downloaded the file to and type ./cygwin-toolchain.sh (use TAB for autocompletion). This script does not compile anything, it just downloads and extracts the binaries.

This script will now download and install the ps2dev (ee toolchain, iop toolchain, dvp toolchain, ps2sdk CVS build and ps2client) env and setup the necessary env vars ($PS2DEV, $PS2SDK and change $PATH).

Its all installed in /usr/local/ps2dev and you can test it by typing 'ee-gcc -v' and you will see that ee-gcc is installed. I've tested the script and everything should be working.

If any one wants to use this script for other systems or if they want to mirror the toolchains, please see the cygwin-toolchain.sh for instructions.

Old cygwin setup files
For those interested in how to make setup files which can be used with setup.exe from cygwin.com. You can grab those files here:
http://www.lukasz.dk/files/setup.bz2
http://www.lukasz.dk/files/setup.ini
Last edited by Lukasz on Tue Dec 13, 2005 7:12 am, edited 5 times in total.
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

LOL this looks too easy...

edit:
I just did this update it from a clean cygwin + cygwin/x install and here is what I learned:
-make sure you log into cygwin at least once so it creates your home dir
-for whatever reason it showed all packages like I was doing the install from scratch (except the stuff I installed were marked keep instead)

When I tried to add this in on a clean install I wound up with a unhandled Win32 exception from setup.exe with the following in the cygwin setup window:
Installing
dvp-2.14-041130
/etc/postinstall/dvp-toolchain.sh
package: 0%
Total 25%
(approx. values of the progress bars)

perhaps I have left out some vital package on my install like sh or something but I doubt it...
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post by Lukasz »

Thanks for your response.

For postinstall all you should need is echo, sh and grep, since thats what I use in the postinstall script.

Its best to update/clean install your cygwin with these utils and then install the provided packages. Could look like my packages get installed before the utils mentioned above get installed/updated and therefor setup.exe crashes.
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

setup.exe is crashing on each of the individual packages (which I only tried to install once I made sure cygwin was working fine) when it gets to the etc/sh file, even though I have the commands echo, sh and grep installed.

I tried reinstalling cygwin again, and doing the packages agian, but the only way I have been able to get them to add the PATH is to extract the .sh file and sh file.sh (run) it directly from bash. (all the toolchain files extracted into their dirs just fine, but the sh + setup.exe is what seems to be causing the problem here)

Im stumped, about the only thing that I did differently is that I used the newest setup from cygwins site, perhaps something got broken in their last update of it with relation to the etc files?

I like the idea though of not having to build the entire toolchain whenever it is updated (although oopo's work helps to fix that) so this is great anyways.

After running the .sh files I get (to ee-gcc -v : gcc version 3.2.2 but just an error before the PATH was appended)

Edit: justaboutforgot to mention - Thanks Lukasz for your work on this!
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post by Lukasz »

Your problems got me thinking that it maybe be best to not use setup.exe because I myself also had problems with setup.exe crashing when I was creating the setup files. And setup.exe isn't meant to be customized and why would I want to depend on a system which does nothing more than download and extact some files and run a simple script.

Therefor I've decided to not use setup.exe, but instead I've made a cygwin-toolchain.sh which does the same, download and extract and setup the ps2dev env.

I will be uploading the script and new .tar.gz files in some 10 hours time or so and I will also rewrite the tutorial. I will also make the files I've used to make the whole setup it "work" with setup.exe avaliable, if others what to pursue this direction. Until then, I will just leave everything, in case some one is already downloading or want to download.
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post by blackdroid »

fucking nice work :)
Kung VU
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

Wonderfull !!!

I remember having installed the whole stuff manually including the toolchain... I was still afraid to have to do it again (as it took me 2 days to get the whole thing running and most of all being able to compile shtg correctly...)

thx !
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

Nice one Lukasz, works great & thanks.

edit: just out of curiosity, would it be better to put the env. vars into a users .bashrc instead of the global bash.bashrc?
fr0st m0nkey
Posts: 10
Joined: Sun Jan 30, 2005 4:52 pm
Contact:

Post by fr0st m0nkey »

Do you think it would be possible if you showed us how to set up the PS2 Debugger through Cygwin?

PS2 Debugger
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

fr0st:
from the readme included with it, note the first line I put here. I personally would like to see a better open debugger (or an emulator+debugger for pc). Wouldnt it be nice to get a hold of the open source code from the official SCE dev pack? I think so.
This is only a proof of concept build, hacked up mercilessly, see the disclaimer.

I've insterted debug printfs too, making it ugly. To use, do the following:-

1. Copy mips64r5900-sf-elf-gdb.exe to you ee/bin folder (e.g. on my system it's c:\cygwin\usr\local\ps2dev\ee\bin).
2. Make a link with "ln -s mips64r5900-sf-elf-gdb.exe ee-gdb.exe" and you should be ready to go.

There's a ps2.cmd command file there to try out. It loads the stub, inserts a breakpoint and continues execution to that
breakpoint. Launch with "ee-gdb -x ps2.cmd".
fr0st m0nkey
Posts: 10
Joined: Sun Jan 30, 2005 4:52 pm
Contact:

Post by fr0st m0nkey »

When I tried to install this, I got this:

Code: Select all

wget: not found
Error: Please make sure you have 'wget' installed.
What should I do?
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Install wget... ? duh
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Kotti
Posts: 3
Joined: Tue Feb 01, 2005 7:24 am
Location: Kansas

Post by Kotti »

Why do I get a Permission Denied Error when I try to run the autobuild script?
fr0st m0nkey
Posts: 10
Joined: Sun Jan 30, 2005 4:52 pm
Contact:

Post by fr0st m0nkey »

How do I make a link?
2. Make a link with "ln -s mips64r5900-sf-elf-gdb.exe ee-gdb.exe" and you should be ready to go.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

fr0st m0nkey wrote:How do I make a link?
2. Make a link with "ln -s mips64r5900-sf-elf-gdb.exe ee-gdb.exe" and you should be ready to go.
with "ln -s mips64r5900-sf-elf-gdb.exe ee-gdb.exe"
Shoot Pixels Not People!
Makeshift Development
fr0st m0nkey
Posts: 10
Joined: Sun Jan 30, 2005 4:52 pm
Contact:

Post by fr0st m0nkey »

Do you mean type that in? It doesn't work for me when I try to type that out.
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

the link needs to be in the dir with the file (the bin dir which is on the path in cygwin at least)
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

Here is a small script based on ooPos script that will update&reinstall the PS2SDK to whatever is currently in the cvs, of course you need cvs and make installed in cygwin to use this script.

ps2sdkupdate.sh
just download it, put it in your cygwin dir and run it with "sh ps2sdkupdate.sh"
User avatar
Thanhda
Posts: 331
Joined: Sat Apr 09, 2005 2:08 am
Location: Canada
Contact:

Post by Thanhda »

cory1492 wrote:Here is a small script based on ooPos script that will update&reinstall the PS2SDK to whatever is currently in the cvs, of course you need cvs and make installed in cygwin to use this script.

ps2sdkupdate.sh
just download it, put it in your cygwin dir and run it with "sh ps2sdkupdate.sh"
says error building, do i need to install the ps2dev sdk first into the home/ dir?
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post by Lukasz »

Ive updated the toolchains, read more at www.lukasz.dk
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

nice one lukasz, thanks! I updated my script up above today as well, to clean out the old sdk dirs (but leave ports dirs intact) but I imagine yours is better.
Steve F
Posts: 75
Joined: Wed Apr 27, 2005 2:30 am
Location: Texas USA

Post by Steve F »

Hey Lukasz,

I followed the instructions at the beginning of the post. Didn't work. Took awhile to figure out there was some manual setup required and the instructions were listed elsewhere. (use-newiop.sh or use-oldiop.sh and setting up the symlinks /bin/mkdir -> /bin/cyg-mkdir, ...rmdir, and echo.

Would it be a good idea to put a message at the end of cygwin-toolchain.sh stating there are more things to do or actually list the remaining settings needed?

Thanks, I appriciate not having to fiddle for days or weeks. Besides the download time for cygwin it only took about an hour to get to the ps2sdk-update.sh part and that is still running (so far without any errors).
Compound
Posts: 48
Joined: Thu May 12, 2005 10:29 am

Post by Compound »

there should be no manual setup required, the only thing i did have to do was set an enviroment variable (in mycomp->properties) PS2DEV C:\cygwin\usr\local\ps2dev.
Steve F
Posts: 75
Joined: Wed Apr 27, 2005 2:30 am
Location: Texas USA

Post by Steve F »

Well, the symlinks could be setup from the script. Choosing new or old iop would have to be a prompt or at least a message saying what to do, why and how.
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post by Lukasz »

For the next update of the toolchain I will include a readme on how to use the toolchain after install and also make more of the process automatic, like calling the ps2sdk-update and use-oldiop script at the end of the toolchain script.

Thanks for the feedback guys :)
Steve F
Posts: 75
Joined: Wed Apr 27, 2005 2:30 am
Location: Texas USA

Post by Steve F »

I set up cygwin. I ran cygwin-toolchain.sh. Then in ps2dev/bin I ran use-oldiop.sh. When I tried to run ps2sdk-update.sh it fails with cannot cd to ps2sdk. I found in the script two lines commented out;

## Remove any previous builds.
# rm -Rf ps2sdk

## Check out the latest source.
# cvs -d $CVSROOT checkout ps2sdk

## Enter the source directory.
cd ps2sdk

The 'cd ps2sdk' fails because the cvs never runs?
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

It certainly looks that way to me.
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

Thanhda wrote:
cory1492 wrote:Here is a small script based on ooPos script that will update&reinstall the PS2SDK to whatever is currently in the cvs, of course you need cvs and make installed in cygwin to use this script.

ps2sdkupdate.sh
just download it, put it in your cygwin dir and run it with "sh ps2sdkupdate.sh"
says error building, do i need to install the ps2dev sdk first into the home/ dir?
You need the ee/iop toolchain installed and the paths setup to them properly to have access to ee-gcc and iop-gcc or the SDK will not build. If you already do have such done, then let me know the specific error and I will see if I can figure out why its happening (although ooPo and Pixel are MUCH better at that sort of thing than I am)

lukasz has prebuilt binaries of the toolchain and on a new install with his it wasn't always the most recent release of the SDK - BUT he has since incorporated this idea, so see his website for his toolchain/sdk builder.

I use it to refresh/rebuild my SDK, cleaning up all the garbage first so everything is new (except the ports)

compound: if you are using cygwin you can also set cygwin only environment vars in your homedir's .bashrc or in /etc/bash.bashrc instead of cluttering you path in windows.

this is what the inside of my bash.bashrc file under cygwin looked like before I moved on to debian:

Code: Select all

# base-files version 3.2-1

# System-wide .bashrc file
## ps2dev env vars
export PS2DEV=/usr/local/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
snowdog
Posts: 5
Joined: Wed Jun 15, 2005 1:43 am

Post by snowdog »

pixel wrote:Install wget... ? duh
I got the same error message as fr0st. Haven't used Unix for around 15 years! Where do we find wget and how do we install it? :o/
"You can keep all your Bests, Peles and Maradonas, Duncan Edwards was the greatest of them all!" - Tommy Docherty
snowdog
Posts: 5
Joined: Wed Jun 15, 2005 1:43 am

Post by snowdog »

Doh!!! Just realised my mistake! Just had everything set to default, changed it to Install for everything. Shouldn't have any more problems now hopefully ;o)
"You can keep all your Bests, Peles and Maradonas, Duncan Edwards was the greatest of them all!" - Tommy Docherty
Post Reply