Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(v3.7.x): bootcontrol: refactor jetson-cboot, add new firmware update support #287

Merged
merged 58 commits into from
Apr 25, 2024

Conversation

Bodong-Yang
Copy link
Member

@Bodong-Yang Bodong-Yang commented Apr 18, 2024

Description

This PR re-introduces boot control implementation for jetson device boots with jetson-cboot(for BSP < R34), along with new firmware update mechanism and firmware version control mechanism.

With this PR, NVIDIA nv_update_engine is used to apply the ECU's firmware update, along with firmware version control. The firmware update is fully supported, including bootloader updates.

This PR deprecates the old firmware update mechanism introduced in #204 .

Check list

  • test file(s) that covers the change(s) is implemented.
  • local test is passed.
  • jetson-cboot test on real ECU.
  • test on bench.
  • design docs/implementation docs are prepared.

Docs

jetson-cboot boot control design

Test

There are three bench tests for this version of otaclient:
https://tier4.atlassian.net/wiki/spaces/WEB/pages/3069903366
https://tier4.atlassian.net/wiki/spaces/WEB/pages/3088712741
https://tier4.atlassian.net/wiki/spaces/WEB/pages/3095494738

Changes

Behavior changes

Does this PR introduce behavior change(s)?

  • Yes.

Now jetson-cboot controller will keep records of the current firmware version, if the standby slot's firmware version is equal or newer than the OTA image's one, no firmware update will occur.

Breaking change

Does this PR introduce breaking change?

  • Yes.

Old manual firmware update mechanism is deprecated in flavor of the new firmware update mechanism with version control.

Related links & tickets

https://tier4.atlassian.net/browse/RT4-9342

@Bodong-Yang Bodong-Yang added the feature New feature is introduced label Apr 18, 2024
@Bodong-Yang Bodong-Yang self-assigned this Apr 18, 2024
@Bodong-Yang Bodong-Yang changed the title feature(v3.7.x): bootcontrol: add jetson-cboot feature(v3.7.x): bootcontrol: add jetson-cboot with new firmware update support Apr 18, 2024
Copy link
Contributor

github-actions bot commented Apr 18, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
otaclient/app
   __init__.py00100% 
   __main__.py330%16–19
   common.py3843990%63, 143, 249, 252–254, 269, 276–278, 344–346, 356, 365–367, 473, 485, 604–608, 696, 698, 730–732, 734, 760–763, 768, 772–776, 802–803
   configs.py760100% 
   downloader.py2714484%68, 81–82, 297, 302, 306, 324–325, 375–379, 398–408, 429–447, 456, 531–533, 549, 569–587
   errors.py1130100% 
   interface.py17476%32, 43, 47, 51
   log_setting.py55787%39–40, 52, 54, 65–67
   main.py29293%43–44
   ota_client.py39814963%55–56, 76, 182–206, 243–246, 258–274, 284–287, 292–330, 372–375, 380–387, 400–423, 429–432, 461–485, 499–506, 513, 516–522, 569–572, 580, 616, 621–643, 703–719, 730–746, 757, 776, 787–788, 805, 824, 828–829, 844
   ota_client_call.py38684%42–44, 80–82
   ota_client_service.py27389%55–57
   ota_client_stub.py39110972%76–81, 89–97, 101–130, 135–144, 147–154, 162–167, 204–206, 211, 247, 272, 275, 278, 382, 408, 410, 436, 486, 543, 613–614, 653, 672–683, 687–701, 705–708, 761, 848–857, 887–934, 937
   ota_metadata.py3153190%145, 150, 186–187, 197–201, 213, 271, 304–306, 323–326, 406, 409, 417–419, 432, 441–446, 719–730
   ota_status.py14286%34, 42
   update_stats.py105298%160, 170
otaclient/app/boot_control
   __init__.py40100% 
   _common.py2357867%72–73, 94–96, 112–113, 133–134, 153–154, 173–174, 193–194, 209–210, 231–239, 257–265, 284–289, 312–338, 357–376, 392–401, 494–504, 563–564, 618, 622–623, 626, 634–637, 711–712, 722, 740
   _grub.py42112969%217, 265–268, 274–278, 315–316, 323–354, 363–376, 385–391, 470–476, 528, 534, 560, 582–587, 602–604, 628–631, 643–653, 712–715, 740–743, 766–769, 781–786, 821, 827, 847–850, 862, 865, 868, 871, 875–877, 895–898, 926–929, 934–942, 947–955
   _jetson_cboot.py40528330%52, 75, 121–134, 139–142, 149–150, 158–159, 166–167, 174–175, 180–181, 199–208, 220–228, 240–247, 257–259, 271–272, 281–293, 297, 301, 304–306, 309–312, 346–468, 481, 484, 488–496, 507, 522–557, 566–592, 605–631, 635–642, 646–655, 670–739, 744, 747, 750–771, 776–814, 819–827, 832–840, 846–848, 851, 854
   _rpi_boot.py25912253%84–86, 92–152, 176–178, 184–186, 199–201, 207–209, 222–247, 252, 256, 260, 264, 298, 325–327, 337–340, 344–350, 390–392, 434–438, 457–460, 465, 468, 492–495, 500–508, 513–521, 535–538, 544–546, 549
   configs.py450100% 
   protocol.py28582%53, 57, 61, 65, 73
   selecter.py382632%43–68, 76–96
