openwrt 15.05 branch (Chaos Calmer)编译出的固件bootargs被覆盖

编译出的固件

bootargs参数被内核覆盖

内核不使用uboot传来的参数


查看代码发现在

内核代码\linux-3.18.27\arch\mips\ath79\prom.c中

调用prom_init => ath79_prom_init_cmdline => ath79_use_image_cmdline

进入了ath79_use_image_cmdline

在函数ath79_use_image_cmdline中使用了__image_cmdline

#ifdef CONFIG_IMAGE_CMDLINE_HACK
extern char __image_cmdline[];

static int __init ath79_use_image_cmdline(void)
{
	char *p = __image_cmdline;
	int replace = 0;

	if (*p == '-') {
		replace = 1;
		p++;
	}

	if (*p == '\0')
		return 0;

	if (replace) {
		strlcpy(arcs_cmdline, p, sizeof(arcs_cmdline));
	} else {
		strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
		strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
	}
	
	return 1;
}
#else
static inline int ath79_use_image_cmdline(void) { return 0; }
#endif


__image_cmdline

在汇编文件linux-3.18.27/arch/mips/kernel/head.S中导出

#ifdef CONFIG_IMAGE_CMDLINE_HACK
        .ascii  "CMDLINE:"
EXPORT(__image_cmdline)
        .fill   0x400
#endif /* CONFIG_IMAGE_CMDLINE_HACK */


你可能感兴趣的:(openwrt)