英文:
Change U-Boot Environment Variable in Linux
问题
我想通过fw_setenv
命令在Linux中更改u-boot环境变量。当我尝试使用fw_printenv
打印环境变量时,没有错误或警告,它正常工作。但是,当我尝试更改这些变量时,我收到错误消息:"无法打开/dev/mtd4:权限被拒绝"。以下是我的设置:
在DTS中:
nor@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg=<0x0 0x0 0x1000000>;
bank-width = <2>;
device-width = <1>;
partition@0 {
/* This location must not be altered */
/* 256KB for Vitesse 7385 Switch firmware */
reg=<0x0 0x00040000>;
label="NOR Vitesse-7385 Firmware";
read-only;
};
partition@40000 {
/* 256KB for DTB Image */
reg=<0x00040000 0x00040000>;
label = "NOR DTB Image";
};
partition@80000 {
/* 3.5 MB for Linux Kernel Image */
reg = <0x00080000 0x00380000>;
label = "NOR Linux Kernel Image";
};
partition@400000 {
/* 11MB for JFFS2 based Root file System */
reg=<0x00400000 0x00b00000>;
label = "NOR JFFS2 Root File System";
};
partition@f20000 {
/* 8KB for u-boot Environment Variables */
reg=<0x00f20000 0x00002000>;
label = "NOR U-Boot Environment Variable";
};
partition@f40000 {
/* This location must not be altered */
/* 512KB for u-boot Bootloader Image */
reg=<0x00f40000 0x000C0000>;
label = "NOR U-Boot Image";
};
};
在Linux中:
mtd0: 00040000 00020000 "NOR Vitesse-7385 Firmware"
mtd1: 00040000 00020000 "NOR DTB Image"
mtd2: 00380000 00020000 "NOR Linux Kernel Image"
mtd3: 00b00000 00020000 "NOR JFFS2 Root File System"
mtd4: 00002000 00020000 "NOR U-Boot Environment Variable"
mtd5: 000c0000 00020000 "NOR U-Boot Image"
这些配置有什么问题?
感谢帮助。
英文:
I want to change u-boot environment variables in Linux via fw_setenv
command. When i try to print environment variables via fw_printenv
there is no error or warning, it works fine. However, when I try to change these variables I got an error: "Can't open /dev/mtd4: Permission denied". Here my settings:
In DTS:
nor@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg=<0x0 0x0 0x1000000>;
bank-width = <2>;
device-width = <1>;
partition@0 {
/* This location must not be altered */
/* 256KB for Vitesse 7385 Switch firmware */
reg=<0x0 0x00040000>;
label="NOR Vitesse-7385 Firmware";
read-only;
};
partition@40000 {
/* 256KB for DTB Image */
reg=<0x00040000 0x00040000>;
label = "NOR DTB Image";
};
partition@80000 {
/* 3.5 MB for Linux Kernel Image */
reg = <0x00080000 0x00380000>;
label = "NOR Linux Kernel Image";
};
partition@400000 {
/* 11MB for JFFS2 based Root file System */
reg=<0x00400000 0x00b00000>;
label = "NOR JFFS2 Root File System";
};
partition@f20000 {
/* 8KB for u-boot Environment Variables */
reg=<0x00f20000 0x00002000>;
label = "NOR U-Boot Environment Variable";
};
partition@f40000 {
/* This location must not be altered */
/* 512KB for u-boot Bootloader Image */
reg=<0x00f40000 0x000C0000>;
label = "NOR U-Boot Image";
};
};
In Linux:
mtd0: 00040000 00020000 "NOR Vitesse-7385 Firmware"
mtd1: 00040000 00020000 "NOR DTB Image"
mtd2: 00380000 00020000 "NOR Linux Kernel Image"
mtd3: 00b00000 00020000 "NOR JFFS2 Root File System"
mtd4: 00002000 00020000 "NOR U-Boot Environment Variable"
mtd5: 000c0000 00020000 "NOR U-Boot Image"
What is wrong in these configurations?
Thanks for the help..
答案1
得分: 1
Partition size is 8 kb but flash erasesize is 128 kb. Partition must start and end on erase/write block boundary to be writeable.
英文:
mtd4: 00002000 00020000 "NOR U-Boot Environment Variable"
Partition size is 8 kb but flash erasesize is 128 kb. Partition must start and end on erase/write block boundary to be writeable.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论