生成linux内核API文档

最近在学习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
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值