目前烧写完CC(chaos calmer 15.05)版本,查看其uboot变量如下:

ath> printenv
bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),14528k(rootfs),1408k(uImage),64k(mib0),64k(ART)
bootcmd=bootm 0x9fE80000
bootdelay=2
baudrate=115200
ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee
dir=
lu=tftp 0x80060000 ${dir}u-boot.bin&&erase 0x9f000000 +$filesize&&cp.b $fileaddr 0x9f000000 $filesize
lf=tftp 0x80060000 ${dir}openwrt-ar71xx-generic-ap143-16M-rootfs-squashfs.bin&&erase 0x9f050000 +0xE30000&&cp.b $fileaddr 0x9f050000 $filesize
lk=tftp 0x80060000 ${dir}openwrt-ar71xx-generic-ap143-16M-kernel.bin&&erase 0x9fE80000 +$filesize&&cp.b $fileaddr 0x9fE80000 $filesize
ethact=eth0
ipaddr=192.168.2.101
serverip=192.168.2.234
stdin=serial
stdout=serial
stderr=serial

Environment size: 742/65532 bytes

具体变量定义可以查看openwrt官网的声明。

地址如下:  https://wiki.openwrt.org/doc/techref/bootloader/uboot.config

下面简单介绍一下:

bootargs:The contents of this variable are passed to the Linux kernel as boot arguments (aka "command line").

传送给linux内核的参数,用于启动(boot),也称作命令行。

bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),14528k(rootfs),1408k(uImage),64k(mib0),64k(ART)

(1)console=ttyS0 串口

(2)115200  波特率为115200

(3)root=31:02     ?暂时不知什么意思

(4)rootfstype=jffs2  文件系统为jffs2

(5)init=/sbin/init   初始化脚本调用/sbin/init

(6)mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),14528k(rootfs),1408k(uImage),64k(mib0),64k(ART)

mtd分区为:   u-boot  256k

u-boot-env     64k

rootfs   14528k

uImage  1408k(linux 内核)

mib0   64k(factory)

ART    64k(无线校正区)

启动完成后,查看分区情况可以看到:

root@OpenWrt:/# cat /proc/mtd
      dev:    size         erasesize  name
      mtd0: 00040000 00010000 "u-boot"
      mtd1: 00010000 00010000 "u-boot-env"
      mtd2: 00e30000 00010000 "rootfs"
      mtd3: 00be0000 00010000 "rootfs_data"
      mtd4: 00160000 00010000 "kernel"
      mtd5: 00010000 00010000 "factory"
      mtd6: 00010000 00010000 "art"
      mtd7: 00f80000 00010000 "firmware"

bootcmd:This variable defines a command string that is automatically executed when the initial countdown is not interrupted. This command is only   executed when the variable bootdelay is also defined!

当初始化(initial)计时结束后开始执行此命令,此命令不可被中断,并且只能跟bootdelay一起使用。

bootcmd=bootm 0x9fE80000      跳转到地址0x9fE80000去启动

bootm命令可以引导启动存储在内存中的程序映像。这些内存包括RAM和可以永久保存的Flash。
第1个参数addr是程序映像的地址,这个程序映像必须转换成U-Boot的格式。
第2个参数对于引导Linux内核有用,通常作为U-Boot格式的RAMDISK映像存储地址;也可以是传递给Linux内核的参数(缺省情况下传递bootargs环境变量给内核)。
附加说明: 要求二进制代码为制定格式的。通常为mkimage处理过的二进制文件。起动UBOOT TOOLS制作的压缩LINUX内核, bootm 3200000

bootdelay:After reset, U-Boot will wait this number of seconds before it executes the contents of the bootcmd variable. During this time a countdown is printed, which can be interrupted by pressing any key. Set this variable to 0 boot without delay. Be careful: depending on the contents of your bootcmd variable, this can prevent you from entering interactive commands again forever! 
Set this variable to -1 to disable autoboot.

reset后,经过bootdelay的时间后,执行bootcmd命令。在此期间,打印countdown计时,此时可以按任意键打断。如果这个值设置为0,则立即执行bootcmd,无需等待bootdelay的时间。如果设置为-1,则进制自动启动(autoboot)

