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” 系列文章中),一来通过内核 ...
随机推荐
- 学了这四招,你在Linux上观看Netflix视频不发愁
导读 一份崭新的Linux发行版已经安装到你的电脑上,你完全准备好使用免费开源办公软件处理长时间的工作.但是你可能会问自己:"难道除了工作,就没有乐趣可言?我就是想观看Netflix视频!& ...
- Disable right click on the website
Many developers/website owners like to keep their website images personal and don't want anyone to c ...
- Robot Framework简介
概述 Robot Framework是一个通用的关键字驱动自动化测试框架.测试用例以HTML,纯文本或TSV(制表符分隔的一系列值)文件存储. 通过测试库中实现的关键字驱动被测软件.Robot Fra ...
- 文件共享windows server 2008 服务器
1.远程连接到windows server2008 E盘右键共享 2.不能创建文件夹 右键E盘→共享→高级共享→权限→全部打勾即可. 3.ok,文件服务器
- 关于在Android设置全局变量随时获取context
最实在的办法就是继承Application,在里面设置全局变量,因为Application是android的应用入口,并且运行周期贯穿整个程序运行. import android.app.Applic ...
- tachyon 本地模式安装
本地模式不用考虑hadoop的版本,所以直接下载 binary 包或者自己编译 1.配置主机名.JDK.关闭防火墙.关闭Selinux.配置hosts ... ... 2.设置本机SSH免密码登陆 . ...
- Xcode 8:在 Active Compilation Conditions 中自定义环境变量
来源:没故事的卓同学 链接:http://www.jianshu.com/p/96b36360bb2d 在Xcode 7我们在 OTHER_SWIFT_FLAGS中配置环境变量.但是有一个不爽的地方就 ...
- 认识C中的结构体
C中结构体是另外一种表示数据形式的方式,结构体中可以表示C中的基本数据形式,如int,double....结构体可以让我们更好的表示数据.下面来看看结构体. 说到结构体首先要了解的是它的申明形式,要申 ...
- Linux 下configure 参数配置与软件的安装与卸载
Linux环境下的软件安装,并不是一件容易的事情:如果通过源代码编译后在安装,当然事情就更为复杂一些:现在安装各种软件的教程都非常普遍:但万变不离其中,对基础知识的扎实掌握,安装各种软件的问题就迎刃而 ...
- K - Ancient Messages(dfs求联通块)
K - Ancient Messages Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Subm ...