GP2X .gpu = Shell Script


Titousensei

Still Fresh
Joined
Nov 27, 2005
Messages
33
Hi,

I've been trying what everybody tried lately (firmware update, etc) without much success; played music and movies, those are OK. So I figured I might as well do something different until the dust settles.

Looking at the .gpu file from patch20051117.gpu and the SDL install_libs.gpu, I noticed they are shell scripts. I would like to use that to explore the GP2X. But I have a problem: only patch20051117.gpu seems to work (at least it returns to the menu); every other script I tried gives me a black screen and I have to reboot, including the SDL install libs (so, no games for me until I figure that out).

Even the smallest script doesn't work.

Here's patch20051117.gpu:

#!/bin/sh
cp EBookViewer /usr/gp2x
cp MusicPlayer /usr/gp2x
cd /usr/gp2x
./gp2xmenu

This one returns to the menu after a few seconds. I guess the copy was successfull. Even if the files are not present it returns, so a bug is not enough to freeze the machine with a lack screen.

Now here's install_libs.gpu:
#/bin/sh
tar -zxvf /mnt/sd/install_libs.tar.gz -C /
cd /usr/gp2x
./gp2xmenu

Notice the missing she-bang (fixing #! doesn't change a thing). This script freezes my machine with a black screen. Even after several minutes, I have to reboot the machine.

These 2 scripts are already giving a few information about the filesystem: /mnt/sd and /usr/gp2x are interesting paths.

I tried the smallest script:
#/bin/sh
cd /usr/gp2x
./gp2xmenu

Nothing, I had to reboot.

I'd like to do an ls -Rl / > /mnt/sd/ls-Rl.txt to get the list of exectables. I guess ls exists because I heard the GP2X uses busybox.

Did you guys try something similar with more luck?

Thanks.
 
The shebang appears not to be required.

Code:
ls / > /mnt/sd/root.txt
sync
cd /usr/gp2x/
/usr/gp2x/gp2xmenu

Works fine for me.
 
As it turns out, I was editing my files on windows and the CRLF seem to make the GP2X very unhappy. The same files as unix text (LF only) work fine.
 
As it turns out, I was editing my files on windows and the CRLF seem to make the GP2X very unhappy. The same files as unix text (LF only) work fine.

Try using a programmer's text editor under Windows. That should solve your problems right there I would bet. I recommend Textpad, but it's not free. Just Google "Windows programmer text editor" and you should be all right.
 
Last edited by a moderator:
Others suggested Editpad, which is the one I was using. But you cannot use Save, you have to use Export -> Unix.

I used Crimson Editor, a very nice freeware, for my work coding. It has a unix setting for the text files.

If you have cygwin installed, you can also use dos2unix before copying your scripts.

Thanks everydbody for your help.
 
Back
Top