Additions to build.mak for kxploit without corrupted data

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

Moderators: cheriff, TyRaNiD

Post Reply
woog
Posts: 1
Joined: Tue Aug 16, 2005 10:01 am
Location: san diego

Additions to build.mak for kxploit without corrupted data

Post by woog »

This adds targets to build.mak for kxploit with corrupted data hidden and for automated installation to PSP.

For example, to compile and install on PSP with corrupted data hidden (use the appropriate destination directory for your system):
make kxploit2-install INSTALL_DIR=/media/usbdisk/psp/game

Code: Select all

--- build.mak   2005-08-17 12:10:42.000000000 -0700
+++ mine/build.mak      2005-08-17 12:10:10.000000000 -0700
@@ -90,6 +90,19 @@
 FINAL_TARGET = $(TARGET).elf
 endif
 
+ifndef TARGET_LONG
+TARGET_LONG:=$(TARGET)_________________________________1
+endif
+
+ifndef TARGET_BASE
+TARGET_BASE:=$(strip $(shell echo "$(TARGET_LONG)" | sed -e 's/\(.\{6\}\).*/\1/'))
+endif
+
+ifndef TARGET_SHORT
+TARGET_SHORT:=$(TARGET_BASE)~1%
+endif
+
+
 all: $(EXTRA_TARGETS) $(FINAL_TARGET)
 
 kxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
@@ -100,6 +113,27 @@
                $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1)  \
                $(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
 
+kxploit2: $(TARGET).elf $(PSP_EBOOT_SFO)
+       mkdir -p "$(TARGET_LONG)"
+       $(STRIP) $(TARGET).elf -o $(TARGET_LONG)/$(PSP_EBOOT)
+       mkdir -p "$(TARGET_SHORT)"
+       $(PACK_PBP) "$(TARGET_SHORT)/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON)  \
+               $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1)  \
+               $(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
+       @echo "copy $(TARGET_LONG) to psp before $(TARGET_SHORT)"
+
+install-dir-check:
+       test "x$(INSTALL_DIR)" != "x" && test -d "$(INSTALL_DIR)"
+
+kxploit-install: kxploit install-dir-check
+       cp -rf "$(TARGET)" "$(TARGET)%" "$(INSTALL_DIR)"
+
+kxploit2-install: kxploit2 install-dir-check
+       cp -rf "$(TARGET_LONG)" "$(INSTALL_DIR)"
+       sync
+       cp -rf "$(TARGET_SHORT)" "$(INSTALL_DIR)"
+       sync
+
 $(TARGET).elf: $(OBJS)
        $(LINK.c) $^ $(LIBS) -o $@
 
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

This was rejected once before ... installation targets don't belong in build.mak.
holger
Posts: 204
Joined: Thu Aug 18, 2005 10:57 am

Post by holger »

hi,

I commited a psp-install script, similiar to GNU install to the pspgl/tools/ directory: http://svn.ps2dev.org/filedetails.php?r ... v=904&sc=0

The script is controlled via environment variables, simply export your PSP_REVISION and your PSP_MOUNTDIR in your .bashrc (or whatever shell config file you are using).

Using this and the psp-setup.c hook you can compile&install existing (well-written, prepared for cross-compilation) packages with no or minimal changes, you basically need to overwrite only the used environment variables before calling "configure" or "make":

CC=psp-gcc LD=psp-gcc INSTALL=psp-install LFLAGS="-DMODULE_NAME=name psp-setup.c (other linker flags follow)"

hope you find it useful, with this the existing Makefiles and build rules can become somewhat simplified.

Holger
Post Reply