Share
Embed
Nervesの新機能mix firmware.patchの(偏った観点からの)ご紹介 / An Introduction to mix firmware.patch from my own view point
NervesJP #14 新年LT回
https://nerves-jp.connpass.com/event/199455/
スライド中で紹介しているJupyter Notebookは以下のURLで観られます。
https://github.com/kentaro/deployment-methods-evaluation/blob/main/evaluation.ipynb
Kentaro Kuribayashi
January 09, 2021
Transcript
15 slides
-
• IoTσόΠεͷ։ൃޮ্ͷͨΊɺ։ൃऀʹΑΔίʔυͷมߋΛͰ͖Δ͚ͩ ͘σόΠεʹద༻͍ͨ͠ • ͦͷͨΊʹɺmix upload.hotswapʢ※ʣ ͱ͍͏mixλεΫΛ։ൃͨ͠ • Nervesͷఏڙ͢Δߋ৽ํࣜͱൺֱݕ౼͍ͨ͠ ◦
ϑΝʔϜΣΞΠϝʔδશମͷߋ৽ద༻ ◦ ϑΝʔϜΣΞύονʹΑΔߋ৽ͷ෦ద༻ • ·ͨɺϑΝʔϜΣΞύονʹΑΔߋ৽ͷ෦ద༻Nervesͷ৽ػೳͰ͋Δ ͨΊɺհ͍ͨ͠ Ϟνϕʔγϣϯ ※: https://hex.pm/packages/mix_tasks_upload_hotswap -
• ϑΝʔϜΣΞΠϝʔδͷόΠφϦࠩʹΑΔύονΛ࡞͢Δmix λεΫʢ※1ʣ • v1.6.4Ͱಋೖɺv1.7.0Ͱਖ਼ࣜαϙʔτ͞Εͨʢ※2ʣ • mix uploadίϚϯυͷ--firmwareΦϓγϣϯͰύονΛࢦఆ͠ ͯΞοϓϩʔυ͢Δ͜ͱͰߋ৽Λద༻ mix
firmware.patchͱ ※1: https://hexdocs.pm/nerves/experimental-features.html#firmware-patches ※2: https://github.com/nerves-project/nerves/releases -
1. ϑΝʔϜΣΞΠ ϝʔδશମʹΑΔߋ ৽ͷద༻ $ cd target_app && ../measure_firmware_update.sh firmware
nerves.local is at 172.31.68.221 Time to build firmware (mix firmware) ====================================== real 0m21.927s user 0m6.584s sys 0m2.121s Time to upload firmware ====================================== real 0m14.572s user 0m5.182s sys 0m1.261s Time to reboot ====================================== time: 22.692 sec. ӈͷ௨ΓɺͦΕͧΕ10ʙ20 ඵ΄Ͳͷ࣌ؒΛཁ͍ͯ͠ Δɻ -
2. ϑΝʔϜΣΞ ύονʹΑΔߋ৽ͷ ෦ద༻ʢ1ʣ !cd target_app && ../measure_firmware_update.sh firmware.patch nerves.local
is at 172.31.68.221 Time to build firmware (mix firmware.patch) ====================================== real 0m27.127s user 0m6.697s sys 0m2.227s Time to upload firmware ====================================== real 0m17.873s user 0m3.897s sys 0m0.952s Time to reboot ====================================== time: 22.534 sec. ӈͷ௨ΓɺͦΕͧΕ10ʙ20 ඵ΄Ͳͷ࣌ؒΛཁ͍ͯ͠Δɻ ϑΝʔϜΣΞશମͷߋ৽ͱ ΄ͱΜͲมΘͬͯͳ͍ɻ -
2. ϑΝʔϜΣΞ ύονʹΑΔߋ৽ͷ ෦ద༻ʢ2ʣ Finished generating patch firmware Source /Users/antipop/src/github.com/kentaro/deployment-methods-
evaluation/target_app/_build/rpi3_dev/nerves/images/target_app.fw uuid: cf2963b5-a2a1-596a-a5ee-8e1896ff412b" size: 43707167 bytes Target /Users/antipop/src/github.com/kentaro/deployment-methods- evaluation/target_app/_build/rpi3_dev/nerves/images/patch/target.fw uuid: b5fc7388-d517-5f4d-9247-f8401fecf9b6" size: 43704906 bytes Patch /Users/antipop/src/github.com/kentaro/deployment-methods- evaluation/target_app/_build/rpi3_dev/nerves/images/patch.fw size: 5900267 bytes ݩͷϑΝʔϜΣΞΠϝʔδ ʹൺͯɺϑΝΠϧαΠζ͕ ͷ1ʹʂ -
3. ΞϓϦέʔγϣ ϯίʔυͷ෦ద༻ $ cd target_app && time mix upload.hotswap
> /dev/null real 0m3.414s user 0m4.708s sys 0m1.322s 3ʙ4ඵ΄ͲͰߋ৽͕ྃ͢ Δɻ -
• ϑΝʔϜΣΞΠϝʔδͷύονʹΑΔߋ৽ʹΑΔϝϦοτ ◦ ΠϝʔδͷϑΝΠϧαΠζΛ͓͑͞ΒΕΔ ◦ ௨৴ʹ͔͔Δ࣌ؒΛॖͰ͖Δ ◦ σόΠε͕ඞཁͱ͢ΔσΟεΫαΠζΛ͓͑͞ΒΕΔ • ։ൃऀʹΑΔ։ൃޮͷ্Λతͱ͢ΔͷͰͳ͍
• ͦͦɺୡ͍ͨ͠త͕ҟͳΔͷͰͨΓલͰ͋Δ ։ൃޮ্ͱ͍͏؍ʹΑΔධՁ -
❝ It is important to note that in order to
generate a firmware patch file, you will need to supply two full firmware update files, the firmware that the target is updating from (currently running) and the firmware the device will be updating to (the desired new firmware). Attempting to apply a firmware patch to a target that is not running the "from" firmware will result in returning an error when attempting to apply it. ❞ mix firmware.patchͷҙʢ1ʣ ※: https://hexdocs.pm/nerves/experimental-features.html#firmware-patches -
❝ Yes, you can't run it twice. It's not usable
for what I think that you're doing. I'll try to finish off that code change that I was talking about so that mix firmware.patch will make more sense. Right now, I think mix firmware.patch is only valuable to see the result of tweaking firmware generation options on patch size. ❞ mix firmware.patchͷҙʢ2ʣ ※: https://github.com/nerves-project/nerves/issues/579#issuecomment-753522442 -
• ࠷ۙͷNervesͰɺmix firmware.patchͱ͍͏mixλεΫ͕Ճ͞Εͨ • ϑϧͷΠϝʔδʹൺͯϑΝΠϧαΠζ͕ͷ1ʹͳΔ • ։ൃޮ্ͱ͍͏؍Ͱɺ͋·Γҙຯ͕ͳ͍ʢͦͦར༻త͕ҧ ͏ʣ • චऀͷϞνϕʔγϣϯ͕ಛघͳͷͰɺެฏͳհʹͳ͍ͬͯͳ͍͜ͱʹ
ҙ • σόΠεͷΞοϓϩʔυͷ෦·͍ͩͯ͠ͳ͍Α͏ͳͷͰɺࠓޙʹ ظ ·ͱΊ