Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nervesの新機能mix firmware.patchの(偏った観点からの)ご紹介 / An...

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
Tweet

More Decks by Kentaro Kuribayashi

Other Decks in Technology

Transcript

  1. • IoTσόΠεͷ։ൃޮ཰޲্ͷͨΊɺ։ൃऀʹΑΔίʔυͷมߋΛͰ͖Δ͚ͩ଎ ͘σόΠεʹద༻͍ͨ͠ • ͦͷͨΊʹɺmix upload.hotswapʢ※ʣ ͱ͍͏mixλεΫΛ։ൃͨ͠ • Nervesͷఏڙ͢Δߋ৽ํࣜͱൺֱݕ౼͍ͨ͠ ◦

    ϑΝʔϜ΢ΣΞΠϝʔδશମͷߋ৽ద༻ ◦ ϑΝʔϜ΢ΣΞύονʹΑΔߋ৽ͷ෦෼ద༻ • ·ͨɺϑΝʔϜ΢ΣΞύονʹΑΔߋ৽ͷ෦෼ద༻͸Nervesͷ৽ػೳͰ΋͋Δ ͨΊɺ঺հ͍ͨ͠ Ϟνϕʔγϣϯ ※: https://hex.pm/packages/mix_tasks_upload_hotswap
  2. 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 ඵ΄Ͳͷ࣌ؒΛཁ͍ͯ͠ Δɻ
  3. 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 ඵ΄Ͳͷ࣌ؒΛཁ͍ͯ͠Δɻ ϑΝʔϜ΢ΣΞશମͷߋ৽ͱ ΄ͱΜͲมΘͬͯͳ͍ɻ
  4. 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ʹʂ
  5. 3. ΞϓϦέʔγϣ ϯίʔυͷ෦෼ద༻ $ cd target_app && time mix upload.hotswap

    > /dev/null real 0m3.414s user 0m4.708s sys 0m1.322s 3ʙ4ඵ΄ͲͰߋ৽͕׬ྃ͢ Δɻ
  6. ❝ 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
  7. ❝ 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