如何写入 mtd2

问题描述 投票:0回答:1

我正在尝试更改我设备上的 MAC 地址。

我为此使用以下命令:

# MAC address range is from D0-16-F0-20-00-00 to D0-16-F0-2F-FF-FF
# MAC address of WIFI is D0-16-F0-2X-XX-XX
# MAC address of ethernet is D0-16-F0-2X-XX-XX+0x01
# MAC address of apcli0 is D0-16-F0-2X-XX-XX+0x02
dd if=/dev/mtd2 of=/tmp/art-bk.bin
echo -e -n '\xD0\x16\xF0\x20\x00\x00' | dd of=/tmp/art-bk.bin seek=4 bs=1
count=6 conv=notrunc
echo -e -n '\xD0\x16\xF0\x20\x00\x01' | dd of=/tmp/art-bk.bin seek=40 bs=1
count=6 conv=notrunc
echo -e -n '\xD0\x16\xF0\x20\x00\x02' | dd of=/tmp/art-bk.bin seek=46 bs=1
count=6 conv=notrunc
mtd write /tmp/art-bk.bin /dev/mtd2

最后一个命令

mtd write /tmp/art-bk.bin /dev/mtd2
返回错误:

Could not open mtd device: /dev/mtd2
Can't open device for writing!

我检查了

/proc/mtd
,得到了以下输出:

# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 00f30000 00010000 "firmware"
mtd4: 0023392c 00010000 "kernel"
mtd5: 00cfc6d4 00010000 "rootfs"
mtd6: 00240000 00010000 "rootfs_

出了什么问题?

linux bash linux-kernel kernel
1个回答
0
投票

可能是您没有对该设备的写入权限。

检查:

ls -al /dev/mtd2

您可以看到rwx权限。如果需要,您可以通过以下方式授予写入权限:

chmod 666 /dev/mtd2
© www.soinside.com 2019 - 2024. All rights reserved.