#!/bin/bash sed -i '/114.114/d' /etc/resolv.conf echo "nameserver 114.114.114.114" >> /etc/resolv.conf if [ -z `grep "debug" /etc/yum.repos.d/CentOS-Base.repo` ];then cat >> /etc/yum.repos.d/CentOS-Base.repo << "EOF" [debug] name=CentOS-6 - Debuginfo baseurl=http://debuginfo.centos.org/6/$basearch/ gpgcheck=0 enabled=0 EOF fi yum -y remove kernel* yum -y install kernel* yum -y --nogpgcheck --enablerepo=debug install kernel-debuginfo yum -y install elfutils elfutils-devel yum -y install systemtap vmlinux=`find /usr/lib/debug/ -name vmlinux` version=`echo $vmlinux |awk -F/ '{print $(NF-1)}'` ln -s $vmlinux /lib/modules/$version test -d /data/sh || mkdir -p /data/sh cat > /data/sh/tcp_init_cwnd.stp << "EOF" probe kernel.function("tcp_init_cwnd").return { $return = $1 } EOF reboot
stap -p4 -g -m initcwnd /data/sh/tcp_init_cwnd.stp 10 staprun -o initcwnd.out -D initcwnd.ko
安装kernel-debuginfo速度很慢,如果设备标准统一,可以直接分发安装包安装。
p2p分发参考:http://blogread.cn/it/article/6816?f=wb1