bootdelay=2  倒计时2 . 1 后执行bootcmd命令

baudrate:a decimal number that selects the console baudrate (in bps)

串口的波特率(单位:bps)

baudrate=115200

ethaddr:Ethernet MAC address for first/only ethernet interface (eth0 in Linux). 
This variable can be set only once (usually during manufacturing of the board). U-Boot refuses to delete or overwrite this variable once it has been set.

第一个以太口的MAC地址,这个变量只可被设置一次(一般在制造单板时设置)。一旦设置,U-Boot拒绝删除或覆盖这个变量。

ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee    地址设置为: 00:aa:bb:cc:dd:ee

设置lu lf 和 lk 为别名,代替后面的命令集

lu=tftp 0x80060000 ${dir}u-boot.bin&&erase 0x9f000000 +$filesize&&cp.b $fileaddr 0x9f000000 $filesize

(1) 将u-boot.bin文件上传到0x80060000地址;

(2)然后从地址0x9f000000开始,擦除filesize大小;

(3)从fileaddr地址中复制数据,大小为filesize,到地址0x9f000000.

也就是说设备的地址从0x9f000000开始,到 0x9f000000+filesize里面存放的是u-boot。

lf=tftp 0x80060000 ${dir}openwrt-ar71xx-generic-ap143-16M-rootfs-squashfs.bin&&erase 0x9f050000 +0xE30000&&cp.b $fileaddr 0x9f050000 $filesize

(1)上传openwrt-ar71xx-generic-ap143-16M-rootfs-squashfs.bin到地址0x80060000;

(2)然后从地址0x9f050000开始,擦除0xE30000大小;

(3)从fileaddr地址中复制数据,大小为filesize,到地址0x9f050000

也就是说设备的地址从0x9f050000开始,到 0x9f050000+filesize里面存放的是rootfs。

lk=tftp 0x80060000 ${dir}openwrt-ar71xx-generic-ap143-16M-kernel.bin&&erase 0x9fE80000 +$filesize&&cp.b $fileaddr 0x9fE80000 $filesize

(1)上传openwrt-ar71xx-generic-ap143-16M-kernel.bin到地址0x80060000;

(2)然后从地址0x9fE80000开始,擦除filesize大小;

(3)从fileaddr地址中复制数据,大小为filesize,到地址0x9E80000

也就是说设备的地址从0x9fE80000开始,到 0x9fE80000+filesize里面存放的是kernel。

ethact: uboot 要求使用环境变量 "ethact" 来指明寻找网络设备的起点。

ethact=eth0

ipaddr=192.168.2.101      设置设备地址,用于tftp使用
serverip=192.168.2.234    设置服务器地址,供tftp使用

输入,输出,错误打印均在串口

stdin=serial
stdout=serial
stderr=serial

附录:

cp [.b, .w, .l] source target count

- copy memory

cp命令可以在内存中复制数据块,包括对Flash的读写操作。

第1个参数source是要复制的数据块起始地址。

第2个参数target是数据块要复制到的地址。这个地址如果在Flash中,那么会直接调用写Flash的函数操作。所以U-Boot写Flash就使用这个命令,当然需要先把对应Flash区域擦净。

第3个参数count是要复制的数目,根据cp.b cp.w cp.l分别以字节、字、长字为单位。

