u-boot到kernel命令行参数设置及传递

软件配置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中  


2,CONFIG_BOOTARGS被转化为bootargs
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

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值