otaclient/app/create_standby
   __init__.py12558%28–34
   common.py2164579%72, 75–76, 80–93, 139, 187–195, 198–201, 205, 216, 290–298, 310, 354–359, 375–376, 390–394, 419–420
   interface.py19384%55, 59, 63
   rebuild_mode.py89199%104
otaclient/app/proto
   __init__.py31390%37, 44–45
   _common.py4194988%85, 163, 170, 182–184, 203, 208, 219, 256, 262, 267, 298, 302, 306, 363, 380, 403, 464, 471, 474, 494, 501, 503, 529, 535, 538, 540, 565, 571, 574, 576, 605, 609, 611, 625, 642, 670, 673, 677, 680, 708, 714, 761–766, 797
   _ota_metafiles_wrapper.py841385%37, 40–42, 112–116, 122–125
   _otaclient_v2_pb2_wrapper.py2763787%87, 90–93, 132, 175, 183, 197, 207, 210–213, 258, 261, 264–265, 285, 305, 385, 452, 505, 513–515, 519–522, 525–530, 551, 559, 573, 581, 595
   streamer.py43881%32, 47, 65–66, 71, 80–81, 99
   wrapper.py40100% 
otaclient/ota_proxy
   __init__.py46393%86, 90, 94
   __main__.py22220%16–79
   _consts.py150100% 
   cache_control.py68494%71, 91, 113, 121
   config.py180100% 
   db.py1461590%75, 81, 103, 113–116, 145–147, 166, 199, 208–209, 229, 258, 300
   errors.py100100% 
   orm.py1151190%37, 91, 96, 101, 107, 113, 140–141, 154, 231, 235
   ota_cache.py4048579%95–96, 215, 226, 235–239, 253–255, 275, 291–294, 317–330, 358–367, 379, 440–441, 483–484, 554, 559–561, 567–570, 620, 639–640, 672–673, 684, 721–728, 735–736, 741–743, 747, 756, 803, 811–813, 892–895, 899–903, 917–934, 965, 971, 998, 1027–1029
   server_app.py1383972%75, 78, 84, 100, 102, 161–170, 212–243, 256–266, 292–298, 312–314, 320–322
   utils.py23196%31
TOTAL5869138876% 

commit f73c6d0
Author: Bodong Yang <[email protected]>
Date:   Mon Apr 22 00:16:45 2024 +0900

    fix(v3.7.x): not merging available_ecu_ids from child ECUs status resp again (#290)

    This PR fixes an unexpected implementation details which prevents the available_ecu_ids for actually behaving as expected.

    This is caused by:
    * ota_client_stub module merges the available_ecu_ids from sub ECU's status response.
    * ecu_info parsing logic has an implicit implementation detail for backward compatibility, which when available_ecu_ids is not defined in the ecu_info.yaml, add this ECU id into this field.

    The above effectively disabling the functionality of available_ecu_ids, unless the corresponding ECU contacts that don't need OTA also being commented out in ecu_info.yaml.

    With this PR, now the available_ecu_ids field should work as expected, and the behavior aligns with the documentation, which only available_ecu_ids from the main ECU is respected.
Bodong-Yang added a commit that referenced this pull request Apr 25, 2024
This PR does the following things:
1. refines the common module's subprocess wrapper methods.
2. refines and simplify the boot_control.common.CMDHelperFuncs implementation a lot.
3. cleanup and remove boot_contro.errors, now each boot controller implementation has their own error types.
4. use mount slot helper's prepare_standby_dev instead of each boot controller's prepare_standby_dev method.
5. integrate the new CMDHelperFuncs to each boot controller and fix up test files accordingly.

NOTE that cboot boot controller implementation is temporarily removed, it will be added back in #287 .
commit 727ebdd
Author: Bodong Yang <[email protected]>
Date:   Thu Apr 25 12:03:09 2024 +0900

    refine(v3.7.x): refine bootctrl.common CMDHelperFuncs (#289)

    This PR does the following things:
    1. refines the common module's subprocess wrapper methods.
    2. refines and simplify the boot_control.common.CMDHelperFuncs implementation a lot.
    3. cleanup and remove boot_contro.errors, now each boot controller implementation has their own error types.
    4. use mount slot helper's prepare_standby_dev instead of each boot controller's prepare_standby_dev method.
    5. integrate the new CMDHelperFuncs to each boot controller and fix up test files accordingly.

    NOTE that cboot boot controller implementation is temporarily removed, it will be added back in #287 .
@Bodong-Yang Bodong-Yang changed the title feature(v3.7.x): bootcontrol: add jetson-cboot with new firmware update support feature(v3.7.x): bootcontrol: refactor jetson-cboot, add new firmware update support Apr 25, 2024
@Bodong-Yang Bodong-Yang marked this pull request as ready for review April 25, 2024 03:24
@Bodong-Yang Bodong-Yang merged commit 794770c into v3.7.x Apr 25, 2024
3 checks passed
@Bodong-Yang Bodong-Yang deleted the feature/v3.7.x/jetson_cboot branch April 25, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature is introduced
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant