
Linux で u-Boot env 変数にアクセスして変更するにはどうすればよいですか。u boot ディレクトリの u-boot/tools/env ディレクトリを使用します。
u-boot$ make env
これにより、実行可能ファイルが作成されますfw_printenv
。これを /usr/sbin にコピーし、対象の etc/fw_env.config ファイルにコピーしました。
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundand
# environment sector is assumed present.
# MTD device name Device offset Env. size Flash sector size
/dev/mtd0 0x00000 0x20000 0x20000
target#./fw_printenv
SEGV
このエラーの原因は何ですか?
/proc/mtd
dev: size erasesize name
mtd0: 00020000 00020000 "flash_uboot_env"
mtd1: 002e0000 00020000 "flash_linux_image"
mtd2: 00900000 00020000 "flash_jffs2"
mtd3: 00900000 00020000 "flash_data"
答え1
あなたのfw_env.config
設定は私の設定とは異なります。私の設定では、u-boot env は 0x00260000 ~ 0x00280000 の範囲にあります。記憶している限り、fw_env ファイルは非常に敏感で、ある列を忘れると fw_setenv がデフォルト値に戻り、さまざまな奇妙なエラーが発生する可能性があります。
参考までに、私のfw_env.configを以下に示します。
root@linux:~# cat /etc/fw_env.config
# Dev. name offset env. size flash sector size nbr. sectors
/dev/mtd1 0x00 0x2000 0x20000 1
クロスコンパイルstrace
してトラブルシューティングに使用することができます。