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-2.0.0.tar.gz can be downloaded from the project page.

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


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

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

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

3. cd $(SOMEWHERE_KERNEL)

4. Untar Linux source
	tar -xjvf  linux-2.6.0-test9.tar.bz2

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

2.a. Issue command to patch kernel for preassigned-pagetable
	 cd $(SOMEWHERE_KERNEL)/linux-2.6.0-test9
	 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.0/extra-patch/preassign-2.6.0-test9.patch

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

3. Issue command to patch kernel for KernelHooks (as following order)
	 cd $(SOMEWHERE_KERNEL)/linux-2.6.0-test9
	 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.0/hooks/kernelhooks-v1.8-260-test9-base.patch
	 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.0/hooks/kernelhooks-v1.8-fix_kconfig.patch
	 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.0/hooks/kernelhooks-v1.8-fix_kmakefile.patch
	 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.0/hooks/kernelhooks-v1.8-resolve_dependency.patch
	 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.0/hooks/kernelhooks-v1.8-support_ia64.patch

4. Issue command to patch kernel for LKST
	 cd $(SOMEWHERE_KERNEL)/linux-2.6.0-test9
	 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.0/linux26.patch

*) Instead of executing from the step 2.a to the step 4, you can use
   the "make" command as following.
	 cd $(SOMEWHERE_LKST)/lkst-2.0.0/
	 make patch KPRESRC=$(SOMEWHERE_KERNEL)/linux-2.6.0-test9

4.b. If you choose using vmsync, you should patch an additional patch.
	 cd $(SOMEWHERE_KERNEL)/linux-2.6.0-test9
	 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.0/extra-patch/lkst_use_vmsync.patch

5. Build kernel
	a. 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"
	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
	f. make modules_install

6. Install Kernel
   (If you have /sbin/installkernel script)
	 cd $(SOMEWHERE_KERNEL)/linux-2.6.0-test9
	 /sbin/installkernel 2.6.0-test9-lkst200 arch/i386/boot/bzImage System.map
   go to Step.15

7. (If you do not have /sbin/installkernel script)
   cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.0-test9-lkst200
   (On IA64, run "cp vmlinux.gz /boot/vmlinuz-2.6.0-test9-lkst200"
   instead of this)

8. cp System.map /boot/System.map-2.6.0-test9-lkst200

9. cp Kerntypes /boot/Kerntypes-2.6.0-test9-lkst200

10. rm /boot/System.map

11. rm /boot/Kerntypes

12. ln -s /boot/System.map-2.6.0-test9-lkst200 /boot/System.map

13. ln -s /boot/Kerntypes-2.6.0-test9-lkst200 /boot/Kerntypes

14. Modify /etc/lilo.conf to boot from /boot/vmlinuz-2.6.0-test9-lkst200

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

16. reboot


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

1. Log in as root

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

3. make config LKCD=no
   (Or, if you have to specify kernel-source directory)
   make config LKCD=no KSRC=$(SOMEWHERE_KERNEL)/linux-2.6.0-test9


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

1. Log in as root

2. cd $(SOMEWHERE_LKST)/lkst-2.0.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.0.0-1.i386.rpm from the project page.

2. Log in as root

3. Issue the following command:

   rpm -Uvh lkstutils-2.0.0-1.i386.rpm



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

1. Log in as root

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

3. Build and install

   a. make
   b. 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

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/

6) 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.


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