summaryrefslogtreecommitdiffstats
path: root/docs/3-Installation-J1939.md
blob: 71595e410cc79bd3de231ffd6ac2f03852ba695e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Installation j1939 for AGL

#### Minimum kernel version : 4.19

## Compilation of kernel j1939

##### Clone linux-can-next repository on kernel.org

```bash
git clone https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/
```

##### Checkout on j1939 branch

```bash
git checkout j1939
```

##### Add the compilation of the j1939

```bash
make menuconfig
	- Networking Support
		- Can bus subsystem support
			- <M> SAE J1939
			- [*] 	debug SAE J1939
```

##### Compile

```bash
make
```

##### Install

```bash
make modules_install
make install
```

##### Update grub

###### CentOS/RHEL/Oracle/Scientific and Fedora Linux

```bash
grub2-mkconfig -o /boot/grub2/grub.cfg
grubby --set-default /boot/vmlinuz-...
reboot
```

###### Debian/Ubuntu Linux

```bash
update-grub
reboot
```

##### Check if the installation is correct

```bash
modprobe can-j1939
```

If no errors are generated you have successfully install a kernel with j1939 module.

You can have a problem with header file, to check that go in the file /usr/include/linux/can.h

```bash
vi /usr/include/linux/can.h
```

If in the struct sockaddr_can you don't see j1939, the header are not upgrade.

So you need to do this manually, go to you're linux-can-next repository and do the following command:

```bash
cp include/uapi/linux/can.h /usr/include/linux/can.h
cp include/uapi/linux/can/j1939.h /usr/include/linux/can/
```

## Enable support at build time

To enable J1939 support, the binding must be built with -DWITH_FEATURE_J1939=ON.
If using the autobuild script, add CONFIGURE_ARGS="-DWITH_FEATURE_J1939=ON" to the command used.