Uploaded image for project: ' AGL Development'
  1. AGL Development
  2. SPEC-3538

low-can binding build-time J1939 detection is problematic

XMLWordPrintable

      The low-can binding (agl-service-can-low-level) looks for J1939 support in the kernel by looking for /usr/include/linux/can/j1939.h at build time (it also does something similar for its ISO TP support).  If the header is seen, it builds in code that results in the binding failing to start if J1939 support is not present in the run-time kernel.  This is problematic  with Yocto dunfell because the 5.4 kernel headers are used by default, so the J1939 support will always be enabled unless a BSP over-rides linux-libc-headers (which rcar3 does, even though upstream OE/YP strongly recommend against it).  In practice, the result at the moment is that low-can fails to start on most of the AGL platforms with errors like:

      Aug 19 16:14:34 qemux86-64 afbd-agl-service-can-low-level[1017]: ERROR: [API low-can] Open failed. Protocol not supported [/ws/scottm/dev/agl/agl-repo/build-qemux86-64/workspace/sources/agl-service-can-low-leve
      l/low-can-binding/utils/socketcan.cpp:77,open]
      Aug 19 16:14:34 qemux86-64 afbd-agl-service-can-low-level[1017]: ERROR: [API low-can] Error open socket address claiming [/ws/scottm/dev/agl/agl-repo/build-qemux86-64/workspace/sources/agl-service-can-low-level
      /low-can-binding/utils/socketcan-j1939/socketcan-j1939-addressclaiming.cpp:293,claim_address]
      Aug 19 16:14:34 qemux86-64 afbd-agl-service-can-low-level[1017]: ERROR: [API low-can] Claim address failed [/ws/scottm/dev/agl/agl-repo/build-qemux86-64/workspace/sources/agl-service-can-low-level/low-can-bindi
      ng/utils/socketcan-j1939/socketcan-j1939-addressclaiming.cpp:379,open]
      Aug 19 16:14:34 qemux86-64 afbd-agl-service-can-low-level[1017]: ERROR: [API low-can] Error open socket address claiming for j1939 protocol [/ws/scottm/dev/agl/agl-repo/build-qemux86-64/workspace/sources/agl-se
      rvice-can-low-level/low-can-binding/binding/low-can-cb.cpp:954,init_binding]
      Aug 19 16:14:34 qemux86-64 afbd-agl-service-can-low-level[1017]: ERROR: Initialisation of service API low-can failed (-1): Protocol not supported [/usr/src/debug/af-binder/master+gitAUTOINC+33ddfb569b-r0/git/sr
      c/afb-export.c:1793,afb_export_start]
      Aug 19 16:14:34 qemux86-64 afbd-agl-service-can-low-level[1017]: ERROR: The api low-can failed to start [/usr/src/debug/af-binder/master+gitAUTOINC+33ddfb569b-r0/git/src/afb-apiset.c:820,start_api]
      Aug 19 16:14:34 qemux86-64 afbd-agl-service-can-low-level[1017]: NOTICE: API monitor starting... [/usr/src/debug/af-binder/master+gitAUTOINC+33ddfb569b-r0/git/src/afb-apiset.c:808,start_api]
      Aug 19 16:14:34 qemux86-64 afbd-agl-service-can-low-level[1017]: INFO: API monitor started [/usr/src/debug/af-binder/master+gitAUTOINC+33ddfb569b-r0/git/src/afb-apiset.c:827,start_api]
      Aug 19 16:14:34 qemux86-64 kernel: can: request_module (can-proto-7) failed.
      Aug 19 16:14:34 qemux86-64 systemd[1]: afm-service-agl-service-can-low-level-8.99-main.service: Main process exited, code=exited, status=1/FAILURE
      Aug 19 16:14:34 qemux86-64 systemd[1]: afm-service-agl-service-can-low-level-8.99-main.service: Failed with result 'exit-code'.
      Aug 19 16:14:34 qemux86-64 systemd[1]: Failed to start Expose CAN Low Level APIs through AGL Framework.

      It seems unlikely that just enabling CAN_J1939 in the AGL can-bus.cfg kernel fragment will be sufficient, as there are platforms like Raspberry Pi that have kernels older than 5.4.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            scottm Scott Murray
            scottm Scott Murray
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: