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. 用UNetbootin轻松把Linux操作系统装进U盘

    转自http://www.hackbase.com/tech/2009-02-14/51197.html1.下载Linux发行版的iso镜像.    如Hiweed GNU/Linux:http:// ...

  2. [转]浅析360的危害 & 我为什么推荐卸载360

    http://blog.eqoe.cn/posts/fuck-360-ass.html 首先放一些证据: [视频证据]360安全浏览器暗设后门 360SE.BackDoor.超清可用WMP播放 密码: ...

  3. POJ 3233 Matrix Power Series (矩阵乘法)

    Matrix Power Series Time Limit: 3000MS   Memory Limit: 131072K Total Submissions: 11954   Accepted:  ...

  4. 简述Android触摸屏手势识别

    很多时候,利用触摸屏的Fling.Scroll等Gesture(手势)操作来操作会使得应用程序的用户体验大大提升,比如用Scroll手势在 浏览器中滚屏,用Fling在阅读器中翻页等.在Android ...

  5. 转python+selenium 使用switch_to_alert 出现的怪异常

    如果switch_to_alert不工作,最重要的问题就是,有1个以上的浏览器开启,导致alert抓取不到.并且在使用switch_to_alert的时候时间会比较长一些,需要等待一会儿才能完成acc ...

  6. 关于c语言内存分配,malloc,free,和段错误,内存泄露

    1.   C语言的函数malloc和free (1) 函数malloc和free在头文件<stdlib.h>中的原型及参数        void * malloc(size_t size ...

  7. tomcat配置外部静态资源映射路径

    一.背景 1.有一个录音软件每天生成很多新的录音文件. 2.现在想通过一个WEB项目页面下载这些录音文件. 3.很显然这些录音文件放在WEB项目下不是很合适(WEB项目更新是个大麻烦,海量的录音文件要 ...

  8. C++ main函数命令行参数使用

    1. C/C++语言中的main函数,经常带有参数argc,argv,如下: int main(int argc, char** argv) int main(int argc, char* argv ...

  9. 把git上的larave项目通过SourceTree安装上再通过composer安装依赖库

    1.项目地址克隆 https://gitee.com/fps2tao/laravel5.5-alitaobao.git 通过SourceTree工具下载到本地 2.在命令行方式打开项目地址安装依赖库( ...

  10. mysqld_safe与mysqld区别详解

    mysqld_safe与mysqld区别,直接运行mysqld程序来启动MySQL服务的方法很少见,mysqld_safe脚本会在启动MySQL服务器后继续监控其运行情况,并在其死机时重新启动它. 用 ...