Adding file naming and indexing
[AGL/documentation.git] / docs / 1_Getting_Started / 3_Build_and_Boot_guide_Profile / 2_Flutter_Instrument_Cluster_(qemu-x86).md
1 # Build and Boot AGL Flutter Instrument Cluster demo image made for GSoC 
2
3 ## 0. Prepare Your Build Host
4
5 - Install the required tools to build an AGL Image. For detailed explanation, check [Preparing Your Build host](https://docs.automotivelinux.org/en/needlefish/#0_Getting_Started/2_Building_AGL_Image/1_Preparing_Your_Build_Host/)
6
7 ## 1. Define Your Top-Level Directory
8
9 ```bash
10 $ export AGL_TOP=$HOME/AGL
11 $ echo 'export AGL_TOP=$HOME/AGL' >> $HOME/.bashrc
12 $ mkdir -p $AGL_TOP
13 ```
14
15 ## 2. Download the repo Tool and Set Permissions
16
17 ```bash
18 $ mkdir -p $HOME/bin
19 $ export PATH=$HOME/bin:$PATH
20 $ echo 'export PATH=$HOME/bin:$PATH' >> $HOME/.bashrc
21 $ curl https://storage.googleapis.com/git-repo-downloads/repo > $HOME/bin/repo
22 $ chmod a+x $HOME/bin/repo
23 ```
24
25 ## 3. Download the AGL Source Files
26 To download the latest **master** branch  AGL files, use the following commands:
27 ```bash
28 $ cd $AGL_TOP
29 $ mkdir master
30 $ cd master
31 $ repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
32 $ repo sync
33 ```
34
35 ## 4. Initialize the build environment using aglsetup.sh Script
36 To initialize the build environment, we must use the setup script.
37 This script is available here: 
38 ```bash
39 $ $AGL_TOP/master/meta-agl/scripts/aglsetup.sh
40 ```
41 Run the script:
42
43 ```bash
44 $ cd $AGL_TOP
45 $ source master/meta-agl/scripts/aglsetup.sh -b build-flutter-cluster -m qemux86-64 agl-demo agl-devel
46 ```
47
48 - Here `-b` is used to specify the build directory and `-m` is used to specify the target platform.
49
50 - Running this script, will create a build directory if it does not exist. Default build directory: `$AGL_TOP/master/build-flutter-cluster`
51 - Default target paltform: `qemux86-64`
52
53 ** NOTE: Set the API key in local.conf **
54  
55 - By default navigation will not work, you need to set your openrouteservie API key to the variable `OPENROUTE_API_KEY` in your local.conf
56 - It is present at `$AGL_TOP/master/build-flutter-cluster/conf/local.conf`
57  
58 - Example: Just add `OPENROUTE_API_KEY = "your_openrouteservice_api_key"` to the end of local.conf
59
60
61 ## 5. Using BitBake
62
63 ```bash
64 $ cd $AGL_TOP/master/build-flutter-cluster
65 $ source agl-init-build-env
66 $ bitbake agl-cluster-demo-platform-flutter
67 ```
68
69 ## 6. Deploying the AGL Demo Image
70 Boot the image using QEMU
71
72 ```bash
73 $ cd $AGL_TOP/master/build-flutter-cluster
74 $ source agl-init-build-env
75 $ runqemu kvm serialstdio slirp publicvnc
76 ```
77
78 ## 6. Run the Graphics
79 To get graphics of the app, you need VNC client like VNC Viewer or Vinagre
80
81 - Open the VNC client
82 - Enter the server address as `localhost:0` 
83
84 That's it, you should get something like this:
85 ![Screenshot](images/flutter_instrument_cluster.png)
86
87 ## 7. To start navigation widget
88 To get the navigation, you need to use `kuksa_viss_client` or `kuksa_vss_init.py` script.
89
90 #### **Using inbuilt `kuksa_vss_init.py` script**
91
92  After running the build, you should get this:
93  
94 ```bash
95 Automotive Grade Linux 13.93.0 qemux86-64 ttyS0
96
97 qemux86-64 login: 
98
99 ```
100
101 Login as root
102
103 ```bash
104 qemux86-64 login: root
105 ```
106 Now run the script
107
108 ```bash
109 root@qemux86-64:~# /usr/sbin/kuksa_vss_init.py
110 ```
111
112 #### **Using `kuksa_viss_client`** 
113
114 Know more about kuksa_viss_client, [Follow this](https://github.com/eclipse/kuksa.val/tree/master/kuksa_viss_client)
115
116 - Run the kuksa_viss_client
117 - Authorize using token
118
119 Then
120
121 ```bash
122 Test Client> setValue Vehicle.Cabin.SteeringWheel.Switches.Info true
123 ```
124 ![Screenshot](images/flutter_instrument_cluster_map.png)
125
126