openwrt的uboot环境变量分析的更多相关文章

  1. openwrt设置uboot环境变量在flash上的存储地址

    1.分析如下 ubootenv_add_app_config ubootenv_add_uci_config "/dev/mtd1" "0x40000" &qu ...

  2. uboot环境变量分析

    uboot的环境变量在程序的运行和调试过程中都发挥着比较重要的作用. 一.环境变量 可以理解为全局变量,但是他的生命周期比全局变量要长,当程序已经结束运行时,全局变量就会消亡,但是环境变量在下次上电运 ...

  3. u-boot 环境变量参数设置

    今天本来是烧写内核,结果一不小心把uboot也整不能用了,无奈之下只好重新烧个uboot,等都弄好以后,发现系统还是启动不了,原来是启动参数设置不对,于是找到了这篇文章,//是我添加的内容. 原文地址 ...

  4. uboot环境变量

    一. uboot运行时环境变量分布 1.1. 环境变量有2份,一份在Flash中,另一份在DDR中.uboot开机时一次性从Flash中读取全部环境变量到DDR中作为环境变量的初始化值,然后使用过程中 ...

  5. uboot环境配置

    uboot环境配置 通过配置uboot让它在启动过程中从tftp获取内核和设备树,并从在加载内核之后把通过启动参数将"从nfs挂载根文件系统"传入内核.这个配置主要是通过uboot ...

  6. uboot环境变量实现分析

    u-boot的环境变量用来存储一些经常使用的参数变量,uboot希望将环境变量存储在静态存储器中(如nand nor eeprom mmc). 其中有一些也是大家经常使用,有一些是使用人员自己定义的, ...

  7. 在Linux里读取UBOOT环境变量

    转载:http://falloutmx.blog.163.com/blog/static/39236020201211145010154/ 可以通过mtd方式读取,也可以用ioremap方式.不过这些 ...

  8. OK335xS U-boot 环境变量解析

    /************************************************************************************************** ...

  9. MPC8313ERDB在Linux从NAND FLASH读取UBoot环境变量的代码分析

    MPC8313ERDB在Linux从NAND FLASH读取UBoot环境变量的代码分析 Yao.GUET@2014-05-19 一.故事起因 由于文件系统的增大,已经大大的超出了8MB的NOR FL ...

随机推荐

  1. http状态码200,300,404等是什么意思

    在学习网页设计的时候都应该知道状态码,但我们常见的状态码都是200,404,下面介绍其他的状态值 1开头的http状态码 表示临时响应并需要请求者继续执行操作的状态代码. 100   (继续) 请求者 ...

  2. CentOS7 离线安装gcc/pcre-devel/openssl-devel/zlib-devel

    1. 解压CentOS7操作系统安装镜像,进入到CentOS-7.0-1406-x86_64-DVD\Packages目录,这下面存储了很多rpm包. 2. 找到下面列出的rpm包,上传到CentOS ...

  3. tomcat配置https方法

    利用tomcat服务器配置https双向认证 步骤 1.为服务器生成证书进入控制台,切换到%JAVA_HOME%/bin目录,具体操作略. 使用keytool为Tomcat生成证书,假定目标机器的域名 ...

  4. php注册数模式

    在前两篇单例模式和工厂模式后,终于迎来了最后一个基础的设计模式--注册树模式. 什么是注册树模式? 注册树模式当然也叫注册模式,注册器模式.之所以我在这里矫情一下它的名称,是因为我感觉注册树这个名称更 ...

  5. get_class_vars 返回由类的默认属性组成的数组

    get_class_vars (PHP 4, PHP 5) get_class_vars - 返回由类的默认属性组成的数组 说明 array get_class_vars ( string $clas ...

  6. CodeForces 670B Game of Robots

    简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...

  7. CodeForces 711C Coloring Trees

    简单$dp$. $dp[i][j][k]$表示:前$i$个位置染完色,第$i$个位置染的是$j$这种颜色,前$i$个位置分成了$k$组的最小花费.总复杂度$O({n^4})$. #pragma com ...

  8. 键盘快速启动工具Launchy的简单使用技巧

    打开电脑面对林林总总的图标,找到对应的程序,快速启动显得尤为重要.这样有利于提高我们的效率. 好了,直接上图: 就是这款小巧的工具,界面如上. 接下来介绍这款工具的使用技巧. 1.安装成功后:打开工具 ...

  9. sealed的作用

    sealed 修饰符表示密封 用于类时,表示该类不能再被继承,不能和 abstract 同时使用,因为这两个修饰符在含义上互相排斥 用于方法和属性时,表示该方法或属性不能再被重写,必须和 overri ...

  10. [APP]如果你想反编译

    反编译,主要用到两类工具,一个就是获取apk包的包名(appPackage)和类名(appActivity)的工具,其实就是反编译出java源代码,dex2jar和jd-gui:一个是将一个apk包反 ...