linux kernel with param
Linux kernel support pass param to kernel, this params can be assigned at load time by insmod or modprobe. or later read from /etc/modprobe.conf file.
There are two macro : module_param and module_param_array,
To declare an param or array param ,use:
module_param(name, type, perm) module_param_array(name, type, num, perm)
name is the name of your param or array.
type can be : bool ,invbool,charp, int, long, short, uint, ulong, ushort
num is the array num , array param where the values are supplied as a comma-separated list.
perm : S_IRUGO , S_IWUSR and so on .
int num = ;
static char* array[] = {NULL};
static int ntime = ;
static char* pstring = NULL; module_param_array(array, charp, &num, S_IRUGO);
module_param(ntime, int, S_IRUGO);
module_param(pstring, charp, S_IRUGO); static int __init init_func(void)
{
int i = ;
printk("string :%s, int :%d\n", pstring, ntime);
printk("Array\n");
for(; i < num; ++i)
printk("%s\n", array[i]);
return ;
}
执行:
sudo insmod ./hello.ko array="hello,world" pstring="test" ntime=10
linux kernel with param的更多相关文章
- andriod and linux kernel启动流程
虽然这里的Arm Linux kernel前面加上了Android,但实际上还是和普遍Arm linux kernel启动的过程一样的,这里只是结合一下Android的Makefile,讲一下boot ...
- Linux kernel的中断子系统之(五):驱动申请中断API
返回目录:<ARM-Linux中断系统>. 总结:二重点区分了抢占式内核和非抢占式内核的区别:抢占式内核可以在内核空间进行抢占,通过对中断处理进行线程化可以提高Linux内核实时性. 三介 ...
- Linux kernel pwn notes(内核漏洞利用学习)
前言 对这段时间学习的 linux 内核中的一些简单的利用技术做一个记录,如有差错,请见谅. 相关的文件 https://gitee.com/hac425/kernel_ctf 相关引用已在文中进行了 ...
- Linux kernel中断子系统之(五):驱动申请中断API【转】
转自:http://www.wowotech.net/linux_kenrel/request_threaded_irq.html 一.前言 本文主要的议题是作为一个普通的驱动工程师,在撰写自己负责的 ...
- Linux Kernel - Debug Guide (Linux内核调试指南 )
http://blog.csdn.net/blizmax6/article/details/6747601 linux内核调试指南 一些前言 作者前言 知识从哪里来 为什么撰写本文档 为什么需要汇编级 ...
- linux内核可以接受的参数 | Linux kernel启动参数 | 通过grub给内核传递参数
在Linux中,给kernel传递参数以控制其行为总共有三种方法: 1.build kernel之时的各个configuration选项. 2.当kernel启动之时,可以参数在kernel被GRUB ...
- Linux kernel make 常用选项介绍
Linux kernel 编译方法大全记录 一.这是一个我自己写的自动make脚本: #!/bin/sh export ARCH=arm export CROSS_COMPILE=arm-linux- ...
- Linux Kernel代码艺术——系统调用宏定义
我们习惯在SI(Source Insight)中阅读Linux内核,SI会建立符号表数据库,能非常方便地跳转到变量.宏.函数等的定义处.但在处理系统调用的函数时,却会遇到一些麻烦:我们知道系统调用函数 ...
- Linux Kernel 代码艺术——编译时断言
本系列文章主要写我在阅读Linux内核过程中,关注的比较难以理解但又设计巧妙的代码片段(不关注OS的各个模块的设计思想,此部分我准备写在“深入理解Linux Kernel” 系列文章中),一来通过内核 ...
随机推荐
- C++对象模型(虽然在GCC下很大的不同,但是先收藏)
C++对象模型 何为C++对象模型? 部分: 1. 语言中直接支持面向对象程序设计的部分 2. 对于各种支持的底层实现机制 语言中直接支持面向对象程序设计的部分,如构造函数 ...
- 40 JavaScript Chart and Graph Libraries for Developers--reference
reference:http://www.egrappler.com/javascript-chart-and-graph-libraries-for-developers/ BY TEAMEGRAP ...
- js的Touch事件
js的touch事件,一般用于移动端的触屏滑动$(function(){document.addEventListener("touchmove", _touch, false); ...
- JSON3-翻译(不当之处,请指正)
http://bestiejs.github.io/json3/JSON 3 显示了两个功能:stringify():序列化一个javaScript值为一个JSON,和parse():将一个json字 ...
- c#入门实例
1.概述 C#是一个语言,.net是一个平台,上面支持用C#或者VB.Net写代码 2.注释 若注释量较少用 // 开头,大量用 /* */ 表示 输出结果 3.命名空间 所谓n ...
- maven的update project是什么意思
一个是更新依赖,然后是clean projects,重新编译
- pxe+kickstart实现无人值守批量安装linux
pxe+kickstart实现无人值守批量安装linux 实验准备:主机myrhel2作为服务器端,新建一个没有安装操作系统的虚拟主机,而且其与服务器端在同一个网段 安装的条件: 服务器端: ...
- [书目20131223]Android、iPhone、Windows Phone手机网页及网站设计:最佳实践与设计精粹 - 张亚飞
目录 第I篇 手机版专用网站设计和开发入门篇 第1章 准备创作环境和测试环境 3 1.1 使用Mobile Safari测试网页 4 1.1.1 iOS Simulator安装 5 1.1.2 使用M ...
- CSS+DIV布局应用(2015年06月10日)
Div+css布局应用 一.html元素分类 2.1.顶级元素(Top-level element) 定义 组成html页面最顶级标签 特点 1. 不可设置宽高: 2. 必须在文档流中处于最高级位置: ...
- 非web项目中使用XDT的实例(续)
简化 上个实例中,我们是引用了target文件来遍历项目中的xdt项. 当项目比较小,我们又只需要针对固定的config文件进行更替时,可以使用更简化的方法 不进行项目配置文件中的插入<Impo ...