Showing posts with label psplinux. Show all posts
Showing posts with label psplinux. Show all posts

Friday, September 19, 2008

MINIGUI on psplinux




I got minigui running on the psplinux. Minigui runs on frame buffer and is being used for embedded gui. I was trying to get qt-embedded which also runs on framebuffer, but has much more features and api than minigui, the compilation went fine till linking stage and iam getting some (R_MIPS_CALL16 R_MIPS_GOT16 errors). I did a bit of google and found that these errors are related to ld scripts and memory locations. I was unable to get these problems solved.

Here is a link to the youtube video
http://www.youtube.com/watch?v=m3U10YopH-A

Saturday, August 30, 2008

Building linux for psp - busybox


Busybox provides many core linux utilities in a single package. Get a busybox 1.7.0 version from http://busybox.net/ .
Untar it and apply the busybox-0.21 patch from here http://jacksonm88.googlepages.com/linuxonpsp.htm
and copy the config file to /path/to/busybox/.config
use this command to customize the tools u need
make CROSS_COMPILE=mipsel-linux- LDFLAGS="-static -Wl,-elf2flt" CFLAGS="-fno-jump-tables" menuconfig

The -static option is because mmu-less systems dont support shared libraries, -Wl,-elf2flt says the compiler to convert the elf executable to flat which is supported by mmu-less systems. I didn't quite understand the use of -fno-jump-tables, but as it is mentioned in jacksons site "-fno-jump-tables is essential too as it tells gcc not to generate relocation entries of GPREL32 frequently used in jump tables".
Do the below command to locally install busybox into /path/to/busybo/_install
make CROSS_COMPILE=mipsel-linux- LDFLAGS="-static -Wl,-elf2flt" CFLAGS="-fno-jump-tables" install

If u want to install in another directory edit the install options for busybox with menuconfig.
next is we compile kernel and specify the busybox install

Sunday, August 24, 2008

Building linux for psp - getting toolchain / crosscompiler


Here i will explain how to get the psp-linux toolchain. Not that this is not the same toolchain which is used to compile homebrew applications.

1) Get the buildroot sutable for the patches 20071216
version ; but if u go to buildroot website u will not find this , so checkout a version from svn close to this
svn co --revision 20650 svn://uclibc.org/trunk/buildroot

2) Get the patches from http://jacksonm88.googlepages.com/linuxonpsp.htm

3) Edit the patches to match the location of the buildroot (where you save it)
for example if my location of build root is
/home/vijay/stuff/embeddedsystems/psplinux/buildroot/buildroot
u need to change the following in the patch file
/usr/src/buildroot/./toolchain_build_mipsel/gcc-4.2.1/libgomp/configure
to
/home/vijay/stuff/embeddedsystems/psplinux/buildroot/buildroot/toolchain_build_mipsel/gcc-4.2.1/libgomp/configure
edit all the patches as above

4) Now as mentioned here
http://jacksonm88.googlepages.com/linuxonpsp.htm
add $(BUILDROOT)/build_mipsel/staging_dir/usr/bin/ to your search PATH by
PATH=$PATH:/path/to/buidroot/
build_mipsel/staging_dir/usr/bin
This is during compilation of uclibc libraries. It searches the PATH variable for the mipsel-linux-gcc command. Basically when u type a command in terminal; linux system searches for that command in the locations defined in PATH variable.
Place the gcc,uclibc and elf2flt patches to

$(BUILDROOT)/toolchain/gcc/4.2.1/
$(BUILDROOT)/toolchain/uClibc/

$(BUILDROOT)/toolchain/elf2flt/
Buildroot applies these patches during build time
.

5)Apply the buildroot patch
cd /path/to/buildroot/
patch -p1 < /path/to/buildroot-20071216.linuxonpsppatch
Now it may compile that a particular file has not found manually enter the path, just give the complete path to the file

6) configuring builroot
copy the
buildroot-20071216-linuxonpsp.config to $(BUILDROOT)/
U need to change the .config file in the /path/to/buildroot folder with the above file ; this file contains the information about wht to build and all
cp /path/to/
buildroot-20071216-linuxonpsp.config /path/to/buildroot/.config
use the below command from /path/to/buildroot directory to customize the options
cd /path/to/buildroot
make menuconfig

7) configuring uclibc c library
use
make uclibc-menuconfig
this will download the uclibc-0.9.29 and start menuconfig for customizing the option; just exit menuconfig for now. and copy the uclibc-0.9.29-linuxonpsp.config to the $(BUILDROOT)/toolchain_build_mipsel/uClibc-0.9.29 folder
cp /path/to/
uclibc-0.9.29-linuxonpsp.config /path/to/buildroot/toolchain_build_mipsel/uClibc-0.9.29/.config
We will now again issue the make uclibc-menuconfig for customizing,
Select the below options

Target Architecture Features and Options --->
(/path/to/buildroot/toolchain_build_mipsel/linux/include)
String and Stdio Support --->
[*] Support Signed Characters In 'ctype.h' Functions.

ctype argument checking (Do not check -- unsafe) --->

uClibc development/debugging options --->
(/path/to/buildroot/build_mipsel/staging_dir/usr/bin/mipsel-linux-uclibc-)

This a resolves a error later, Enable any other options/support u require and exit the menuconfig
Now u are ready for buildind the toolchain.

8) Start building toolchain/cross compiler
cd /path/to/buildroot make source make

9) Possible problems and solutions
As mentioned here
http://jacksonm88.googlepages.com/linuxonpsp.htm u may encounter one of the following problems

