Skip to content

Add CAN_J1939 as module to default build configs - #4346

Merged
pelwell merged 3 commits into
rpi-5.10.yfrom
unknown repository
May 14, 2021
Merged

pelwell merged 3 commits into
rpi-5.10.yfrom
unknown repository

Conversation

@ghost

@ghost ghost commented May 14, 2021

Copy link
Copy Markdown

This PR adds the Kconfig flag CONFIG_CAN_J1939=m

Abstract:

  • there is a CAN protocol named J1939
  • support in Linux Kernel since v5.4
  • support in Python since v3.9
  • header file available in package raspberrypi-kernel-headers since version 1:1.20210430-2 .
  • therefore building Python 3.9.5 with J1939 support works now

Problem:
After building Python3.9.5 , the module turns out to be missing in
regular raspberrypi-kernel

python -i
Python 3.9.5 (default, May 13 2021, 13:29:45) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> s = socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_J1939)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/socket.py", line 232, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 93] Protocol not supported

Solution:

  • add CONFIG_CAN_J1939=m to relevant build configs

Reference:

Abstract:
There is a CAN protocol named J1939 which is
supported by Linux Kernel since v5.4

Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is
not build for kernel v5.10.y due to the
missing flag.
Therefore set it to build as module.

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
@ghost

ghost commented May 14, 2021

Copy link
Copy Markdown
Author

Cross-compile-tested on X86_64, currently running a native build on a pi0w, that is my test device for CAN related stuff.

@pelwell

pelwell commented May 14, 2021

Copy link
Copy Markdown
Contributor

These new settings have been added in the wrong place - they work as is, but using make savedefconfig causes them to move (between CONFIG_CAN=m and CONFIG_CAN_ISOTP=m, as it happens). Please fix this, and also update arch/arm64/configs/bcm2711_defconfig and arch/arm64/configs/bcmrpi3_defconfig.

Patrick Menschel added 2 commits May 14, 2021 13:28
Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
@ghost

ghost commented May 14, 2021

Copy link
Copy Markdown
Author

ACK

@pelwell
pelwell merged commit b657cd2 into raspberrypi:rpi-5.10.y May 14, 2021
@ghost

ghost commented May 15, 2021

Copy link
Copy Markdown
Author

Native build complete and verified to be working.

python -i
Python 3.9.5 (default, May 13 2021, 13:29:45)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.>>> import socket
>>> s = socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_J1939)
>>> s.bind(("mcp0", 0, 0x40000, 0x20))
>>> s.sendto(bytes(range(8)), ("", 0, 0x12300, 0x30))
8
candump mcp0
  mcp0  19233020   [8]  00 01 02 03 04 05 06 07
  mcp0  19233020   [8]  00 11 22 33 44 55 66 77

popcornmix added a commit to raspberrypi/firmware that referenced this pull request May 24, 2021
kernel: Add CAN_J1939 as module to default build configs
See: raspberrypi/linux#4346

kernel: add sensirion sgp30 to i2c-sensor overlay
See: raspberrypi/linux#4355

kernel: Updated H265 V4L2 decoder plus V4L2 stability fixes
See: raspberrypi/linux#4343

firmware: platform: Remove build-time constant for MICROVOLTS_PER_PIP
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request May 24, 2021
kernel: Add CAN_J1939 as module to default build configs
See: raspberrypi/linux#4346

kernel: add sensirion sgp30 to i2c-sensor overlay
See: raspberrypi/linux#4355

kernel: Updated H265 V4L2 decoder plus V4L2 stability fixes
See: raspberrypi/linux#4343

firmware: platform: Remove build-time constant for MICROVOLTS_PER_PIP
pelwell pushed a commit that referenced this pull request May 24, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
pelwell pushed a commit that referenced this pull request May 24, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request May 25, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jun 8, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jun 14, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jul 9, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jul 15, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jul 27, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
Noltari pushed a commit to Noltari/rpi-linux that referenced this pull request Aug 20, 2021
There is a CAN protocol named J1939 which is supported by Linux Kernel
since v5.4. Recently J1939 header file turned up in
raspberrypi-kernel-headers but the module is not built for kernel
v5.10.y due to the missing flag. Therefore set it to build as module:

CONFIG_CAN_J1939=m

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant