内核配置文件(比如arch\arm\configs\imx_v6_v7_defconfig)会配置宏 CONFIG_CMDLINE,用于某些情况下配置内核
CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
由以下代码可知,当设备树没有 bootargs,或者设置了CONFIG_CMDLINE_FORCE,则使用内核配置文件提供的CONFIG_CMDLINE
/* Retrieve command line */ p = of_get_flat_dt_prop(node, "bootargs", &l); if (p != NULL && l > 0) strlcpy(data, p, min(l, COMMAND_LINE_SIZE)); /* * CONFIG_CMDLINE is meant to be a default in case nothing else * managed to set the command line, unless CONFIG_CMDLINE_FORCE * is set in which case we override whatever was found earlier. */ #ifdef CONFIG_CMDLINE #if defined(CONFIG_CMDLINE_EXTEND) strlcat(data, " ", COMMAND_LINE_SIZE); strlcat(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); #elif defined(CONFIG_CMDLINE_FORCE) strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); #else /* No arguments from boot loader, use kernel's cmdl*/ if (!((char *)data)[0]) strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
标签:console,data,CMDLINE,COMMAND,linux,LINE,CONFIG,SIZE From: https://www.cnblogs.com/god-of-death/p/17589017.html