As we know, the bootloader stores its configuration into an area of the flash called the environment. The environment is basically stored as a sequence of null-terminated strings, with a little header containing a checksum at the beginning. Using the “printenv”, “setenv” and “saveenv” commands in U-Boot, while this environment can easily be manipulated. It is sometimes desirable to be able to generate a binary image of an environment that can be directly flashed next to the bootloader, kernel and root filesystem into the device’s flash memory.

In order to modify the U-Boot environment variables from user space, the program called “mkenvimage” is needed, this program can be generated from the U-Boot sources, follow the instructions in the tools/env/README file.

make env

This will get the program “mkenvimage”, the program is executed in host computer, not the target board. The text file “uboot-env.txt” describing the environment is needed like:

git-bash
bootargs=console=ttyS0,115200
bootcmd=tftp 22000000 Image
[...]

Then use mkenvimage as follows:

./mkenvimage -s 0x40000 -o uboot-env.bin uboot-env.txt

The -s option allows to specify the size of the image to create. It must match the size of the flash area reserved for the U-Boot environment.

Before using the new uboot-env.bin, the old bin file should be restored by the following commands:

dd if=/dev/mtd7 of=uboot-env.bin

Then, flashing the new bin file in /dev/mtd7 by the following commands:

flash_eraseall /dev/mtd7
flashcp uboot-env.bin /dev/mtd7

Or, the Lauterbach Debugger is also a good tool to flash the Hyper-Flash.

创建Uboot 环境变量 bin 文件的更多相关文章

  1. CentOS下安装JDK6u21和设置环境变量bin文件

    1.先通过SSH登录到Linux系统中,通过SSH文件管理工具把Linux的JDK安装包上传到/home/acm/JavaTools/JDK目录: 2.进入/home/acm/JavaTools/JD ...

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

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

  3. Linux系统——访问U-BOOT环境变量

    Linux系统下访问U-BOOT环境变量 移植过U-BOOT的人,都知道:在U-BOOT中存有ENV.但U-BOOT在引导内核启动之后,U-BOOT的生命周期就结束了.那么启动LINUX内核之后,U- ...

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

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

  5. (大数据工程师学习路径)第一步 Linux 基础入门----环境变量与文件查找

    环境变量与文件查找 本节介绍环境变量的作用与用法,及几种搜索文件的方法.学会这些技巧高效地使用 Linux. 一.环境变量 1.变量 要解释环境变量,得先明白变量是什么,准确的说应该是 Shell 变 ...

  6. uboot环境变量实现分析

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

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

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

  8. I.MX6 Linux U-boot 环境变量解析

    /********************************************************************************** * I.MX6 Linux U- ...

  9. 环境变量和文件查找&文件打包与解压缩

    环境变量和文件查找 介绍环境变量的作用与用法 及几种搜索文件的方法 学会这些技巧可以高效地使用 Linux 知识点:环境变量的设置 环境变量的修改 环境变量 要解释环境变量,得先明白变量是什么,准确的 ...

随机推荐

  1. CS184.1X 计算机图形学导论(第三讲)

    第一单元(介绍关于变换的数学知识) :基本二维变换 模型坐标系,世界坐标系 1.缩放 Scale(规模,比例) Sx表示在x方向上放大的倍数,Sy表示在y方向上放大的倍数,因此X坐标乘以Sx,Y坐标乘 ...

  2. ubuntu chm文档阅读器

    一,chm阅读器名称 KchmViewer 安装方法 sudo apt-get install kchmviewer 使用 kchmviewer #非root用户可以直接使用

  3. BZOJ3625 CF438E 小朋友与二叉树

    心态崩了 不放传送门了 辣鸡bz 还是正经一点写一下题解= = 就是显然我们可以把权值写成生成函数形式g(0/1序列)来表示权值是否出现 然后f来表示总的方案数 可以列出 分别枚举左右子树和空树的情况 ...

  4. webRTC脱坑笔记(四)— windows下Nginx对Node服务的反向代理

    Nginx反向代理 1.什么是反向代理 当我们有一个服务器集群,并且服务器集群中的每台服务器的内容一样的时候,同样我们要直接从个人电脑访问到服务器集群服务器的时候无法访问,必须通过第三方服务器才能访问 ...

  5. hive之视图和索引

    一.视图 1.视图定义 视图其实是一个虚表,视图可以允许保存一个查询,并像对待表一样对这个查询进行操作,视图是一个逻辑结构,并不会存储数据. 2.视图的创建 通过创建视图来限制数据访问可以用来保护信息 ...

  6. find命令进阶(二):对找到的文件执行操作exec

    以下面的命令为例: find ~ -type f -name 'foo*' -exec ls -l '{}' ';' 分面两部分,第一部分: find ~ -type f -name 'foo*' 即 ...

  7. docker Error response from daemon

    docker 在拉取镜像的时候报错 Using default tag: latest Error response from daemon: Get https://registry-1.docke ...

  8. php str_repeat()函数 语法

    php str_repeat()函数 语法 str_repeat()函数怎么用? php str_repeat()函数用于重复使用指定字符串,语法是str_repeat(string,repeat), ...

  9. Pangu and Stones HihoCoder - 1636 区间DP

    Pangu and Stones HihoCoder - 1636 题意 给你\(n\)堆石子,每次只能合成\(x\)堆石子\((x\in[L, R])\),问把所有石子合成一堆的最小花费. 思路 和 ...

  10. scipy与sklearn下载与安装

    一.scipy下载与安装 scipy下载地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv提供各种包whl文件 下载之后放到Scripts文件中 ...