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.0.1.tar.gz can be downloaded from the project page. 2. Linux kernel version 2.6.0 linux-2.6.0.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.0.1.tar.gz 3. cd $(SOMEWHERE_KERNEL) 4. Untar Linux kernel source tar -xjvf linux-2.6.0.tar.bz2 1) Build and Install Kernel patch for kernel versions 2.6.0 ----------------------------------------------------------------- 1. Login as root 2. Issue a command to apply a series of patches to the kernel source. cd $(SOMEWHERE_LKST)/lkst-2.0.1/ make patch KPRESRC=$(SOMEWHERE_KERNEL)/linux-2.6.0 (*) The order of patches and details are described in Appendix.1. 3. Build kernel a. Kernel Configuration cd $(SOMEWHERE_KERNEL)/linux-2.6.0 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 4. Install Kernel (If you have /sbin/installkernel script) cd $(SOMEWHERE_KERNEL)/linux-2.6.0 /sbin/installkernel 2.6.0-lkst201 arch/i386/boot/bzImage System.map go to Step.13 5. (If you do not have /sbin/installkernel script) cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.0-lkst201 (On IA64, run "cp vmlinux.gz /boot/vmlinuz-2.6.0-lkst201" instead of this) 6. cp System.map /boot/System.map-2.6.0-lkst201 7. cp Kerntypes /boot/Kerntypes-2.6.0-lkst201 8. rm /boot/System.map 9. rm /boot/Kerntypes 10. ln -s /boot/System.map-2.6.0-lkst201 /boot/System.map 11. ln -s /boot/Kerntypes-2.6.0-lkst201 /boot/Kerntypes 12. Modify /etc/lilo.conf to boot from /boot/vmlinuz-2.6.0-lkst201 Or, if you use grub, modify /boot/grub/grub.conf to boot from /boot/vmlinuz-2.6.0-lkst201 13. If you use lilo, run /sbin/lilo to read modified lilo.conf 14. 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.0.1/ 3. make config LKCD=no (Or, if you have to specify kernel-source directory, do as following make config LKCD=no KSRC=$(SOMEWHERE_KERNEL)/linux-2.6.0 ) 3.a) Install the userspace tools -------------------------------- 1. Log in as root 2. cd $(SOMEWHERE_LKST)/lkst-2.0.1/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.1-1.i386.rpm from the project page. 2. Log in as root 3. Issue the following command: rpm -Uvh lkstutils-2.0.1-1.i386.rpm 4) Install addon tools [Optional] --------------------------------- 1. Log in as root 2. cd $(SOMEWHERE_LKST)/lkst-2.0.1/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 use up to this value as amount of memory size for LKST. If omitted, 1/8 of physical memory size can be used. 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 1)Patching the kernel ------------------- 1.a. Issue command to patch kernel for preassigned-pagetable cd $(SOMEWHERE_KERNEL)/linux-2.6.0 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/extra-patch/preassign-2.6.0.patch 1.b. (OPTIONAL) Or if you would like to use vmsync(*) instead of preassigned-pagetable, do following. cd $(SOMEWHERE_KERNEL)/linux-2.6.0 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/extra-patch/vmsync-2.6.0.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.0 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/hooks/kernelhooks-v1.8-260-base.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/hooks/kernelhooks-v1.8-fix_kconfig.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/hooks/kernelhooks-v1.8-fix_kmakefile.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/hooks/kernelhooks-v1.8-resolve_dependency.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/hooks/kernelhooks-v1.8-support_ia64.patch 3. Issue command to patch kernel for LKST cd $(SOMEWHERE_KERNEL)/linux-2.6.0 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/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.0 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.0.1/extra-patch/lkst_use_vmsync.patch