4. Setup, Test, and Running crash

4.1. Setting up crash dump

In order to save a core image that has been written into swap, the image must be saved prior to swap being re-mounted during boot. To accomplish this, the sysinit startup file needs to be changed. The lkcd source includes a scripts directory which contains patches for various sysinit startup scripts. These patches add the lkcd config and lkcd save commands to enable crash dumps and to save any existing crash dumps upon startup.

4.2. Testing crash

To force a panic to test you new crash setup, compile the following code with cc -c -I/usr/src/linux/include panic.c . After building the panic.o module just insmod panic.o to panic the kernel.

  ### panic.c ###########################

  #define __KERNEL__
  # MODULE 

  # include init_module(void)

  int init_module (void)
  {
      panic(" panic has been called");
      return 0;
  }
      

4.3. Running crash

To view your kernel core file lcrash needs to be invoked with a couple of parameters:

  lcrash [ System.map file ] [ dump image ] [ Kerntypes ]

  Example:

  lcrash /boot/System.map ./dump.1 /boot/Kerntypes
      

It will take a minute to load the kernel image into memory and drop you into the crash shell. At the crash shell prompt you can type a ? to see the available commands.

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:03