White Paper: Red Hat Crash Utility


< Prev Contents Next >

Build Procedure

Starting with the Red Hat Enterprise Linux 3 release, the crash utility is automatically installed during system installation if the Development Tools package set is selected. However, for all other kernel versions, or if it was not selected during system installation, the binary RPM can be installed, or if desired, the sources re-built and installed.

If the crash utility is not pre-installed, and if all dependencies are met on the target system, install the binary RPM like so:

# rpm -ivh crash-3.7-1.i386.rpm
Preparing...                ########################################### [100%]
   1:crash                  ########################################### [100%]
#

The crash executable will be installed in the /usr/bin directory.

Alternatively, the crash source code can be rebuilt. The crash utility's source files come packaged in two typical formats, a source RPM file, or a compressed tar image. So, for example, crash version 3.7-1 can be built from either crash-3.7-1.src.rpm or crash-3.7-1.tar.gz.

In either case, the source file layout consists of a top-level directory containing a set of crash-specific files, a compressed tar image containing the full, unmodified, gdb source tree, and a small number of modified gdb files required to merge the two entities. The build procedure does the following:

  1. the unmodified gdb sources are extracted into a subdirectory of the top-level crash source directory, and overlayed by the small set of modified gdb files.
  2. the files in the gdb source tree are built first, creating the libbfd.a, libreadline.a, libopcodes.a, libiberty.a and libgdb.a libraries.
  3. the crash sources files in the top-level directory are then compiled into a crashlib.a library.
  4. the objects are all linked into the crash executable, located in the top-level directory.
Depending upon the speed of the host system, the complete build may take several minutes, primarily due to the time consumed by the build of the gdb portion.


Building from the source RPM

To build from the source RPM, install the crash-3.7-1.src.rpm, cd to the appropriate SPECS directory, and build the package:

# rpm -Uvh crash-3.7-1.src.rpm
   1:crash                  ########################################### [100%]
# cd /usr/src/redhat/SPECS
# rpmbuild -ba crash.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.19005
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf crash-3.7-1
+ /bin/gzip -dc /usr/src/redhat/SOURCES/crash-3.7-1.tar.gz
+ tar -xvvf -
drwxr-xr-x root/root         0 2002-09-12 16:51:40 crash-3.7-1/
-rwxrwxr-x root/root     31916 2002-09-12 16:51:40 crash-3.7-1/main.c
-rwxrwxr-x root/root    103454 2002-09-12 16:51:40 crash-3.7-1/tools.c
-rwxrwxr-x root/root      5802 2002-09-12 16:51:40 crash-3.7-1/global_data.c
-rwxrwxr-x root/root    225343 2002-09-12 16:51:40 crash-3.7-1/memory.c
-rwxrwxr-x root/root     75492 2002-09-12 16:51:40 crash-3.7-1/filesys.c
-rwxrwxr-x root/root    211519 2002-09-12 16:51:40 crash-3.7-1/help.c
-rwxrwxr-x root/root    110604 2002-09-12 16:51:40 crash-3.7-1/task.c
-rwxrwxr-x root/root    101805 2002-09-12 16:51:40 crash-3.7-1/kernel.c
-rwxrwxr-x root/root      2198 2002-09-12 16:51:40 crash-3.7-1/test.c
-rwxrwxr-x root/root     18949 2002-09-12 16:51:40 crash-3.7-1/gdb_interface.c
-rwxrwxr-x root/root     20239 2002-09-12 16:51:40 crash-3.7-1/configure.c
-rwxrwxr-x root/root     29931 2002-09-12 16:51:40 crash-3.7-1/net.c
-rwxrwxr-x root/root     99654 2002-09-12 16:51:40 crash-3.7-1/dev.c
-rwxrwxr-x root/root     76146 2002-09-12 16:51:40 crash-3.7-1/alpha.c
-rwxrwxr-x root/root     74638 2002-09-12 16:51:40 crash-3.7-1/x86.c
-rwxrwxr-x root/root     42109 2002-09-12 16:51:40 crash-3.7-1/ppc.c
-rwxrwxr-x root/root     76357 2002-09-12 16:51:40 crash-3.7-1/ia64.c

  (complete output not shown)

Requires: libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.
2) libc.so.6(GLIBC_2.2.3) libc.so.6(GLIBC_2.3) libdl.so.2 libdl.so.2(GLIBC_2.0)
libdl.so.2(GLIBC_2.1) libm.so.6 libm.so.6(GLIBC_2.0) libncurses.so.5 libz.so.1
Processing files: crash-debuginfo-3.7-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHave
Prefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/crash-root
Wrote: /usr/src/redhat/SRPMS/crash-3.7-1.src.rpm
Wrote: /usr/src/redhat/RPMS/i386/crash-3.7-1.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/crash-debuginfo-3.7-1.i386.rpm
#

Lastly, install the binary RPM, which copies the crash executable to the /usr/bin directory:

# rpm -ivh /usr/src/redhat/RPMS/i386/crash-3.7-1.i386.rpm 
Preparing...                ########################################### [100%]
   1:crash
#


Building from the tar image

To build from the compressed tar image, simply uncompress/extract the source files, cd into the resultant source directory, and enter make:

