If you want to build Valgrind for your MIPS target, you should definitely refer to the README.mips file, but I wanted to outline the general steps it took to me to successfully build and run Valgrind:
- Get the latest source code - support for MIPS was just recently integrated into the main tree, and currently no official release support it:
svn co svn://svn.valgrind.org/valgrind/trunk valgrind - cd into the valgrind directory.
- ./autogen.sh
- ./configure --host=mipsel-linux-gnu --with-pagesize=4 CC=my-mips-xccompiler CXX=my-mips-xcppcompiler CFLAGS="-I/path/to/target/kernel -I/path/to/target/kernel/include -D__STRUCT_EXEC_OVERRIDE__ --prefix=/path/to/installation/dir
- make
- make install
Some notes on step [4]:
- --host=mipsel-linux-gnu - mipsel is for little endian architecture and mips is for big endian.
- with-pagesize=4 - this should be set to whatever your kernel's PAGE_SIZE is configured.
- -D__STRUCT_EXEC_OVERRIDE__ - not sure why, but my kernel is missing the a.out.h in the arch/mips directory, which is needed by Valgrind. I had to define this so Valgrind will not include a.out.h.
- --prefix - you want to set this up - this will create three directories - /bin, /lib and include, which you want in your target's root filesystem.
Before you can run Valgrind on the target, you'll need to issue the following command:
export VALGRIND_LIB=/lib/valgrind
That's it, your'e all set - type 'valgrind --help' for all available options.