1) Possible issue 1:
make[4]: *** [bfd.info] Error 1
make[4]: Leaving directory `/usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18-build/bfd/doc'
...
make[4]: Leaving directory `/usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18-build/bfd'
make[3]: *** [info-recursive] Error 1
make[3]: Leaving directory `/usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18-build/bfd'
make[2]: *** [all-bfd] Error 2
make[2]: Leaving directory `/usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18-build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18-build'
make: *** [/usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18-build/binutils/objdump] Error 2

Workaround:
cd /usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18-build/bfd/doc
makeinfo --split-size=5000000 --split-size=5000000 -I /usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18/bfd/doc -o bfd.info `test -f 'bfd.texinfo' || echo '/usr/src/buildroot-20071216/toolchain_build_mipsel/binutils-2.18/bfd/doc/'`bfd.texinfo
continue to run make under $(BUILDROOT)/

2) Possible issue 2:
if [ ! -e /usr/src/buildroot-20071216/build_mipsel/staging_dir/mipsel-linux-uclibc/bin/cc ]; then \
ln -snf gcc /usr/src/buildroot-20071216/build_mipsel/staging_dir/mipsel-linux-uclibc/bin/cc; \
fi
ln: creating symbolic link `/usr/src/buildroot-20071216/build_mipsel/staging_dir/mipsel-linux-uclibc/bin/cc' to `gcc': No such file or directory
make: *** [/usr/src/buildroot-20071216/toolchain_build_mipsel/gcc-4.2.1-final/.installed] Error 1

Workaround:
cd $(BUILDROOT)/build_mipsel/staging_dir/
ln -s usr/mipsel-linux-uclibc/ mipsel-linux-uclibc
continue to run make under $(BUILDROOT)/

3) Possible issue 3:
install -c /usr/src/buildroot-20071216/project_build_mipsel/linuxonpsp/root/usr/bin/ldd \
/usr/src/buildroot-20071216/build_mipsel/staging_dir/mipsel-linux-uclibc/target_utils/ldd
install: cannot stat `/usr/src/buildroot-20071216/project_build_mipsel/linuxonpsp/root/usr/bin/ldd': No such file or directory
make: *** [/usr/src/buildroot-20071216/project_build_mipsel/linuxonpsp/root/usr/bin/ldd] Error 1

Workaround:
touch $(BUILDROOT)/project_build_mipsel/linuxonpsp/root/usr/bin/ldd
continue to run make under $(BUILDROOT)/

4) Possible issue 4:
[ -f /usr/src/buildroot-20071216/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-ld.real ] || \
mv /usr/src/buildroot-20071216/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-ld /usr/src/buildroot-20071216/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-ld.real
mv: can't stat source /usr/src/buildroot-20071216/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-ld
make[1]: *** [install] Error 1
make[1]: Leaving directory `/usr/src/buildroot-20071216/toolchain_build_mipsel/elf2flt'
make: *** [/usr/src/buildroot-20071216/toolchain_build_mipsel/elf2flt/elf2flt] Error 2

Workaround:
cd $(BUILDROOT)/build_mipsel/staging_dir/bin/
ln -s `find .. -name 'mipsel-linux-uclibc-ld'` mipsel-linux-uclibc-ld
cd $(BUILDROOT)/toolchain_build_mipsel/elf2flt/
make install
continue to run make under $(BUILDROOT)/

10) Remeber if u needed to do a ( make clean and make )in the buildroot directory for rebuilding the toolchain with extra options; Issue the Steps in possible issue :4 otherwise -elf2flt support will be broken in toolchain
11) now add the /path/tp/buildroot/
build_mipsel/staging_dir/usr/bin to ur PATH variable permanently by editing the .bashrc file in home directory
echo "export PATH=$PATH:
/path/tp/buildroot/build_mipsel/staging_dir/usr/bin" >> ~/.bashrc
12) Now u r up with the toolchain for psp linux development :)

Sunday, August 17, 2008

Building linux for psp - Introduction


Hi recently i was looking at getting linux on to my psp and found this site.
http://jacksonm88.googlepages.com/linuxonpsp.htm

The information provided here is not enough for a noob like me to get it up from start ; I had to do a lot of twiking around, google alot ask about my problem at http://ps2.dev.org to get it up and in the process i learned alot about linux :) .

Basically getting linux on psp or embedded system for that matter, Involves the following steps

1) Get a cross compiler / toolchain
2) Get a bootloader
3) Compile a kernel with drivers
4) Get a rootfs

Before going further i would like to mentions some details about the psp hardware and its limitations for running linux. PSP has a mips microcontroller / arch mips32, mmu-less. The mmu is a important unit for any OS. Fortunately there is a branch of linux which can be run on a mmu-less processors called uClinux. But it is very limited.
The limitations of a mmu-less system as far as i understood are
- No glibc
- It does not support shared libraries.
- The executable file format should be flat, ELF is not supported.

Sunday, July 6, 2008

Psp Linux toolchain

here is my buildroot environment i compiled for psp using instructions from http://jacksonm80.googlepages.com/linuxonpsp.htm
extract it to /usr/src and add mipsel-linux-gcc to PATH variable

1)
http://rapidshare.com/files/127658821/pspbuildroot-aa.html
2)http://rapidshare.com/files/127659257/pspbuildroot-ab.html
3)
http://rapidshare.com/files/127659358/pspbuildroot-ac.html
4)
http://rapidshare.com/files/127659334/pspbuildroot-ad.html
5) http://rapidshare.com/files/127657597/pspbuildroot-ae.html


cat pspbuildroot-aa pspbuildroot-aa pspbuildroot-aa pspbuildroot-aa pspbuildroot-aa > buildroot-20071216.tar.bz2
Google