Startup from nothing, Ubuntu + PSP devkit. HELP!

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Shaker
Posts: 3
Joined: Wed Jul 25, 2007 6:15 pm
Contact:

Startup from nothing, Ubuntu + PSP devkit. HELP!

Post by Shaker »

Hi there.
I'm new to the PSP development community, and I am as new to Linux. I've been using Windows and I am no computer noob, but I completely do not understand Linux and I don't know if I will ever like it :D

I've read so many threads now and hints and howto's, and I finally managed to install a few prerequisites now, but ... still there are a lot of hang-ups, so any help that doesn't confuse me more is very apreciated ;)

1) What exactly do I need, if I want to write a program and compile it and pack it to get a PBP for the PSP? I think it is the toolchain and die PSPSDK, which I have downloaded.

With the Package-manager I have installed autoconf, automake, m4, gcc, texinfo, wget, bison, ncurse and subversion, which are said to be necessary.

2) How exactly do I set up the environment. PSPDEV=... I've read stuff about startup-script, the .bash-profile and so on. Confused! Where exactly do I put the correct lines and what do they look like? set PSPDEV in the terminal does NOT work. Dependency check fails.

3) Which has to be installed first? toolchain or pspsdk? What does each of them offer ?

4) Where can I find a tutorial, a good step-by step tutorial with a working example for the first program ever to be written with these tools and run on the PSP? I'd like to know what is necessary that a C program would run on the PSP. Special named functions, includes, main routines objects, that have to be initialized... whatever.

THANKS A LOT!!! :)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

In Ubuntu, use Synaptic as your package manager. It's a nice point-n-click gui for the package system, and will automatically handle any dependencies for packages you select.

Packages to select in Synaptic: autoconf, autogen, automake, bison, flex, imagemagik, libsdl, libtool, ncurses, patchutils, pkg-config, subversion, texinfo, and wget. Make sure gcc and g++ are also selected, of course.

The exports are:

Code: Select all

export PSPDEV="/usr/local/pspdev"
export PSPSDK="$PSPDEV/psp/sdk"
export PSPPATH="$PSPDEV/bin:$PSPDEV/psp/bin:$PSPSDK/bin"
export PATH="$PATH:$PSPPATH"
You enter those lines into the shell before doing anything.

You run the toolchain.sh script first, which will build the toolchain and then the needed sdk libs. Note, it doesn't make ALL the libs. You'll need to compile SDL and various other libs after that.

Here's what you do after installing all the packages with Synaptic:

Code: Select all

sudo mkdir -p /usr/local/pspdev
sudo chmod a+rwx /usr/local/pspdev
sudo chown username:groupname /usr/local/pspdev
svn co svn://svn.ps2dev.org/psp/trunk/psptoolchain
cd psptoolchain
./toolchain.sh
username:groupname is YOUR username and groupname for your user account. For example, mine is "jlf65:jlf65". If you aren't sure, just do a "ls -l" of you user folder and look at who the owner of stuff is listed as. That'll be you. :)
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Actually, if you're using Ubuntu you can use the toolchain-sudo.sh script to make it easier:

Code: Select all

svn export svn://svn.ps2dev.org/psp/trunk/psptoolchain
cd psptoolchain
sudo ./toolchain-sudo.sh
The reason for this wrapper script is because sudo clears your path when you run it. This wrapper resets the path and then runs the process normally, as root. No need to fool with permissions. You'll still have to install the packages and set up your environment as stated in the readme.txt, though.

The psptoolchain package installs the toolchain (binutils/gcc/newlib) as well as the latest version of the pspsdk. You can then download and install other libraries as needed, like SDL.
Shaker
Posts: 3
Joined: Wed Jul 25, 2007 6:15 pm
Contact:

Post by Shaker »

Hi again.

Thanks for the quick help! I've just tried the Synaptic thing and selected a few of the required packages and had to notice, that the gcc base has been installed, but the gcc bin was not. Similar to ncurses.
Before, I intended to install the newest versions from ftp.gnu.org, but they are all sources... :)

Then I did this export thing. Before I read something about
SET ...
and THEN
EXPORT which did not work at all. The export commands you wrote worked now!

Is it correct to put them into the .bash_profile?

I installed the toolchain 20070626 directly as root but without subversion. It finished without error.

Now, having tried to install die PSPDSK1.0-beta I got an error message about a double definition, which I cannot locate. To me there is no double-definition in the .h or .c files... strange.
But - you said, the PSPSDK is included in the toolchain???

How can I test that? What commands must work, if I really have the pspsdk? What I don't have is the /usr/local/pspdev/psp/sdk/bin folder. The bin is not there...

Anyway: What do I do with this error? It occurs after some time that I've executed "make" without any parameters, as I was told by the readme:

Code: Select all

psp-gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../src/libc/include -I../../src/base -I../../src/kernel -I../../src/user -I../../src/debug -g -O2 -G0 -Wall -DF_atoi stdlib.c -c -o atoi.o
stdlib.c:125: Fehler: redefinition of »atoi«
./stdlib.h:100: Fehler: previous definition of »atoi« was here
make[3]: *** [atoi.o] Fehler 1
make[3]: Verlasse Verzeichnis ′/home/satria/Downloads/pspsdk_1.0-beta2/src/libc′
make[2]: *** [all-recursive] Fehler 1
make[2]: Verlasse Verzeichnis ′/home/satria/Downloads/pspsdk_1.0-beta2/src′
make[1]: *** [all-recursive] Fehler 1
make[1]: Verlasse Verzeichnis ′/home/satria/Downloads/pspsdk_1.0-beta2′
make: *** [all] Fehler 2
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

ooPo wrote:Actually, if you're using Ubuntu you can use the toolchain-sudo.sh script to make it easier:

Code: Select all

svn export svn://svn.ps2dev.org/psp/trunk/psptoolchain
cd psptoolchain
sudo ./toolchain-sudo.sh
The reason for this wrapper script is because sudo clears your path when you run it. This wrapper resets the path and then runs the process normally, as root. No need to fool with permissions. You'll still have to install the packages and set up your environment as stated in the readme.txt, though.

The psptoolchain package installs the toolchain (binutils/gcc/newlib) as well as the latest version of the pspsdk. You can then download and install other libraries as needed, like SDL.
If you noticed in my list of commands, I chown'd the pspdev directory. That means never having to ever do sudo again. I'm doing that on my own system now. It's a lot easier to do those libs now - just make, then make install and don't worry about needing superuser to install since I own that particular directory. No need to worry about sudo clearing the environment either.
Shaker
Posts: 3
Joined: Wed Jul 25, 2007 6:15 pm
Contact:

Post by Shaker »

I simply gave anyone rwx rights on the target directory, but still installed as root, because... sometimes I heared tools complain "must be installed as super user"... :)

So, but what about my error in my previous post?
pspwill
Posts: 51
Joined: Thu Nov 17, 2005 8:07 am

Post by pspwill »

I added the environment variables to /etc/environment on mine and then ran toolchain-sudo.sh and everything worked fine for me.
Post Reply