Chinaunix首页 | 论坛 | 博客
  • 博客访问: 427801
  • 博文数量: 123
  • 博客积分: 2686
  • 博客等级: 少校
  • 技术积分: 1349
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-23 22:11
文章分类
文章存档

2012年(3)

2011年(10)

2010年(100)

2009年(10)

我的朋友

分类: LINUX

2010-11-15 21:32:46

It is very easy to add a new boot parameter. In linux kernel, there is a macro name __setup(...).

Here is example:
 

#include <linux/init.h> // for function __setup(...)


157 extern long simple_strtol(const char *, char **, unsigned int);
158 unsigned long boot_cache_mask = 0;
159 static int __init cache_mask_setup(char *mask)
160 {
161 printk("@cache_mask_setup: mask = %s\n", mask);
162 boot_cache_mask = simple_strtol(mask, NULL, 0);
163 printk("@cache_mask_setup: boot_cache_mask = %ld\n", boot_cache_mask);
164 return 1;
165 }
166 __setup("cache_mask=", cache_mask_setup);


阅读(812) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~