Use gitbook to manage documentation
[apps/agl-service-can-low-level.git] / docs / 2-Installation.md
1 # Prerequisites
2
3 - An AGL system installed with a Chinook version.
4
5 - Make sure you built the AGL generator else you will not be able to generate custom low-level CAN binding. Generator can be found [here](http://github.com/iotbzh/can-config-generator) with the attached instruction to install and run it. It will produce a *configuration-generated.cpp* file to paste in the source, *src/*, directory.
6
7 - Make sure you already set up the AGL SDK using the following [guide](http://docs.iot.bzh/docs/getting_started/en/dev/reference/setup-sdk-environment.html).
8
9 To get the correct SDK version installed, you **must** prepare your environment with the **chinook-next** version. To do so, run the following command in your docker image:
10
11 ```bash
12 $ prepare_meta -f chinook-next -o /xdt -l /home/devel/mirror -p /home/devel/share/proprietary-renesas-rcar/ -t porter -e wipeconfig -e rm_work
13 ```
14
15 - Check that you updated git submodules, executing the following commands from this repository:
16
17 ```bash
18 $ git submodule init
19 $ git submodule update
20 ```
21
22 - An [USB CAN adapter](http://shop.8devices.com/usb2can) connected to OBD2 connector through the [right cable](http://www.obd2cables.com/).
23
24 # Getting started
25
26 ## Compile and install the binding
27
28 With an AGL SDK environment correctly configured, I suggest you to set the TARGET variable in the root CMakeLists.txt file, if you have an AGL target already running in your network.
29
30 Then you can directly build and install the binding and source directory on your target system.
31
32 Execute these commands to get your binding compile :
33
34 ```bash
35 $ mkdir build
36 $ cd build
37 $ cmake ..
38 $ make
39 ```
40
41 And if you have set TARGET variable, you can install it on your AGL system :
42
43 ```bash
44 $ make install
45 [ 16%] Built target bitfield
46 [ 27%] Built target isotp
47 [ 40%] Built target openxc
48 [ 48%] Built target uds
49 [ 97%] Built target low-can-binding
50 [100%] Built target widget
51 Install the project...
52 -- Install configuration: ""
53 true
54 { "added": "low-can-binding@0.1" }
55 ```
56
57 It's possible that you'll see the following message :
58
59 ```bash
60 Error org.freedesktop.DBus.Error.Failed: "system error"
61 ```
62
63 It's because installation remove the binding before installing it.
64
65 If it is the first time that you make the installation then you'll have this message in place of ***true***.
66
67 To install it manually, you need to copy the *low-can-binding.wgt* file on your target, then from it execute the following commands :
68
69 On your host, to copy over the network :
70
71 ```bash
72 $ scp low-can-binding.wgt root@<target_IP>:~
73 ```
74
75 On the target, assuming ***wgt*** file is in the root home directory :
76
77 ```bash
78 ~# afm-util install low-can-binding.wgt
79 { "added": "low-can-binding@0.1" }
80 ```