- Extract the srpm (this is the same as the step above).
$ tsrpm --extract strace-4.5.3-1.src.rpm
- To make changes to the source of a package first run only the "prep" stage of build. This typically involves extracting the tarball and applying any patches:
$ tsrpm --target=armv5b-uclibc -bp rpm-sources/strace-4.5.3-1/strace.spec
- Now make a copy of the original build directory. You will use this to generate a patch that includes your changes :
$ cp -a armv5b-uclibc/BUILD/strace-4.5.3 armv5b-uclibc/BUILD/strace-4.5.3.orig
- Build the package:
$tsrpm --cust=devicescape --target=armv5b-uclibc \
--build rpm-sources/strace-4.5.3-1/strace.spec
- If you are debugging a build it can be helpful to interact with the package in the cross shell environment. To do this, execute a shell and enter the build directory. Execute build commands via this shell while testing the changes you made to the package. For example:
$ tsrpm --target=armv5b-uclibc --run-tool /bin/sh
+ eval /bin/sh
++ /bin/sh
sh-2.05b$ cd armv5b-uclibc/BUILD/strace-4.5.3/ sh-2.05b$ make
make all-am
make[1]: Entering directory `/usr/src/armv5b-uclibc/BUILD/strace-4.5.3'
if armv5b-uclibc-gcc -DHAVE_CONFIG_H -I. -I. -I. \
-Ilinux/arm -I./linux/arm -Ilinux -I./linux \
-Wall -D_GNU_SOURCE -O2 -g -pipe -MT mem.o -MD -MP -MF ".deps/mem.Tpo" \
-c -o mem.o `test -f 'mem.c' || echo './'`mem.c; \
then mv -f ".deps/mem.Tpo" ".deps/mem.Po"; \
else rm -f ".deps/mem.Tpo"; exit 1; \
fi armv5b-uclibc-gcc -Wall -D_GNU_SOURCE -O2 -g -pipe \
-o strace strace.o syscall.o util.o desc.o file.o ipc.o io.o \
ioctl.o mem.o net.o process.o bjm.o resource.o signal.o sock.o \
system.o term.o time.o proc.o stream.o
make[1]: Leaving directory \
`/usr/src/armv5b-uclibc/BUILD/strace-4.5.3'
sh-2.05b$
The shell entered above has a set of environment variables specifically for cross building so some tools may not work as expected. Specifically, you may find that your editor does not work when invoked from this shell. Therefore, only execute build commands (commands that typically appear in a specfile such as 'configure' or 'make') within the cross shell described above. Make your source changes (run your editor) in a non-cross shell.
- Once your source changes are complete, generate a patch:
$ diff -urN armv5b-uclibc/BUILD/strace-4.5.3.orig/ \
armv5b-uclibc/BUILD/strace-4.5.3 > rpm-sources/strace-4.5.3-1/statfs64.patch
- Look through the diff and delete any changes you did not want to make, any auto-generated files, etc. Your patch might then look something like the following:
diff -urN armv5b-uclibc/BUILD/strace-4.5.3.orig/config.h.in \
armv5b-uclibc/BUILD/strace-4.5.3/config.h.in
--- armv5b-uclibc/BUILD/strace-4.5.3.orig/config.h.in \
2004-04-16 15:29:49.000000000 -0700
+++ armv5b-uclibc/BUILD/strace-4.5.3/config.h.in \
2005-03-03 15:37:23.786755720 -0800
@@ -176,6 +176,9 @@
/* Define to 1 if `sin6_scope_id' is member of `struct sockaddr_in6'. */
#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
+/* Define to 1 if the system has the type `struct statfs64'. */
#undef
+HAVE_STRUCT_STATFS64
+
/* Define to 1 if `st_aclcnt' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_ACLCNT
diff -urN armv5b-uclibc/BUILD/strace-4.5.3.orig/configure.ac \
armv5b-uclibc/BUILD/strace-4.5.3/configure.ac
--- armv5b-uclibc/BUILD/strace-4.5.3.orig/configure.ac \
2004-04-16 15:22:19.000000000 -0700
+++ armv5b-uclibc/BUILD/strace-4.5.3/configure.ac \
2005-03-03 15:37:23.786755720 -0800
@@ -165,6 +165,7 @@
struct stat.st_level,
struct stat.st_rdev])
AC_STAT64
+AC_CHECK_TYPES([struct statfs64],,, [#include <sys/statfs.h>])
AC_TYPE_SIGNAL
AC_TYPE_UID_T
diff -urN armv5b-uclibc/BUILD/strace-4.5.3.orig/file.c \
armv5b-uclibc/BUILD/strace-4.5.3/file.c
--- armv5b-uclibc/BUILD/strace-4.5.3.orig/file.c \
2004-01-13 02:16:47.000000000 -0800
+++ armv5b-uclibc/BUILD/strace-4.5.3/file.c \
2005-03-03 15:37:23.787755568 -0800
@@ -1437,6 +1437,7 @@
}
#ifdef LINUX
+#ifdef HAVE_STRUCT_STATFS64
static void
printstatfs64(tcp, addr)
struct tcb *tcp;
@@ -1479,11 +1480,13 @@
#endif
tprintf("}");
}
+#endif
int
sys_statfs64(tcp)
struct tcb *tcp;
{
+#ifdef HAVE_STRUCT_STATFS64
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprintf(", %lu, ", tcp->u_arg[1]);
@@ -1494,12 +1497,16 @@
tprintf("{???}");
}
return 0;
+#else
+ return printargs(tcp);
+#endif
}
int
sys_fstatfs64(tcp)
struct tcb *tcp;
{
+#ifdef HAVE_STRUCT_STATFS64
if (entering(tcp)) {
tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
} else {
@@ -1509,6 +1516,9 @@
tprintf("{???}");
}
return 0;
+#else
+ return printargs(tcp);
+#endif
}
#endif
@@ -2067,6 +2077,13 @@
free(buf);
return 0;
}
+#else
+int
+sys_getdents64(tcp)
+struct tcb *tcp;
+{
+ printargs(tcp);
+}
#endif
#ifdef FREEBSD
- Add the patch to the specfile, and increment the version number :
--- rpm-sources/strace-4.5.3-1.orig/strace.spec
+++ rpm-sources/strace-4.5.3-1/strace.spec
@@ -1,11 +1,12 @@
Summary: Tracks and displays system calls associated with a running process.
Name: strace
Version: 4.5.3
-Release: 1
+Release: 1.1
License: BSD
Group: Development/Debuggers
URL: http://sourceforge.net/projects/strace/
Source0: %{name}-%{version}.tar.bz2
+Patch0: statfs64.patch
BuildRoot: %{_tmppath}/%{name}-root
%define strace64_arches ppc64
@@ -41,6 +42,7 @@
%prep
%setup -q
+%patch0 -p3
%build
%configure
Then build the new package:
$ tsrpm --target=armv5b-uclibc --build rpm-sources/strace-4.5.3-1/strace.spec
The new source rpm is available under the target subdir :
$ ls armv5b-uclibc/SRPMS/
armv5b-uclibc/SRPMS/strace-4.5.3-1.1.src.rpm
$