红联Linux门户
Linux帮助

生成linux内核API文档

发布时间:2016-09-16 15:46:38来源:zhaozicang的专栏作者:赵子苍
最近在学习linux内核相关的编程知识,想通过 man 来查看一下内核所提供的printk的函数的原型,结果提示:
No manual entry for …
正所谓自己动手丰衣足食,没有linux内核的API我们就自己动手来安装帮助文档。
 
S1: 到www.kernel.org中找到想构建的linux内核版本的源码,并下载到本机中。系统中自带的源码一般都不行,不要问我为什么。
 
S2: 下载完源码后解压
 
S3: 切换到解压后的源码的目录,并执行make mandocs
cd /usr/src/linux-3.8.1
make mandocs
 
S4:此时会有Error的提示,需要安装xmlto,下载并安装xmlto
sudo apt-get install xmlto
 
S5: 安装完成之后,再 make mandocs,这个过程比较慢,需要耐心等待一下。
 
S6: 之后再 make installdocs,PS: install 和 docs中间没有空格
大功告成!让我们看一下成果:
zhaozc@zhaozc-VirtualBox:~$ man printk  
PRINTK(9)  Driver Basics  PRINTK(9)
NAME
printk - print a kernel message
SYNOPSIS
int printk(const char * fmt, ...);
ARGUMENTS
fmt
format string
...
variable arguments
DESCRIPTION
This is printk. It can be called from any context. We want it to work.
We try to grab the console_lock. If we succeed, it's easy - we log the output and call the console drivers. If we fail to get the semaphore, we place the output into the log buffer and return. The current holder of the console_sem will notice the new output in console_unlock; and will send it to the consoles before releasing the lock.
One effect of this deferred printing is that code which calls printk and then changes console_loglevel may break. This is because console_loglevel is inspected when the actual printing occurs.
SEE ALSO
printf(3)
See the vsnprintf documentation for format string extensions over C99.
COPYRIGHT
 
本文永久更新地址:http://www.linuxdiyf.com/linux/24222.html