Changes between Version 6 and Version 7 of Dev/KernelHack/COINS/worklog/201109


Ignore:
Timestamp:
Oct 4, 2011 10:34:51 PM (9 years ago)
Author:
mitty
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Dev/KernelHack/COINS/worklog/201109

    v6 v7  
    938938sys     1m26.160s 
    939939}}} 
     940 
     941 = 09/30 = 
     942 == install VMware tools to custom kernel == 
     943 * install.sh 
     944{{{#!sh 
     945#! /bin/sh -ex 
     946 
     947VERSION=`cat /mnt/hgfs/linux-*/include/config/kernel.release` 
     948echo Install Linux Kernel version ${VERSION} 
     949 
     950cd /mnt/hgfs/linux-*/ 
     951make install 
     952make modules_install 
     953 
     954mkinitramfs -o /boot/initrd.img-${VERSION} ${VERSION} 
     955update-grub 
     956 
     957echo Install Kernel Headers to /lib/modules/${VERSION}/build 
     958 
     959mv /lib/modules/${VERSION}/build /lib/modules/${VERSION}/build-`date '+%Y%m%d'` 
     960 
     961cd /mnt/hgfs/ 
     962find linux-* -type f | egrep -v '.o$' | egrep -v 'vmlinu' | tar c --files-from - | tar x -C /lib/modules/${VERSION}/ 
     963mv /lib/modules/${VERSION}/linux-* /lib/modules/${VERSION}/build 
     964 
     965uname -a 
     966}}} 
     967 
     968 * s0711489@ubuntu-lucid64:~$ sudo /mnt/hgfs/tools/install.sh 
     969{{{ 
     970+ cat /mnt/hgfs/linux-2.6.35.14/include/config/kernel.release 
     971+ VERSION=2.6.35.14 
     972+ echo Install Linux Kernel version 2.6.35.14 
     973Install Linux Kernel version 2.6.35.14 
     974+ cd /mnt/hgfs/linux-2.6.35.14/ 
     975+ make install 
     976sh /mnt/hgfs/linux-2.6.35.14/arch/x86/boot/install.sh 2.6.35.14 arch/x86/boot/bzImage \ 
     977                System.map "/boot" 
     978+ make modules_install 
     979  INSTALL arch/x86/kernel/test_nx.ko 
     980  INSTALL drivers/scsi/scsi_wait_scan.ko 
     981  INSTALL net/netfilter/xt_mark.ko 
     982  DEPMOD  2.6.35.14 
     983+ mkinitramfs -o /boot/initrd.img-2.6.35.14 2.6.35.14 
     984+ update-grub 
     985Generating grub.cfg ... 
     986Found linux image: /boot/vmlinuz-2.6.35.14 
     987Found initrd image: /boot/initrd.img-2.6.35.14 
     988Found linux image: /boot/vmlinuz-2.6.32-33-generic 
     989Found initrd image: /boot/initrd.img-2.6.32-33-generic 
     990Found memtest86+ image: /boot/memtest86+.bin 
     991done 
     992+ echo Install Kernel Headers to /lib/modules/2.6.35.14/build 
     993Install Kernel Headers to /lib/modules/2.6.35.14/build 
     994+ date +%Y%m%d 
     995+ mv /lib/modules/2.6.35.14/build /lib/modules/2.6.35.14/build-20110930 
     996+ cd /mnt/hgfs/ 
     997+ egrep -v .o$ 
     998+ egrep -v vmlinu 
     999+ tar c --files-from - 
     1000+ tar x -C /lib/modules/2.6.35.14/ 
     1001+ find linux-2.6.35.14 -type f 
     1002+ mv /lib/modules/2.6.35.14/linux-2.6.35.14 /lib/modules/2.6.35.14/build 
     1003+ uname -a 
     1004Linux ubuntu-lucid64 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:07:13 UTC 2011 x86_64 GNU/Linux 
     1005}}} 
     1006 * s0711489@ubuntu-lucid64:~$ sudo reboot 
     1007 
     1008 * s0711489@ubuntu-lucid64:~$ uname -a 
     1009 * s0711489@ubuntu-lucid64:~$ sudo vmware-config-tools.pl --default 
     1010 
     1011 == step execution with GDB == 
     1012 * s0711489@ubuntu-lucid64:~/coursework/KernelHack/02$ cat > getpid.c 
     1013{{{#!cc 
     1014#include <sys/types.h> 
     1015#include <syscall.h> 
     1016#include <stdio.h> 
     1017 
     1018int main (void) { 
     1019        printf ("getpid() -> %d\n", getpid()); 
     1020} 
     1021}}} 
     1022 
     1023 * s0711489@ubuntu-lucid64:~/coursework/KernelHack/02$ cc getpid.c -o getpid 
     1024 * s0711489@ubuntu-lucid64:~/coursework/KernelHack/02$ strace -f -o getpid.log ./getpid 
     1025{{{ 
     1026getpid() -> 2007 
     1027}}} 
     1028 
     1029 * windell57:x86_64 s0711489$ gdb 
     1030{{{ 
     1031(gdb) file vmlinux 
     1032Reading symbols from /home/ugrad/07/s0711489/coursework/KernelHack/linux-2.6.35.14/x86_64/vmlinux...(no debugging symbols found)...done. 
     1033(gdb) target remote localhost:8864 
     1034}}} 
     1035{{{ 
     1036(gdb) help step 
     1037Step program until it reaches a different source line. 
     1038Argument N means do this N times (or till program stops for another reason). 
     1039(gdb) help next 
     1040Step program, proceeding through subroutine calls. 
     1041Like the "step" command as long as subroutine calls do not happen; 
     1042when they do, the call is treated as one instruction. 
     1043Argument N means do this N times (or till program stops for another reason). 
     1044}}} 
     1045  * 初めのうちはnextを使っていたため、サブルーチンコールがスキップされてしまい、うまく実行コードを見ることが出来なかった。 
     1046 
     1047 * windell57:02 s0711489$ cat > gdb.step.sh 
     1048{{{#!sh 
     1049echo 'file vmlinux 
     1050target remote localhost:8864' 
     1051yes s 
     1052}}} 
     1053 
     1054 * s0711489@ubuntu-lucid64:~/coursework/KernelHack/02$ while true; do ./getpid ;done 
     1055{{{ 
     1056getpid() -> 1816 
     1057getpid() -> 1817 
     1058 
     1059(snip) 
     1060 
     1061getpid() -> 2846 
     1062getpid() -> 2847 
     1063getpid() -> 2848 
     1064Killed by signal 15. 
     1065}}} 
     1066 
     1067 * windell57:x86_64 s0711489$ sh ../../02/gdb.step.sh | gdb > gdb.txt 
     1068 
     1069 * stepコマンドだけでは、実行されるコードが膨大すぎて、目当てのgetpidシステムコールまで到達出来なかった