Compiling Ruby for cfw390

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Radek
Posts: 2
Joined: Mon May 19, 2008 3:42 am

Compiling Ruby for cfw390

Post by Radek »

I'm trying to build a Ruby for PSP slim with cfw390.
I found a http://forums.ps2dev.org/viewtopic.php?t=7550 , get the patch and it didn't work.

After some changes, in makefiles which I found elsewhere

Code: Select all

PSP_FW_VERSION=380
BUILD_PRX=1
I got to the error 0x8000200D9

Then I began palying with PSP_MODULE, PSP_MAIN and PSP_HEAP attributes. I ended with

Code: Select all

PSP_MODULE_INFO("RUBYTEST", 0x1000, 1, 1);

PSP_MAIN_THREAD_ATTR(0);
PSP_MAIN_THREAD_STACK_SIZE_KB(4096);

PSP_HEAP_SIZE_MAX();
Which ends with the same error.

You cen see the patch (ruby-1.8.6-p114.rh2.patch) and build script (build-psp.sh)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Code: Select all

PSP_MODULE_INFO("RUBYTEST", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
That's kernel mode. You need to be compiling as user mode.

Code: Select all

PSP_MODULE_INFO("RUBYTEST", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
User avatar
Radek
Posts: 2
Joined: Mon May 19, 2008 3:42 am

Post by Radek »

Changing to the usermode only by modifing line

Code: Select all

PSP_MODULE_INFO("RubyTest", 0, VER, REV);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
leads to different error code 0x8002013C (= Librarynotfound) which only confuse me.

Are there other changes I have to do to Makefile?

Code: Select all

  1 TARGET = rubytest
  2 OBJS = main.o
  3
  4 INCDIR =
  5 CFLAGS = -O2 -G0 -Wall -D_PSP_
  6 CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
  7 ASFLAGS = $(CFLAGS)
  8
  9 LIBDIR =
 10 LIBS = -lruby -lm
 11 LDFLAGS =
 12
 13 # EBOOT parameters
 14 EXTRA_TARGETS =         EBOOT.PBP
 15 PSP_EBOOT_TITLE =       RubyOnPSP $(shell date +%F\ %T)
 16 PSP_FW_VERSION =        380
 17 BUILD_PRX =             1
 18 # Add all the memory
 19 PSP_LARGE_MEMORY = 1
 20
 21 PSPSDK=$(shell psp-config --pspsdk-path)
 22 include $(PSPSDK)/lib/build.mak
-- Radek aka Anoq the Great Sorcerer of Calixtines, member of 1st Royal Guard "Slavic Wolves"
I'll find a way. Maybe I'll strangle them with their own intestines, it will count as a suicide.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Your latest error generally means you're trying to do kernel-mode functions inside a user-mode app. You need to find and remove the kernel-mode functions. They either need to be eliminated (by doing the function some other way), or moved into an external kernel-mode prx that you load and call from the user app.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

A quick search could point you in the right direction; just to give you some buzzwords, a quick walkthrough has been delineated in my quest for porting pikey and a simple but good example of kernel-mode prx into wich you can move your kernel functions could be my sio Driver:
quote from pikey porting discussion:
updated toolchain and sdk (now i'm using heimdall's 0.6 for win32)
placed fw_version = 390 in all makefiles
made sure all prx are in kernel mode
for all prx checked exported functions
surrounded all exported functions with the k1 stuff
checked compile-time constants for hooked functions' nids
simple sio console using prx to handle hardware-related functions:
http://www.ecando.it/files/pspAdvancedSio.zip
Post Reply