linux fw_printenv fw_setenv 设置uboot环境变量

本文介绍了如何使用u-boot提供的fw_printenv和fw_setenv工具来管理Linux系统的环境变量。在uboot端编译这些工具后,在Linux端进行集成,将fw_env.config配置到/etc/目录,fw_printenv复制到/bin,并创建软链接fw_setenv指向fw_printenv。首次启动时需在uboot中使用saveenv保存环境变量。测试表明,fw_printenv和fw_setenv能够正常工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、fw_printenv/fw_setenv

u-boot提供fw_printenv/fw_setenv 为Linux访问uboot环境编译。

在uboot端编译,在Linux端使用

2、测试环境

source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux
make envtools CC="$CC"
Now, you will find the u-boot/tools/env/fw_printenv
Note: the fw_setenv is applet of fw_printenv as busybox does
fw_env.config
fw_env.config default directory is in the /etc/
如下
/dev/mmcblk1  0x400000         0x2000
uboot/include/configs/imx8qxp_mek.h
0x2000 : #define CONFIG_ENV_SIZE  0x2000
0x400000 : #define CONFIG_ENV_OFFSET (64 * SZ_64K)

3、所有文件集成在rootfs里面

fw_env.config copy to /etc/
fw_printenv copy to /bin
Make symbol link fw_setenv from fw_printenv
ln -s fw_printenv fw_setenv
fw_setenv -> fw_printenv

4、Test fw_printenv/fw_setenv

注意以下文字,第一次开机的时候需要在uboot中设置saveenv

The first boot the environment is generated by uboot C code.
i.MX uboot detects the which board it is, then give proper u-boot environment
variables. It is in the memory not in the storage such as emmc, till you use
saveenv to do save.
If it is the first time to do the test, get into uboot run saveenv first.

Test fw_printenv/fw_setenv(Cont.)
Get in to linux then test fw_printenv

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值