内核调试选项
来源:互联网 发布:实体店和淘宝买家具 编辑:程序博客网 时间:2024/06/08 08:15
用printk在终端看不到显示是因为printk是在kernel里面执行的啊 终端只是一个加载的过程
******************初稿待验证,本人对调试还不大了解************************
在前面已经建议过:学习编写驱动程序要构建安装自己的内核(标准主线内核)。最重要的原因之一是:内核开发者已经建立了多项用于调试的功能。但是由于这些功能会造成额外的输出,并导致能下降,因此发行版厂商通常会禁止发行版内核中的调试功能。
为了实现内核调试,我在内核配置上增加了几项:
Kernel hacking --->
[*] Magic SysRq key
[*] Kernel debugging
[*] Debug slab memory allocations
[*] Spinlock and rw-lock debugging: basic checks
[*] Spinlock debugging: sleep-inside-spinlock checking
[*] Compile the kernel with debug info
[*] Magic SysRq key
Device Drivers --->
Generic Driver Options --->
[*] Driver Core verbose debug messages
General setup --->
[*] Configure standard kernel features (for small systems) --->
[*] Load all symbols for debugging/ksymoops
为了方便的打开和关闭调试信息 Makefile中要添加的语句:
# Comment/uncomment the following line to disable/enable debugging
DEBUG = y
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
EXTRA_CFLAGS += $(DEBFLAGS)
完整的Makefile文件
# Comment/uncomment the following line to disable/enable debugging
DEBUG = y
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
EXTRA_CFLAGS += $(DEBFLAGS)
# Makefile2.6
ifneq ($(KERNELRELEASE),)
#kbuild syntax. dependency relationshsip of files and target modules are listed here.
mymodule-objs := hello.o #param-objs := file1.o file2.o
obj-m := hello.o #obj-m := param.o
else
PWD := $(shell pwd)
KVER ?= $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD)
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
.PHONY: modules modules_install clean
endif
- 内核调试选项
- 内核调试配置选项
- 调试内核:去掉优化选项
- 10006.编译内核选项
- Linux内核配置选项
- Linux 内核配置选项
- Linux内核编译选项
- Linux内核配置选项
- linux内核选项解释
- linxu内核配置选项
- linux 内核编译选项
- linux内核配置选项
- Linux内核配置选项
- Bsd内核选项总结
- Linux内核配置选项
- 注册内核选项
- 内核编译选项
- Linux内核配置选项
- ISTQB FL初级认证考试资料(中文)
- while() for()和i--,--i的详解
- poj1065 Wooden Sticks
- 三十分钟掌握STL
- Linux core 文件介绍
- 内核调试选项
- GTK区域化语言的一些整理
- Bcastr4.0Beta-flashimagesildeshow图片轮换播放
- The C10K problem
- DBHelper
- JsonConvert.js
- linux设备驱动开发------牛人
- ~~~新人报道
- 知名大学硕博论文及英文期刊全文资源集合