redhat server 5.3内核升极2.6.18 升级到 3.5 装systemtap 原创
1. 在 LINUX 3.5源代碼目錄下執行? yum install ncurses-devel??? ?make menuconfig
?
2? 打開內核跟蹤事件,用于SYSTEMTAP跟蹤
?? kernel hacking --->tracers(new)--->enable uprobes-based dynamic events
?? 文件系統相關選項要打開
??
即為
CONFIG_SYSFS_DEPRECATED_V2=y
不這樣設為出錯,安裝內核重起后就會出現如下狀況
?mount: could not find filesystem ‘/dev/root’
?setuproot: moving /dev failed: No such file or directory
?setuproot: error mounting /proc: No such file or directory
?setuproot: error mounting /sys: No such file or directory
?switchroot: mount failed: No such file or directory
?
?
?3. 頭文件出錯
In file included from /usr/include/sys/time.h:31,
from /usr/include/linux/input.h:12,
from samples/hidraw/hid-example.c:14:
/usr/include/sys/select.h:78: error: conflicting types for 'fd_set'
/usr/include/linux/types.h:12: error: previous declaration of 'fd_set' was here
In file included from /usr/include/linux/input.h:14,
from samples/hidraw/hid-example.c:14:
/usr/include/sys/types.h:46: error: conflicting types for 'loff_t'
/usr/include/linux/types.h:30: error: previous declaration of 'loff_t' was here
/usr/include/sys/types.h:62: error: conflicting types for 'dev_t'
/usr/include/linux/types.h:13: error: previous declaration of 'dev_t' was here
In file included from /usr/include/sys/types.h:133,
from /usr/include/linux/input.h:14,
from samples/hidraw/hid-example.c:14:
/usr/include/time.h:105: error: conflicting types for 'timer_t'
/usr/include/linux/types.h:22: error: previous declaration of 'timer_t' was here
In file included from /usr/include/linux/input.h:14,
from samples/hidraw/hid-example.c:14:
/usr/include/sys/types.h:198: error: conflicting types for 'int64_t'
/usr/include/linux/types.h:98: error: previous declaration of 'int64_t' was here
/usr/include/sys/types.h:204: error: conflicting types for 'u_int64_t'
/usr/include/linux/types.h:97: error: previous declaration of 'u_int64_t' was here
In file included from /usr/include/linux/input.h:14,
from samples/hidraw/hid-example.c:14:
/usr/include/sys/types.h:235: error: conflicting types for 'blkcnt_t'
/usr/include/linux/types.h:114: error: previous declaration of 'blkcnt_t' was here
mples/hidraw/hid-example.c:35:26: error: linux/hidraw.h: No such file or directory
samples/hidraw/hid-example.c: In function ‘main’:
samples/hidraw/hid-example.c:50: error: storage size of ‘rpt_desc’ isn’t known
samples/hidraw/hid-example.c:51: error: storage size of ‘info’ isn’t known
samples/hidraw/hid-example.c:67: error: ‘HIDIOCGRDESCSIZE’ undeclared (first use in this function)
samples/hidraw/hid-example.c:67: error: (Each undeclared identifier is reported only once
samples/hidraw/hid-example.c:67: error: for each function it appears in.)
samples/hidraw/hid-example.c:75: error: ‘HIDIOCGRDESC’ undeclared (first use in this function)
samples/hidraw/hid-example.c:86: warning: implicit declaration of function ‘HIDIOCGRAWNAME’
samples/hidraw/hid-example.c:93: warning: implicit declaration of function ‘HIDIOCGRAWPHYS’
samples/hidraw/hid-example.c:100: error: ‘HIDIOCGRAWINFO’ undeclared (first use in this function)
samples/hidraw/hid-example.c:51: warning: unused variable ‘info’
samples/hidraw/hid-example.c:50: warning: unused variable ‘rpt_desc’
make[2]: *** [samples/hidraw/hid-example] Error 1
make[1]: *** [samples/hidraw] Error 2
make: *** [vmlinux] Error 2
處理方法:
?[root@localhost linux-3.5]# cp include/linux/hidraw.h /usr/include/linux/
?[root@localhost linux-3.5]# cp include/linux/hid.h /usr/include/linux/
vi? samples/hidraw/hid-example.c
將13-15行的如下3行移動到33行以后。/* Linux */ #include <linux/types.h> #include <linux/input.h> #include <linux/hidraw.h>/* Unix */ #include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h>/* C */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h>vi /usr/include/linux/input.h
line 647 #define BUS_PCI 0x01 #define BUS_ISAPNP 0x02 #define BUS_USB 0x03 #define BUS_HIL 0x04 #define BUS_BLUETOOTH 0x05 /*以下一行為新增*/ #define BUS_VIRTUAL 0x06 #define BUS_ISA 0x10 #define BUS_I8042 0x11 #define BUS_XTKBD 0x12 #define BUS_RS232 0x13 #define BUS_GAMEPORT 0x14 #define BUS_PARPORT 0x15 #define BUS_AMIGA 0x16 #define BUS_ADB 0x17 #define BUS_I2C 0x18 #define BUS_HOST 0x19 #define BUS_GSC 0x1A /*以下兩行為新增*/ #define BUS_ATARI 0x1B #define BUS_SPI 0x1C?4.確定參數設置 .config
[root@localhost linux-3.5]# cat .config | grep CONFIG_DEBUG_INFO CONFIG_DEBUG_INFO=y [root@localhost linux-3.5]# cat .config | grep CONFIG_KPROBES CONFIG_KPROBES=y [root@localhost linux-3.5]# cat .config | grep CONFIG_RELAY CONFIG_RELAY=y [root@localhost linux-3.5]# cat .config | grep CONFIG_DEBUG_FS CONFIG_DEBUG_FS=y [root@localhost linux-3.5]# cat .config | grep CONFIG_MODULES CONFIG_MODULES=y [root@localhost linux-3.5]# cat .config | grep CONFIG_MODULE_UNLOAD CONFIG_MODULE_UNLOAD=y[root@localhost linux-3.5]#cat .config | grep CONFIG_UTRACE (linux 3.5 沒有這個選項) CONFIG_UTRACE=y[root@localhost linux-3.5]#cat .config | grep CONFIG_SYSFS_DEPRECATED_V2CONFIG_SYSFS_DEPRECATED_V2=y?5.make CONFIG_DEBUG_SECTION_MISMATCH=y???????? 編繹內核
? 故障問題:
? 編譯內核時出現“make CONFIG_DEBUG_SECTION_MISMATCH=y” 錯誤提示:
?? root@localhost linux-3.5]#make modules
?? CHK???? include/linux/version.h
?? CHK???? include/generated/utsrelease.h
?? CALL??? scripts/checksyscalls.sh
?? Building modules, stage 2.
?? MODPOST 1106 modules
? ?WARNING: modpost: Found 2 section mismatch(es).
?? To see full details build your kernel with:
?? 'make CONFIG_DEBUG_SECTION_MISMATCH=y'
?? 排錯記錄:
?? 編輯.config文件,加入:CONFIG_DEBUG_SECTION_MISMATCH=y重新編譯,還是出錯,于是直接
?? ?make CONFIG_DEBUG_SECTION_MISMATCH=y編譯成功。
??? root@localhost linux-3.5]#make CONFIG_DEBUG_SECTION_MISMATCH=y
?
6.make? modules_install
7.make install
8.make headers_install
?
?
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的redhat server 5.3内核升极2.6.18 升级到 3.5 装systemtap 原创的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ★ Linked List Cycle
- 下一篇: C#获取文件夹及文件的大小与占用空间的方