Sunday 29 January 2012

PSP Linux guide and C applications.

The PSP linux project is a project for running Linux on PSP.

Here is some information about PSP Linux.

-------------------------------------------------------------------------------------------------------------------------------------

PSP Linux to a usable uClinux OS
Part 1: Toolchain
The Toolchain is an important piece when you are going to cross-compile. It lets you compile for another cpu instead of your host cpu,in this case we are going to compile from i686-gnu-linux to mipselnommu-uclibc-linux. The toolchain consists from GNU binutils and other programs that are needed for cross-compiling like gcc,make and make. You can add other libraries but shared libraries will not work. There is the option to download the toolchain from https://sites.google.com/site/linuxonpspproject/. The website has the toolchain,uclinux for psp binaries,buildroot patches,kernel installation instructions and Busybox installation instructions.
Part 2: PSP hardware and uClinux
The Cpu of the psp is an mips R4000 without mmu (mipselnommu).The current kernel is 2.6.22-uc1.
Devices that work:
Basic Framebuffer
Keyboard
Mouse
Memory Stick
We have some useful stuff working. The Basic Framebuffer is the only video driver we have for output, the device is listed under /dev/fb0. Now we also have the memory stick working which is great because now we have a simple way to run binary on the psp. The memory stick will be mounted under /ms0 if you have one partion. An on-screen-keyboard is very useful because we can input text it and it we can interact with it by the psp buttons. Last but not least is the mouse driver which isn’t that useful but once a gui is running we can interact with it like we were using a normal computer. The uClinux website is http://www.uclinux.org/.
Part 3:Compiling and DSLinux
To compile a simple hello world program like this:
main()
{
printf("hello, world\n");
}

You need to compile it like this:
mipsel-linux-gcc -static -Wl,-elf2flt -fno-jump-tables hello.c -o hello

mipsel-linux-gcc is the type of gcc we are going to compile with. The –static option is there because on nommu systems we can’t use shared libraries. Shared libraries are parts of a program that don’t load in the actual binary but separately in RAM.The –Wl,-elf2ftl option is to turn the binary from an elf image to a flat binary. The –fno-jump-tables option is there
to prevent gcc from generating relocation entries of GPREL32 that is frequently used in jump tables. Now what do the PSP and DS have in common?


They are both nommu systems.
They both use their own Operating system.
They both run uClinux because of the lack of mmu.
They both use external storage. DS uses SD card and PSP Memory Stick
DS Linux is way ahead of PSPLinux but they are both unsupported.

To use ./compile scripts you need to copy the toolchain to /usr/bin. You also need to add the path of the cc1,cc1plus and cc2 binaries.
Example
./configure -host mipsel-linux
Then you need to edit to makefile to use these options -static -Wl,-elf2flt -fno-jump-tables. The options will compile the application for the mipsel-nommu platform.

That's it for now.
 ------------------------------------------------------------------------------------------------------------------------------------
Here are some pictures of it running programs:

1. Running an addition program on it.
 2. Displaying the 2 times table.
 3. Displaying a hello world program.
 4. Displaying /proc/cpuinfo.
I didn't port PSPLinux so don't ask me how I did it.
Ported by somebody named Jackson.





No comments:

Post a Comment