【驱动】内核打印级别设置

在uboot中设置

setenv loglevel 'loglevel=8'
setenv loglevel debug
setenv loglevel quiet
setenv loglevel
setenv mmcargs 'run set_disp; setenv bootargs console=${console},${baudrate} ${loglevel} ${smp} root=${mmcroot} ${disp_args}'

内核对应代码

main.c (init) 467

static int __init debug_kernel(char *str)
{
	console_loglevel = 10;
	return 0;
}

static int __init quiet_kernel(char *str)
{
	console_loglevel = 4;
	return 0;
}

early_param("debug", debug_kernel);
early_param("quiet", quiet_kernel);

static int __init loglevel(char *str)
{
	int newlevel;

	/*
	 * Only update loglevel value when a correct setting was passed,
	 * to prevent blind crashes (when loglevel being set to 0) that
	 * are quite hard to debug
	 */
	if (get_option(&str, &newlevel)) {
		console_loglevel = newlevel;
		return 0;
	}

	return -EINVAL;
}

early_param("loglev

你可能感兴趣的:(linux驱动,内核,调试)