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” 系列文章中),一来通过内核 ...
随机推荐
- Xcode常见的编译、运行等错误的解决
Xcode常见的编译.运行等错误的解决 项目没找到Info.plist的错误 The solution for this particular instance of the error was “I ...
- linux内存——/proc/sys/vm/drop_caches
原贴:http://www.linuxfly.org/post/320/ http://blog.csdn.net/chinalinuxzend/article/category/265273/2 ...
- C#泛型(C#_编程指南)CSDN学习整理笔记
1.1. 泛型概述 2.0版C#语言和公共语言运行时(CLR)中增加了泛型.泛型将类型参数的概念引入.NETFramework,类型参数使得设计如下类和方法成为可能:这些类和方法将一个或多个类型的指定 ...
- Android小项目之二 代码的组织结构
------- 源自梦想.永远是你IT事业的好友.只是勇敢地说出我学到! ---------- 按惯例,写在前面的:可能在学习Android的过程中,大家会和我一样,学习过大量的基础知识,很多的知识点 ...
- Spring-boot & spring.security
spring.security提供了一种身份认证框架,开发者可以在这个框架中实现各种方式的用户身份管理,比如:LDAP.MYSQL.OAUTH.Mongo等等. spring.security认证步骤 ...
- IE兼容性问题列表及解决办法
目录 概述 2 第一章:HTML 3 第一节:IE7-IE8更新 31. 如果缺少结束标记的 P 元素后跟 TABLE.FORM.NOFRAMES 或 NOSCRIPT 元素,会自动添加结束标记. 3 ...
- Jquery 实现点击一个页面跳转后在另外一个页面显示指定位置
<script> $(function(){ var isTarget = '<?php echo $_GET['target']; ?>'; if (isTarget != ...
- SpringData JPA详解
Spring Data JPA 1. 概述 Spring JPA通过为用户统一创建和销毁EntityManager,进行事务管理,简化JPA的配置等使用户的开发更加简便. Spring Data ...
- 怒刷DP之 HDU 1029
Ignatius and the Princess IV Time Limit:1000MS Memory Limit:32767KB 64bit IO Format:%I64d &a ...
- UVA 113 Power of Cryptography (数学)
Power of Cryptography Background Current work in cryptography involves (among other things) large p ...