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

http://sourceforge.net/projects/lkst/


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

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

2. Linux kernel version 2.6.6
   linux-2.6.6.tar.bz2 can be downloaded from
     ftp://ftp.kernel.org/pub/linux/kernel/v2.6/

!ATTENTION!
   For kernel modules of Linux 2.6, you need new module-init-tools.
   The latest version of module-init-tools can be downloaded from
     ftp://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools/


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

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

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

3. cd $(SOMEWHERE_KERNEL)

4. Untar Linux kernel source
    tar -xjvf  linux-2.6.6.tar.bz2

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

2. Issue a command to apply a series of patches to the kernel source.
     cd $(SOMEWHERE_LKST)/lkst-2.1.0/
     make patch KPRESRC=$(SOMEWHERE_KERNEL)/linux-2.6.6

     (*) The order of patches and details are described in Appendix A.

3. Build kernel
    a. Kernel Configuration
       cd $(SOMEWHERE_KERNEL)/linux-2.6.6
       make menuconfig

    b. Under "Processor type and features"
      i. Select "64GB" for "High Memory Support"
      or
      i. Select "y" for "Assign page tables for non-contiguous mapped area on boot"
     ii. Select "n" for "Use register arguments"
    c. Under "Kernel hacking", select the following:
      i. Select "y" for "Kernel debugging".
     ii. Select "y" for "Kernel Hook Support".
    iii. Select "y" for "Magic SysRq key". (optional)
     iv. Select "m" for "Kernel State Tracing (LKST)".
      v. Configure other kernel config settings as needed.
    d. Save and Exit
    e. make modules bzImage

4. Install kernel modules and the kernel
   make modules_install
   make install

5. If you use lilo, run /sbin/lilo to read modified lilo.conf

6. reboot


!ATTENTION!
You must build 2)-4) after the kernel was built.

2) Prepare to install tools
---------------------------

1. Log in as root

2. cd $(SOMEWHERE_LKST)/lkst-2.1.0/

3. make config
   (Or, if you have to specify kernel-source directory, do as following
    make config KSRC=$(SOMEWHERE_KERNEL)/linux-2.6.6 )

!EXPERIMENTAL!
   If you'd like to use LKST with LKCD, Specify lkcdutils' source directory as
   following.
    make config LKCDDIR=$(SOMEWHERE_LKCDUTILS)/lkcdutils

3.a) Install the userspace tools
--------------------------------

1. Log in as root

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

3. Build userspace tools

   a. make
   b. make install


3.b) Or, install the userspace tools from the rpm package
---------------------------------------------------------

1. Download lkstutils-2.1.0-1.i386.rpm from the project page.

2. Log in as root

3. Issue the following command:

   rpm -Uvh lkstutils-2.1.0-1.i386.rpm



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

1. Log in as root

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

3. Build and install

   a. make
   b. make install


Configure your system
======================

5) Load lkst module
-------------------
To load lkst module, issue following command:

       modprobe lkst

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

      lkst_maxvm=

Use integer value for LKST available memory size.
Users can limit the amount of memory size for LKST.

If LKST is embedded 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.


7) 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: modprobe lkst 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: modprobe lkst lkst_init_maskset=0

If you want to configure lkst module, you will need to add the following lines
to /etc/modprobe.conf:

       alias lkst lkst
       options lkst lkst_init_buffer_size=65536


--------------------------------------------------------------------------
Appendix A

Patching the kernel
-------------------
1.a. Issue command to patch kernel for preassigned-pagetable
     cd $(SOMEWHERE_KERNEL)/linux-2.6.6
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/extra-patch/preassign-2.6.6.patch

1.b. (OPTIONAL) Or if you would like to use vmsync(*) instead of
     preassigned-pagetable, do following.
     cd $(SOMEWHERE_KERNEL)/linux-2.6.6
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/extra-patch/vmsync-2.6.6.patch

     (*) vmsync() is an API to synchronize the pagetable entries of a region
     of non-contiguous memory area between all processes. It avoids page-fault
     exception on that region.
     If unsure, do step 1.a.

2. Issue command to patch kernel for KernelHooks (as following order)
     cd $(SOMEWHERE_KERNEL)/linux-2.6.6
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/hooks/kernelhooks-v1.8-266-base.patch
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/hooks/kernelhooks-v1.8-fix_kconfig.patch
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/hooks/kernelhooks-v1.8-fix_kmakefile.patch
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/hooks/kernelhooks-v1.8-resolve_dependency.patch
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/hooks/kernelhooks-v1.8-support_ia64.patch

3. Issue command to patch kernel for LKST
     cd $(SOMEWHERE_KERNEL)/linux-2.6.6
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/linux26.patch

3.b. (OPTIONAL) If you choose using vmsync, you should patch an additional
     patch after step 3.
     cd $(SOMEWHERE_KERNEL)/linux-2.6.6
     patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.1.0/extra-patch/lkst_use_vmsync.patch


==============================================================
COPYRIGHT (C) HITACHI,LTD. 2001-2004
COPYRIGHT (C) FUJITSU,LTD. 2001-2004
==============================================================
