Closed masahiro-999 closed 3 weeks ago
uboot/0002-coremp135.patch
+CONFIG_ENV_OFFSET=0x100000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_ENV_OFFSET_REDUND=0x110000
+CONFIG_ENV_IS_IN_MMC=y
I got this error message when boot up nerves
boardid: U-boot environment CRC32 mismatch (expected 0xe5ed2ac3; got 0x64f03c2e)
boardid: U-boot environment CRC32 mismatch (expected 0xe5ed2ac3; got 0x64f03c2e)
Erlang/OTP 27 [erts-15.0.1] [source] [32-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]
Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
boardid: U-boot environment CRC32 mismatch (expected 0xe5ed2ac3; got 0x64f03c2e)
boardid: U-boot environment CRC32 mismatch (expected 0xe5ed2ac3; got 0x64f03c2e)
Could not print MOTD: %ArgumentError{message: "invalid ANSI sequence specification: nil"}
Toolshed imported. Run h(Toolshed) for more info.
iex(1)>
99643272e3c5c109d0bcecb1a8c849f5fdfe1f47 CRC error was fixed. but Not Validated yet.
Check This document https://hexdocs.pm/nerves_runtime/0.13.0/readme.html
https://github.com/nerves-project/nerves_system_bbb/blob/main/uboot/uboot.env
In the BBB repository, there is an implementation within U-Boot that rewrites nerves_fw_validated. The issue arises because this implementation is missing, and there is no mechanism to automatically set nerves_fw_validated to 1. This can also be resolved by executing Nerves.Runtime.validate_firmware/0 at the application level.
On the Raspberry Pi, there is no implementation that sets nerves_fw_validated to 0 during firmware updates, so nerves_fw_validated has not been used. For the core_mp135, we will take a similar approach as the Raspberry Pi. In future improvements, we will implement support for nerves_fw_validated."
BBBのレポジトリーでは、ubootの中で、nerves_fw_validatedを書き換える処理を実装している。 このissueの問題が起きる原因は、この実装が無いために、nerves_fw_validatedを自動的に1にする仕組みがないためと思われる。 アプリケーションレベルで、Nerves.Runtime.validate_firmware/0 を実行することでも解決する。
Raspiでは、ファームウエアアップデート時に、nerves_fw_validatedを0にする処理が実装されておらず、nerves_fw_validatedは使用されていなかった。 core_mp135でも、Raspiと同様の対応とることにする。 今後の改善で、nerves_fw_validatedの対応を行う。
@masahiro-999
Nerves.Runtime.KV
は uboot_env を使っているはずで、 uboot_env
は
Load environment block configurations from /etc/fw_env.config
を参照します。なので、
https://github.com/masahiro-999/core_mp135/blob/v0.0.2/rootfs_overlay/etc/fw_env.config#L6
と
https://github.com/masahiro-999/core_mp135/blob/v0.0.2/fwup_include/fwup-common.conf#L51-L52
の整合がとれていないといけません。 fw_env.config
の設定を見直すのはどうでしょう?
上記二者間の値の関係は、ほかの nerves_system を参照することで理解できると思います。
※既に上記試されていましたら、読み捨てて下さい :pray:
/etc/fw_env.config このファイルが介在しているとは知らなかったので、この点は確認してませんでした。 確認してみたんですが、この点は、元にしている、osd32mp1から変えていなかったので、整合性はとれていました。 Nerves側がどうやってenvの場所を把握しているのか謎でしたが、理解できました。ありがとうございました。
このissueでマージしている変更で、ubootのConfigと、fwup-common.confの整合性はとってみたつもりです。 uboot側が初心者なので厳しいんですが、bbbの情報を真似してみようかとおもってます。 @pojiro
@masahiro-999 私も確認してみたのですが、整合取れてましたね。失礼しました。 :pray:
ファームウェアアップデート後にプロジェクト側で「ここまで起動したのだからアップデート完了として良いだろう」で使う Nerves.Runtime.validate_firmware
を明示的に Nerves プロジェクト側で呼ばないといけない作りに編集前(ベースにされた osdmp1?)はなってたのですね。 なので、 #3 の修正で十分な気もしてきました。
あとは Nerves.Runtime.revert
が使えるかどうかなんかも確認しといたほうが良いかもです :bulb:
はい。一端、 https://github.com/masahiro-999/core_mp135/pull/3 で進めてみます。 ベースにしたのは、 osdmp1です。 Nerves.Runtime.revert は使えました。ファームの書き換えは、A,Bともにつかえて大丈夫でした。 @pojiro
やってみて、Nervesの仕組みがよくわかりました。
After using mix upload to update the firmware, the updated firmware is not being validated. Upon boot, the following message appears in iex:
Firmware : Not validated (B)
I suspect that the issue might be caused by the U-Boot environment variables not being properly shared with Nerves. Currently, the U-Boot environment variables are not configured to be saved on the SD card.
uboot/0002-coremp135.patch