Mini2440: Compiling ‘strace’ for Mini2440 FriendlyARM Board
‘strace’ is a debugging utility for Linux systems to monitor the system calls used by a program and all the signals it receives. Refer to http://en.wikipedia.org/wiki/Strace for more description.
During the driver development, you can use the strace program to trace the ‘open’, ‘read’, ‘write’ and ‘close’ function calls, the parameters passed to these functions and the return values of these functions.
‘strace’ is available in Ubuntu or other Linux distributions. If not, it can be installed from the relevant package.
Considering embedded systems, if you have followed the regular approach of building the root file system using BusyBox, then ‘strace’ will not be available. This is because ‘strace’ is not part of the BusyBox distribution.
In order to build strace for Mini2440, you can follow the below approach:
- Download strace from the sourceforge site, http://sourceforge.net/projects/strace/
- Extract the strace source code using the following command.
tar -xvJf strace-4.8.tar.xz
- Export the PATH, CROSS_COMPILE, CC and CFLAGS varaibles.
export CFLAGS=”-O-static -march=armv4t”
- Configure and Build strace.
- Confirm the ‘strace’ program is build for ARM.
ls -l strace
- You should see the following output in response to the ‘file strace’ command.
strace: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, not stripped
- Confirm the ‘strace’ program is build for the ARMV4T version corresponding to Mini2440.
arm-none-linux-gnueabi-readelf -a strace
- You should see the following output in response to the ‘arm-none-linux-gnueabi-readelf -a strace’ command.
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_DIV_use: Not allowed
- Copy the strace utility to the ‘usr/sbin/’ directory on the target file system.
sudo cp strace ../target_fs/usr/sbin/
Boot the Mini2440 FriendlyARM board with the updated target root file system. You will have the strace utility on target.