8ab15f3369367aeb442fb86ebe3959a815a87f81
[apps/agl-service-can-low-level.git] / docs / 3-Installation-J1939.md
1 # Installation j1939 for AGL
2
3 #### Minimum kernel version : 4.19
4
5 ## Compilation of kernel j1939
6
7 ##### Clone linux-can-next repository on kernel.org
8
9 ```bash
10 git clone https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/
11 ```
12
13 ##### Checkout on j1939 branch
14
15 ```bash
16 git checkout j1939
17 ```
18
19 ##### Add the compilation of the j1939
20
21 ```bash
22 make menuconfig
23         - Networking Support
24                 - Can bus subsystem support
25                         - <M> SAE J1939
26                         - [*]   debug SAE J1939
27 ```
28
29 ##### Compile
30
31 ```bash
32 make
33 ```
34
35 ##### Install
36
37 ```bash
38 make modules_install
39 make install
40 ```
41
42 ##### Update grub
43
44 ###### CentOS/RHEL/Oracle/Scientific and Fedora Linux
45
46 ```bash
47 grub2-mkconfig -o /boot/grub2/grub.cfg
48 grubby --set-default /boot/vmlinuz-...
49 reboot
50 ```
51
52 ###### Debian/Ubuntu Linux
53
54 ```bash
55 update-grub
56 reboot
57 ```
58
59 ##### Check if the installation is correct
60
61 ```bash
62 modprobe can-j1939
63 ```
64
65 If no errors are generated you have successfully install a kernel with j1939 module.
66
67 You can have a problem with header file, to check that go in the file /usr/include/linux/can.h
68
69 ```bash
70 vi /usr/include/linux/can.h
71 ```
72
73 If in the struct sockaddr_can you don't see j1939, the header are not upgrade.
74
75 So you need to do this manually, go to you're linux-can-next repository and do the following command:
76
77 ```bash
78 cp include/uapi/linux/can.h /usr/include/linux/can.h
79 cp include/uapi/linux/can/j1939.h /usr/include/linux/can/
80 ```
81
82
83
84 ### Activate J1939 CMAKE
85
86 To activate J1939 at the compilation.
87
88 Edit the file conf.d/cmake/cmake/config.cmake
89
90 And change the line :
91
92 ```cmake
93 option(WITH_FEATURE_J1939 "Activate J1939" OFF)
94 ```
95
96 With :
97
98 ```cmake
99 option(WITH_FEATURE_J1939 "Activate J1939" ON)
100 ```
101
102
103