cmdline demo
1.使用cmdline_append()添加cmdline选项
if (1)
cmdline_append("is_smartpa_detect=0");s
else
cmdline_append("is_smartpa_detect=1");
#endif
2.kernel起来后,使用adb shell "cat /proc/cmdline"查看,comline选项是否添加进去。
3.在kenerl获取lk传进来的参数,进行处理
static int __init is_smartpa_detect(char *str)
{
if (strcmp(str, "1")) {
is_smartpa = 1;
} else {
is_smartpa = 0;
}
printk("Func:%s is_smartpa_detect:%d",__func__,is_smartpa);
return 0;
}
__setup("is_smartpa_detect=", is_smartpa_detect);