setup.h通过宏定义实现了bootargs传递参数到内核,值得以后编程学习。

include/asm-arm/setup.h

14  * NOTE:
 15  *  This file contains two ways to pass information from the boot
 16  *  loader to the kernel. The old struct param_struct is deprecated,
 17  *  but it will be kept in the kernel for 5 years from now
 18  *  (2001). This will allow boot loaders to convert to the new struct
 19  *  tag way.

The new way of passing infomation: a list of tagged eneries.

208 struct tag {
209     struct tag_header hdr;
210     union {
211         struct tag_core     core;
212         struct tag_mem32    mem;
213         struct tag_videotext    videotext;
214         struct tag_ramdisk  ramdisk;
215         struct tag_initrd   initrd;
216         struct tag_serialnr serialnr;
217         struct tag_revision revision;
218         struct tag_videolfb videolfb;
219         struct tag_cmdline  cmdline;
220
221         /*
222          * Acorn specific
223          */
224         struct tag_acorn    acorn;
225
226         /*
227          * DC21285 specific
228          */
229         struct tag_memclk   memclk;
230     } u;
231 };
232
233 struct tagtable {
234     u32 tag;
235     int (*parse)(const struct tag *);
236 };

实现参数遍历:

238 #define __tag __attribute__((unused, __section__(".taglist")))
239 #define __tagtable(tag, fn) \
240 static struct tagtable __tagtable_##fn __tag = { tag, fn }
241
242 #define tag_member_present(tag,member)              \
243     ((unsigned long)(&((struct tag *)0L)->member + 1)   \
244         <= (tag)->hdr.size * 4)
245
246 #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size))
247 #define tag_size(type)  ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
248
249 #define for_each_tag(t,base)        \
250     for (t = base; t->hdr.size; t = tag_next(t))
具体应用在lib_arm/bootm.c

uboot中bootargs实现的更多相关文章

  1. u-boot中分区和内核MTD分区关系

    一.u-boot中环境变量与uImage中MTD的分区关系 分区只是内核的概念,就是说A-B地址放内核,C-D地址放文件系统,(也就是规定哪个地址区间放内核或者文件系统)等等. 一般我们只需要分3-4 ...

  2. 在uboot中加入cmd_run命令,运行环境变量

    在学习uboot的过程中会经常烧录程序,每次都要敲一些下载指令.这样是不是很麻烦,有什么办法能快速的烧写呢.很简单,将需要敲击的指令编译到uboot中,以环境变量的形式存在.但是环境变量很好加,如何运 ...

  3. uboot中变量env(收集)

    Env在u-boot中通常有两种存在方式,在永久性存储介质中(flash.NVRAM等),在SDRAM中.可配置不适用env的永久存储方式,但不常用.U-boot在启动时会将存储在永久性存储介质中的e ...

  4. u-boot中环境变量的实现

    转载:http://blog.chinaunix.net/uid-28236237-id-3867041.html U-boot中通过环境参数保存一些配置,这些配置可以通过修改环境参数.保存环境参数. ...

  5. 关于NAND flash的MTD分区与uboot中分区的理解

    关于NAND flash的MTD分区与uboot中分区的理解 转自:http://blog.csdn.net/yjp19871013/article/details/6933455?=40085044 ...

  6. u-boot中添加mtdparts支持以及Linux的分区设置

    简介 作者:彭东林 邮箱:pengdonglin137@163.com u-boot版本:u-boot-2015.04 Linux版本:Linux-3.14 硬件平台:tq2440, 内存:64M   ...

  7. uboot中添加自定义命令

    uboot中可以通过修改源程序来添加自定义命令,进一步扩展uboot的功能. 我想在uboot下添加一条新的命令(名为varcpy),用来拷贝uboot中的环境变量. 修改方式如下: 创建新文件com ...

  8. uboot中setenv和saveenv分析

    转:https://blog.csdn.net/weixin_34355715/article/details/85751477 Env在u-boot中通常有两种存在方式,在永久性存储介质中(flas ...

  9. uboot中添加FIQ中断及相关问题

    本文主要说明了在uboot中添加FIQ中断时遇到的问题以及对应的解决办法. 首先交代一下项目的软硬件环境.硬件方面,使用s3c2440作为主控芯片,外接串口.网卡等设备.软件方面,主控芯片上电后运行u ...

随机推荐

  1. 【LeetCode】9. Palindrome Number (2 solutions)

    Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. click t ...

  2. 【LeetCode】107. Binary Tree Level Order Traversal II (2 solutions)

    Binary Tree Level Order Traversal II Given a binary tree, return the bottom-up level order traversal ...

  3. JQuery中事件one、bind、unbind、live、delegate、on、off、trigger、triggerHandler的各种使用区别

    JQuery事件one,支持参数 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> & ...

  4. HTML中button和input button的区别

    button和input button的区别 一句话概括主题:<button>具有<input type="button" ... >相同的作用但是在可操控 ...

  5. duplicate files during packaging of apk

    OSChina Android APP 导入到Android Studio中不能运行,发现一小插曲. 主要实现了开源中国社区 OSC Android 客户端项目源码通过Gradle方式编译 在 And ...

  6. Jmeter----逻辑控制器(Logic Controller)

    前言: 1. Jmeter官网对逻辑控制器的解释是:“Logic Controllers determine the order in which Samplers are processed.”.意 ...

  7. android自定义控件实例

    很多时候android常用的控件不能满足我们的需求,那么我们就需要自定义一个控件了.今天做了一个自定义控件的实例,来分享下. 首先定义一个layout实现按钮内部布局: 01 <?xml ver ...

  8. 匿名管道和pipe函数

    一.进程间通信 每个进程各自有不同的用户地址空间,任何一个进程的全局变量在另一个进程中都看不到,所以进程之间要交换数据必须通过内核,在内核中开辟一块缓冲区,进程1把数据从用户空间拷到内核缓冲区,进程2 ...

  9. python标准库介绍——28 md5 模块详解

    ==md5 模块== ``md5`` (Message-Digest Algorithm 5)模块用于计算信息密文(信息摘要). ``md5`` 算法计算一个强壮的128位密文. 这意味着如果两个字符 ...

  10. django1.8forms读书笔记

    一.HttpRequest对象的一些属性或方法 request.path,The full path, not including the domain but including the leadi ...