forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adventures with PSPSDK and psplink on MacOS X

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
MagerValp



Joined: 20 Jul 2007
Posts: 10

PostPosted: Tue May 27, 2008 9:48 pm    Post subject: Adventures with PSPSDK and psplink on MacOS X Reply with quote

I worked on getting the latest svn versions of the toolchain to run on my mac yesterday, and got nearly all the way. I'm hoping that someone here can help me get the last few things running.

The first problem is that binutils 2.16.1 doesn't compile on MacOS X 10.5 (leopard). A bug in autoconf makes it erroneously detect .dSYM as the extension for executable files, when gcc is called with -g. The workaround is to set an explicit CFLAGS to the beginning of toolchain.sh, like so:

Code:
#!/bin/bash
# toolchain.sh by Dan Peori (danpeori@oopo.net)

# automake fails on MacOS X 10.5 with -g flag
export CFLAGS="-O2"

 ## Enter the psptoolchain directory.
 cd "`dirname $0`" || { echo "ERROR: Could not enter the psptoolchain directory."; exit 1; }
...snip...


The second problem is that gprof has text files with a .m extension, that get translated into C. Apple's gmake thinks that .m files are Objective-C files, and tries to compile them, which fails miserably. There's a simple Makefile workaround in later versions of binutils, that can be backported. Add two new sections to patches/binutils-2.16.1-PSP.patch like so:

Code:
diff -burN binutils-2.16.1/gprof/Makefile.am binutils-psp/gprof/Makefile.am
--- binutils-2.16.1/gprof/Makefile.am  2004-11-30 18:20:48.000000000 +0100
+++ binutils-psp/gprof/Makefile.am 2007-08-13 03:51:51.000000000 +0200
@@ -38,6 +38,9 @@
 
 diststuff: $(BUILT_SOURCES) info $(man_MANS)
 
+# This empty rule is a hack against gmake patched by Apple.
+%.o:%.m
+
 .m.c:
    awk -f $(srcdir)/gen-c-prog.awk > ./$*.c \
        FUNCTION=`(echo $*|sed -e 's,.*/,,g' -e 's/_bl//')`_blurb \
diff -burN binutils-2.16.1/gprof/Makefile.in binutils-psp/gprof/Makefile.in
--- binutils-2.16.1/gprof/Makefile.in   2004-11-30 18:20:48.000000000 +0100
+++ binutils-psp/gprof/Makefile.in   2008-05-26 12:24:11.000000000 +0200
@@ -774,6 +774,9 @@
 
 diststuff: $(BUILT_SOURCES) info $(man_MANS)
 
+# This empty rule is a hack against gmake patched by Apple.
+%.o:%.m
+
 .m.c:
    awk -f $(srcdir)/gen-c-prog.awk > ./$*.c \
        FUNCTION=`(echo $*|sed -e 's,.*/,,g' -e 's/_bl//')`_blurb \


After that it builds all the way up to psplinkusb's remotejoy. The psplink Makefile tries to decide if it's running under linux, and if so it builds the SDL version, otherwise it goes to the default Windows version. The check just looks for /usr/include/SDL/SDL.h, which fails. At this point I just went ahead and compiled it manually, but testing for the existence of the sdl-config command should work on all platforms with SDL installed:

Code:
if which sdl-config &> /dev/null; then { $(MAKE) -C tools/remotejoy/pcsdl all; } else { $(MAKE) -C tools/remotejoy/pc all; } fi


So far so good - after this toolchain.sh successfully installs for me. Second half with psplink woes will have to wait until I've made lunch for my son :)
Back to top
View user's profile Send private message Visit poster's website
MagerValp



Joined: 20 Jul 2007
Posts: 10

PostPosted: Tue May 27, 2008 10:53 pm    Post subject: Reply with quote

OK, so, if anyone wants to try the patches on osx, or maybe confirm that they don't break on Linux or Windows, that would be great. On to psplink.

On MacOS X 10.4 I used the 20070626 snapshot of the toolchain, and psplinkusb checked out from svn around the same time. It worked great on 3.40OE and 3.52M33 on my fat PSP.

I compiled psplinkusb and installed the files from release_oe on my fat now running 3.90M33-3. When I start psplink I get nothing but a black screen. When I start usbhostfs_pc -vv on the Mac, the PSP shuts down. People on #pspdev says that psplinkusb svn checked out yesterday works on their machines running 3.90, so I'm not sure what to make of it.

I then tried http://www.luaplayer.org/pspsdk-image.rar with VirtualBox. Unfortunately VirtualBox crashes hard when I try to access the PSP - I couldn't even get the files copied over to the memory stick. Too bad, as a shrinkwrapped development VM seemed like a really good idea.

As a last resort I installed minpspw under Parallels, which got me a little further. psplink starts up with the proper message, usbhostfs_pc -vv connects to the device, and pspsh gives me a prompt. ls works, and I can list files on the memory stick, but cd and trying to run things gives me the error: invalid magic: 4F42452F.

I'm not quite sure what to try next. There's iR Shell, but it has issues with 3.90, and I'm wary about replacing the XMB. If someone would be willing to zip up the latest psplinkusb from svn, I'd love to try that.

Is anyone here running psplinkusb on osx, and if so, how? :)
Back to top
View user's profile Send private message Visit poster's website
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Wed May 28, 2008 12:51 am    Post subject: Reply with quote

Works fine for me on Tiger.
Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Wed May 28, 2008 4:45 am    Post subject: Reply with quote

Seems to build and work fine under Ubuntu, so I've committed the changes to psptoolchain and psplinkusb.
Back to top
View user's profile Send private message Visit poster's website
MagerValp



Joined: 20 Jul 2007
Posts: 10

PostPosted: Wed May 28, 2008 4:47 am    Post subject: Reply with quote

Great, thanks.
Back to top
View user's profile Send private message Visit poster's website
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Wed May 28, 2008 4:50 am    Post subject: Reply with quote

Thanks for doing the hard work, I had been meaning to get around to it for a long time now. :)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group