Linux kernel4.4.12 添加make menuconfig 可选项
Linux kernel 源码添加可选项
闲来无事,顺便记录一篇在Linux kernel make menuconfig 内添加一个可选项。
说不定将来就要用到这个东西呢。
linux kernel 的配置系统由以下三个部分组成。
Makefile: 分布在Linux 内核源代码中,定义Linux kernel的编译规则。
配置文件:(kconfig) 给用户提供配置选择的功能。
配置工具:包括配置命令解析器和配置用户界面。这些配置工具使用的都是脚本语言,如Perl。
最常使用的,我们一般使用make menuconfig 进行配置我们自己想要的。
这里面我们看到很多可以选择的选项,那么如果我们自己要增加自己的选项该怎么办呢。
网上有很多教程都是在drivers里面添加,我这里讲一种就是直接如果自己想建一个目录,然后添加里面的模块该怎么做。
###过程:
我首先在顶层目录建一个目录chentest
cd $KERNEL_DIR
mkdir chentest
vim chentest.c
chentest.c:
#include <linux/init.h>
#include <linux/module.h>
int __init chen_init(void)
{
printk("start\n");
return 0;
}
module_init(chen_init);
void __exit chen_exit(void)
{
printk("end\n");
}
module_exit(chen_exit);
MODULE_AUTHOR("chenfl");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("This is test modules");
MODULE_VERSION("V1.0");
vim Makefile
Makefile:
obj-$(CONFIG_CHENTEST) += chen_test.o
vim Kconfig
Kconfig:
menu "chentest"
config CHEN_TEST
tristate "This is a test"
default y
help
Say Y here if you have any input device (mouse, keyboard, tablet,
joystick, steering wheel ...) connected to your system and want
it to be available to applications. This includes standard PS/2
keyboard and mouse.
Say N here if you have a headless (no monitor, no keyboard) system.
More information is available: <file:Documentation/input/input.txt>
If unsure, say Y.
To compile this driver as a module, choose M here: the
module will be called input.
if CHEN_TEST
config CONFIG_CHENTEST
tristate "chentest"
help
Say Y here if you have memoryless force-feedback input device
such as Logitech WingMan Force 3D, ThrustMaster FireStorm Dual
Power 2, or similar. You will also need to enable hardware-specific
driver.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called ff-memless.
endif
endmenu
好了大概到了这一步,准备工作差不多做好了,然后你的arm架构的话,需要在arm/arch/Kconfig
里面添加一句话。
大概在 这个位置添加:sourch "chentest/Kconfig"
2167 source "drivers/Kconfig"
2168
2169 source "chentest/Kconfig"
2170
2171 source "drivers/firmware/Kconfig
make ARCH=arm menuconfig
看 Device Drivers 下面是不是多了个选项 chentest
Linux kernel4.4.12 添加make menuconfig 可选项的更多相关文章
- [Linux] Ubuntu Server 12.04 LTS 平台上搭建WordPress(Nginx+MySql+PHP) Part II
接着上一节继续搭建我们的LNMP平台,接下来我们安装PHP相关的服务 sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5- ...
- Linux 用户名、主机添加背景色
文章参考:PS1应用之——修改linux终端命令行各字体颜色 Linux 用户名.主机添加背景色,用于生产环境,这样可以减少人为的误操作. [root@zhang ~]# tail /etc/bash ...
- Linux平台Oracle 12.1.0.2 单实例安装部署
主题:Linux平台Oracle 12.1.0.2 单实例安装部署 环境:RHEL 6.5 + Oracle 12.1.0.2 需求:安装部署OEM 13.2需要Oracle 12.1.0.2版本作为 ...
- ASP .Net Core系统部署到SUSE Linux Enterprise Server 12 SP3 64 具体方案
.Net Core 部署到 SUSE Linux Enterprise Server 12 SP3 64 位中的步骤 1.安装工具 1.apache 2..Net Core(dotnet-sdk-2. ...
- ASP .Net Core系统部署到SUSE 16 Linux Enterprise Server 12 SP2 64 具体方案
.Net Core 部署到 SUSE 16 Linux Enterprise Server 12 SP2 64 位中的步骤 1.安装工具 1.apache 2..Net Core(dotnet-sdk ...
- ASP.NET Core 2.0 MVC 发布部署--------- SUSE 16 Linux Enterprise Server 12 SP2 X64 具体操作
.Net Core 部署到 SUSE 16 Linux Enterprise Server 12 SP2 64 位中的步骤 1.安装工具 1.apache 2..Net Core(dotnet-sdk ...
- SUSE Linux Enterprise Serve 12 试用体验
SUSE Linux Enterprise Serve 12 试用体验 大家都知道德国出产的奔驰.宝马.等车型以精美.可靠.耐用而著称.而相同出自德国人之手的Suse Linux .即使是被收购也是一 ...
- Lab1:Linux内核编译及添加系统调用(详细版)
实验一:Linux内核编译及添加系统调用(HDU) 花了一上午的时间来写这个,良心制作,发现自己刚学的时候没有找到很详细的,就是泛泛的说了下细节地方也没有,于是自己写了这个,有点长,如果你认真的看完了 ...
- linux下查看和添加PATH环境变量
linux下查看和添加PATH环境变量 $PATH:决定了shell将到哪些目录中寻找命令或程序,PATH的值是一系列目录,当您运行一个程序时,Linux在这些目录下进行搜寻编译链接. 编辑你的 PA ...
随机推荐
- [LeetCode] Sliding Window Maximum 滑动窗口最大值
Given an array nums, there is a sliding window of size k which is moving from the very left of the a ...
- CoreOS和Docker入门
转载自: http://www.oschina.net/translate/coreos_and_docker_first_steps?cmp CoreOS是一个基于Linux,systemd和Doc ...
- python基础补漏-06-内置模块
1> sys 模块 sys.argv 命令行参数List,第一个元素是程序本身路径 sys.exit(n) 退出程序,正常退出时exit(0) sys.version 获取Python解释程序的 ...
- 一个脚本可以一直运行 ignore_user_abort
php中ignore_user_abort函数的用法 PHP中的ignore_user_abort函数是当用户关掉终端后脚本不停止仍然在执行,可以用它来实现计划任务与持续进程,下面会通过实例讨论ign ...
- 定制sqlmap tamper脚本
前言 渗透测试过程中遇到注入点常常丢到sqlmap中进行测试,假如网站有waf,sqlmap便无法直接注入了. 测试 在测试某个项目的过程中,一个页面的aid参数,习惯性的提交 and 1=1发现直接 ...
- POJ2175 Evacuation Plan
Evacuation Plan Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4617 Accepted: 1218 ...
- Linux 基础
命令说明 $ type cmd # 获取命令类型 $ which cmd # 命令的位置 $ help cmd / cmd --help / man cmd # 获取命令帮助 $ whatis cmd ...
- C#微信公众平台接入示例代码
http://mp.weixin.qq.com/wiki/17/2d4265491f12608cd170a95559800f2d.html 这是微信公众平台提供的接入指南.官网只提供了php的示例代码 ...
- dietpi请暂时不要升级为jessie
关于升级到Debian最新稳定版jessie,作者是这样说的:一旦官方Raspbian升级到Jessie,DietPi也会随之切换到Jessie.由于改动较大,很多功能需要修改后才能正常使用,到时候可 ...
- 高端大气上档次的fullPage.js
简介 4月15日,网易邮箱升级到6.0版本,并发布了介绍页面,页面采用了时下非常流行的"全屏"效果,文字.图片再加上 CSS3 动画,让用户非常直观.清晰的了解6.0版本的功能及特 ...