For problems or questions, please e-mail lkst-develop@lists.sourceforge.net
For bugs, please submit a bug via the project page:

https://sourceforge.net/projects/lkst/


Prerequisites 
=============

1. Linux Kernel State Tracer software:
   lkst-1.5.tar.gz can be downloaded from the project page.

2. Linux kernel version 2.4.19
   linux-2.4.19.tar.gz can be downloaded from  
     ftp://ftp.kernel.org/pub/linux/kernel/v2.4/

(If you'd like to use LKST on IA64)
3. Linux kernel IA64 patch for 2.4.19
   linux-2.4.19-ia64-020821.diff.bz2 can be downloded from
     ftp://ftp.kernel.org/pub/linux/kernel/ports/ia64/
     

Installation
============

0) Prepare archives
------------------------------------------------------------
1. cd $(SOMEWHERE_LKST)

2. Untar the LKST archive
    tar -xzvf  lkst-1.5.tar.gz

3. cd $(SOMEWHERE_KERNEL)

4. Untar Linux source 
    tar -xzvf  linux-2.4.19.tar.gz

1) Build and Install Kernel patch for kernel versions 2.4.19
------------------------------------------------------------
1. Login as root

(If you'd like to use LKST on IA64)
2. Issue command to patch kernel for IA64
     cd $(SOMEWHERE_KERNEL)/linux-2.4.19
     bzcat linux-2.4.19-ia64-020821.diff.bz2 | patch -p 1 
!NOTE!:
     If you apply this patch, there will be some warnings when execute 
     following. But do not mind that. No patches will be rejected.

3. Issue command to patch kernel for Kernel hooks
     cd $(SOMEWHERE_KERNEL)/linux-2.4.19
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-1.5/hooks/kernelhooks-1.7-2419-2.patch

4. Issue command to patch kernel for LKCD
     cd $(SOMEWHERE_KERNEL)/linux-2.4.19
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-1.5/lkcd-addon/lkcd-4.1-2419-2.patch

5. Issue command to patch kernel for LKST
     cd $(SOMEWHERE_KERNEL)/linux-2.4.19
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-1.5/linux24.patch

(If you'd like to make LKST on Red Hat Linux 8/9)
6. Issue command to patch kernel for Red Hat Linux 8/9
     cd $(SOMEWHERE_KERNEL)/linux-2.4.19
     (if using Red Hat 8)
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-1.5/extra-patch/kernel-2.4.19-rh8.patch
     (or using Red Hat 9)
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-1.5/extra-patch/kernel-2.4.19-rh9.patch

7. Build kernel
    a. make menuconfig
    b. Under "Kernel hacking", select the following:
      i. Select "y" for "Linux Kernel Crash Dump (LKCD) Support".
     ii. Select "y" for "Kernel debugging".
    iii. Select "y" for "Magic SysRq key".
     iv. Select "m" for "Kernel State Tracing (LKST)".
      v. Select "y" for "Kernel Hook Support".
     vi. Configure other kernel config settings as needed. 
    c. Save and Exit
    d. make dep
    e. make clean
    f. make bzImage (On IA64, run "make compressed" instead of this)
    g. make modules
    h. make modules_install
        
8. cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.19-lkst15
   (On IA64, run "cp vmlinux.gz /boot/vmlinuz-2.4.19-lkst15" instead of this)

9. cp System.map /boot/System.map-2.4.19-lkst15

10. cp Kerntypes /boot/Kerntypes-2.4.19-lkst15

11. rm /boot/System.map

12. rm /boot/Kerntypes

13. ln -s /boot/System.map-2.4.19-lkst15 /boot/System.map

14. ln -s /boot/Kerntypes-2.4.19-lkst15 /boot/Kerntypes

15. Modify /etc/lilo.conf to boot from /boot/vmlinuz-2.4.19-lkst15

16. Run /sbin/lilo to read modified lilo.conf

17. reboot


2) Install the lkcdutils tools
------------------------------------------------

1. Log in as root

2. cd $(SOMEWHERE_LKST)/lkst-1.5/lkcd-addon/lkcdutils

3. Build userspace tools

   a. ./configure --topdir=$(SOMEWHERE_KERNEL)/linux-2.4.19
   b. make
   c. make install


3) Install the userspace tools
--------------------------------------

1. Log in as root

2. cd $(SOMEWHERE_LKST)/lkst-1.5/command

3. Build userspace tools

   a. autoconf
   b. ./configure --with-ksrc=$(SOMEWHERE_KERNEL)/linux-2.4.19 --mandir=/usr/share/man
   c. make
   d. make install

IMPORTANT!!!
You must build them after the kernel was built and lkcdutils is installed.
They use new include files and configurations which are included in the kernel
patch.


4) Install addon tools [Optional]
------------------------------------------------

1. Log in as root

2. cd $(SOMEWHERE_LKST)/lkst-1.5/addons

3. Build and install

   a. autoconf
   b. ./configure --with-ksrc=$(SOMEWHERE_KERNEL)/linux-2.4.19
   c. make
   d. make install

IMPORTANT!!!
Also You must build them after the kernel was built. 

5) Configure your system
------------------------
To load lkst module, issue following command:

       insmod lkst

Make a lkst device node.
    a. refer /proc/devices
       the number in the left of "lkst" is the major number.
    b. make a node using the major number in $(MAJOR).
       mknod /dev/lkst c $(MAJOR) 0

If you want to configure lkst module, you will need to add the following lines
to /etc/modules.conf(or /etc/conf.modules):

       alias lkst lkst
       options lkst lkst_init_buffer_size=65536

Also see the following section on the module parameter. 

NOTE: For the configuration of LKCD, see LKCD documents which can be downloaded at
      http://lkcd.sourceforge.net/

5) Kernel parameter
---------------------
The following kernel parameter can be passed:

      lkst_maxvm=

Use integer value for LKST available memory size.
Users can use up to this value as amount of memory size for LKST.
If omitted, 1/10 of physical memory size can be used.

If LKST is embeded in kernel, you can pass following parameter:

      lkst_init_maskset=

Use integer value for maskset id. You can choose between 0, 1, or 2.
Default value is 2. If you choose any value except values described above,
the value is set as default value.


6) Module parameter
---------------------
The following module parameter can be passed:

      lkst_init_buffer_size= 

Use integer value for logging buffer size(in byte). You can use the value
larger than 8192. Default value is 65536. If amount of buffer size is larger
than LKST available memory described above, the size is set as default value.

     example: insmod lkstmod lkst_init_buffer_size=1048576

NOTE!!!
If you specify a value, kernel memory will be used by the value.
So you may avoid specifying large value.

Also you can pass following module parameter:

      lkst_init_maskset=

This parameter is the same meaning as kernel parameter's one.
This available if you make LKST as module.

     example: insmod lkstmod lkst_init_maskset=0
