软件配置env的情况(CONFIG_ENV_IS_NO_WHERE=y)
1, 在u-boot/include/configs/xxx_config.h配置文件中我们可以找到CONFIG_BOOTARGS配置项,在这里我们可以设置要传递的到内核的命令行参数
u-boot/include/configs/xxx_config.h:#define CONFIG_BOOTARGS \
"console=ttyAMA0,115200 loglevel=7 panic=3 isolcpus=1-15 nohz_full=1-11"
#loglevel=7 意思是如果kernel的打印(printk)优先级级别大于7(值越小优先级越高),将会打印到console上,但都会存储到dmesg的ring buffer中
u-boot/include/env_default.h:
const uchar default_environment[] = {
#ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT
ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0"
#endif
#ifdef CONFIG_ENV_FLAGS_LIST_DEFAULT
ENV_FLAGS_VAR "=" CONFIG_ENV_FLAGS_LIST_DEFAULT "\0"
#endif
#ifdef CONFIG_BOOTARGS
"bootargs=" CONFIG_BOOTARGS "\0"
#endif
#ifdef CONFIG_BOOTCOMMAND
"bootcmd=" CONFIG_BOOTCOMMAND "\0"
#endif
#ifdef CONFIG_RAMBOOTCOMMAND
"ramboot=" CONFIG_RAMBOOTCOMMAND "\0"
#endif
3,arch/arm/lib/bootm.c(maybe?):
调用getenv ("bootargs")函数获得命令行参数并让commandline指向它,然后调用setup_commandline_tag函数将命令行参数放到tag参数例表
boot_prep_linux:
char *commandline = getenv("bootargs");
setup_commandline_tag(gd->bd, commandline);
省略其他处理过程...
4,kernel处理,lfs_linux/init/main.c
start_kernel:
pr_notice("Kernel command line: %s\n", boot_command_line);
parse_early_param();
Print in kernel startup phase:
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 3897872
[ 0.000000] Kernel command line: console=ttyAMA0,115200 loglevel=7 panic=3 isolcpus=1-15
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
refer to:
http://blog.chinaunix.net/uid-20672257-id-2395102.html