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. java 指定日期后n天

    RT 算时间本来就是我的弱项:不废话了,贴代码 想传什么参数自己在改改就ok,传入String,放回String public class Text { public static void main ...

  2. pycharm 断点跟踪

    F8 下一步 F7 step info F9 直接运行

  3. postgre存储过程或者视图中"::"双冒号是什么意思

    双冒号是类型转换的意思. 比如: '2019-09-10'::date

  4. C#基础提升系列——C# LINQ

    C# LINQ LINQ(Language Integrated Query,语言集成查询).在C# 语言中集成了查询语法,可以用相同的语法访问不同的数据源. 命名空间System.Linq下的类En ...

  5. JAVA学习笔记--赋值(“=”)

    参考来源:<java编程思想(第四版)> 见第三章3.4节 基本数据类型存储了实际的数值,并非指向一个对象的引用,故其赋值,就是直接将一个地方的内容复制到了另一个地方.例如,对基本数据类型 ...

  6. 51nod 1040:最大公约数之和(数论)

    题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1040 给出一个n,求1-n这n个数,同n的最大公约数的和. ...

  7. 企业打开云HBase的正确方式,来自阿里云云数据库团队的解读

    一.HBase的历史由来 HBase是一个开源的非关系型分布式数据库(NoSQL),基于谷歌的BigTable建模,是一个高可靠性.高性能.高伸缩的分布式存储系统,使用HBase技术可在廉价PC Se ...

  8. objc_setAssociatedObject 关联对象

    使用场景:在分类中,不允许创建实例变量,这里就解决了此问题 参考: https://www.cnblogs.com/someonelikeyou/p/7162613.html 属性的实质:就是实例变量 ...

  9. bzoj4397【Usaco2015 Dec】Breed Counting(前缀和、树状数组)

    题目描述 Farmer John's N cows, conveniently numbered 1…N, are all standing in a row (they seem to do so ...

  10. HihoCoder - 1664 (单调队列)

    题目:https://vjudge.net/contest/319166#problem/B 题意: 一个01间隔矩阵,求一个方阵的最大边长,这个方阵的要求是里面01分隔,不能有01相邻 思路:同   ...