# tar xvzmf crash-3.7-1.tar.gz
crash-3.7-1/
crash-3.7-1/main.c
crash-3.7-1/tools.c
crash-3.7-1/global_data.c
crash-3.7-1/memory.c
crash-3.7-1/filesys.c
crash-3.7-1/help.c
crash-3.7-1/task.c
crash-3.7-1/kernel.c
crash-3.7-1/test.c
crash-3.7-1/gdb_interface.c
crash-3.7-1/configure.c
crash-3.7-1/net.c
crash-3.7-1/dev.c
crash-3.7-1/alpha.c
crash-3.7-1/x86.c
crash-3.7-1/ppc.c
crash-3.7-1/ia64.c
crash-3.7-1/s390.c
crash-3.7-1/s390x.c
crash-3.7-1/extensions.c
crash-3.7-1/remote.c
crash-3.7-1/va_server.c
crash-3.7-1/va_server_v1.c
crash-3.7-1/symbols.c
crash-3.7-1/cmdline.c
crash-3.7-1/lkcd_common.c
crash-3.7-1/lkcd_v1.c
crash-3.7-1/lkcd_v2_v3.c
crash-3.7-1/lkcd_v5.c
crash-3.7-1/lkcd_v7.c
crash-3.7-1/s390_dump.c
crash-3.7-1/s390x_dump.c
crash-3.7-1/lkcd_x86_trace.c
crash-3.7-1/netdump.c
crash-3.7-1/builtin_debug_data.c
crash-3.7-1/unwind.c
crash-3.7-1/unwind_decoder.c
crash-3.7-1/defs.h
crash-3.7-1/va_server.h
crash-3.7-1/vas_crash.h
crash-3.7-1/netdump.h
crash-3.7-1/unwind.h
crash-3.7-1/unwind_i.h
crash-3.7-1/rse.h
crash-3.7-1/lkcd_vmdump_v1.h
crash-3.7-1/lkcd_vmdump_v2_v3.h
crash-3.7-1/lkcd_dump_v5.h
crash-3.7-1/lkcd_x86_trace.h
crash-3.7-1/ibm_common.h
crash-3.7-1/Makefile
crash-3.7-1/gdb-5.1/
crash-3.7-1/gdb-5.1/gdb/
crash-3.7-1/gdb-5.1/gdb/Makefile.in
crash-3.7-1/gdb-5.1/gdb/main.c
crash-3.7-1/gdb-5.1/gdb/symtab.c
crash-3.7-1/gdb-5.1/gdb/target.c
crash-3.7-1/gdb-5.1/gdb/blockframe.c
crash-3.7-1/gdb-5.1/gdb/alpha-tdep.c
crash-3.7-1/gdb-5.1/gdb/symfile.c
crash-3.7-1/gdb-5.1/gdb/elfread.c
crash-3.7-1/gdb-5.1/gdb/ui-file.c
crash-3.7-1/gdb-5.1/gdb/utils.c
crash-3.7-1/gdb-5.1/gdb/gnu-regex.c
crash-3.7-1/COPYING
crash-3.7-1/gdb-5.1.tar.gz
crash-3.7-1/README
# cd crash-3.7-1
# make
TARGET: X86
 CRASH: 3.7-1
   GDB: gdb-5.1
gdb-5.1/gdb/CONTRIBUTE
gdb-5.1/gdb/COPYING
gdb-5.1/gdb/ChangeLog
gdb-5.1/gdb/ChangeLog-1990
gdb-5.1/gdb/ChangeLog-1991
gdb-5.1/gdb/ChangeLog-1992
gdb-5.1/gdb/ChangeLog-1993
gdb-5.1/gdb/ChangeLog-1994
gdb-5.1/gdb/ChangeLog-1995
gdb-5.1/gdb/ChangeLog-1996
gdb-5.1/gdb/ChangeLog-1997
gdb-5.1/gdb/ChangeLog-1998
gdb-5.1/gdb/ChangeLog-1999
gdb-5.1/gdb/ChangeLog-2000
gdb-5.1/gdb/ChangeLog-3.x
gdb-5.1/gdb/MAINTAINERS
gdb-5.1/gdb/NEWS
gdb-5.1/gdb/README
gdb-5.1/gdb/TODO
gdb-5.1/gdb/a29k-tdep.c
gdb-5.1/gdb/a68v-nat.c
gdb-5.1/gdb/abug-rom.c

  (complete output not shown)

ar -rs crashlib.a main.o tools.o global_data.o memory.o filesys.o help.o task.o
build_data.o kernel.o test.o gdb_interface.o net.o dev.o alpha.o x86.o ppc.o ia6
4.o s390.o s390x.o extensions.o remote.o va_server.o va_server_v1.o symbols.o cm
dline.o lkcd_common.o lkcd_v1.o lkcd_v2_v3.o lkcd_v5.o lkcd_v7.o s390_dump.o s39
0x_dump.o netdump.o builtin_debug_data.o lkcd_x86_trace.o unwind.o
gcc -g -O2         -o `cat mergeobj` \
main.o libgdb.a cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o m
i-out.o mi-console.o mi-cmds.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o mi-cmd
-disas.o mi-main.o mi-parse.o mi-getopt.o    ../bfd/libbfd.a ../readline/libread
line.a ../opcodes/libopcodes.a  ../libiberty/libiberty.a -lncurses     -lm  ../l
ibiberty/libiberty.a \
-ldl -rdynamic `cat mergelibs`
#

The resultant crash executable will be located in the current top-level source directory. Install it in /usr/bin by entering:

# make install
/usr/bin/install crash /usr/bin
#



< Prev Contents Next >