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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
---
title: Building for x86 (Emulation and Hardware)
---
Building an image for emulation allows you to simulate your
image without actual target hardware.
This section describes the steps you need to take to build the
AGL demo image for emulation using either Quick EMUlator (QEMU) or
VirtualBox, and later the same image can be used to boot any hardware.
## 1. Making Sure Your Build Environment is Correct
The
"[Initializing Your Build Environment](./04_Initializing_Your_Build_Environment.md)"
section presented generic information for setting up your build environment
using the `aglsetup.sh` script.
If you are building the AGL demo image for emulation, you need to specify some
specific options when you run the script:
**Sample Qt based IVI demo :**
```sh
$ source meta-agl/scripts/aglsetup.sh -f -m qemux86-64 -b qemux86-64 agl-demo agl-devel
$ echo "# reuse download directories" >> $AGL_TOP/site.conf
$ echo "DL_DIR = \"$HOME/downloads/\"" >> $AGL_TOP/site.conf
$ echo "SSTATE_DIR = \"$AGL_TOP/sstate-cache/\"" >> $AGL_TOP/site.conf
$ ln -sf $AGL_TOP/site.conf conf/
```
**Sample HTML5 based IVI demo :**
```sh
$ source meta-agl/scripts/aglsetup.sh -f -m qemux86-64 -b qemux86-64 agl-demo agl-devel agl-profile-graphical-html5
$ echo "# reuse download directories" >> $AGL_TOP/site.conf
$ echo "DL_DIR = \"$HOME/downloads/\"" >> $AGL_TOP/site.conf
$ echo "SSTATE_DIR = \"$AGL_TOP/sstate-cache/\"" >> $AGL_TOP/site.conf
$ ln -sf $AGL_TOP/site.conf conf/
```
**IVI-EG Flutter based demo :**
```sh
$ source meta-agl/scripts/aglsetup.sh -f -m qemux86-64 -b qemux86-64 agl-flutter agl-devel
$ echo "# reuse download directories" >> $AGL_TOP/site.conf
$ echo "DL_DIR = \"$HOME/downloads/\"" >> $AGL_TOP/site.conf
$ echo "SSTATE_DIR = \"$AGL_TOP/sstate-cache/\"" >> $AGL_TOP/site.conf
$ ln -sf $AGL_TOP/site.conf conf/
```
**IC-EG container image :**
```sh
### TBD
```
**Virt-EG demo image :**
```sh
### TBD
```
The "-m" option specifies the "qemux86-64" machine.
The list of AGL features used with script are appropriate for development of
the AGL demo image suited for either QEMU or VirtualBox.
## 2. Using BitBake
Start the build using the `bitbake` command.
**NOTE:** An initial build can take many hours depending on your
CPU and and Internet connection speeds.
The build also takes approximately 100G-bytes of free disk space.
**Sample Qt based IVI demo :**
The target is `agl-ivi-demo-qt`.
```sh
$ time bitbake agl-ivi-demo-qt
```
By default, the build process puts the resulting image in the Build Directory and further exporting that as `$IMAGE_NAME`:
```sh
<build_directory>/tmp/deploy/images/qemux86-64/agl-ivi-demo-qt-qemux86-64.vmdk.xz
$ export IMAGE_NAME=agl-ivi-demo-qt-qemux86-64.vmdk.xz
```
**Sample HTML5 based IVI demo :**
The target is `agl-ivi-demo-html5`.
```sh
$ time bitbake agl-ivi-demo-html5
```
By default, the build process puts the resulting image in the Build Directory and further exporting that as `$IMAGE_NAME`:
```sh
<build_directory>/tmp/deploy/images/qemux86-64/agl-ivi-demo-html5-qemux86-64.vmdk.xz
$ export IMAGE_NAME=agl-ivi-demo-html5-qemux86-64.vmdk.xz
```
**IVI-EG Flutter based demo :**
The target is `agl-image-flutter`.
```sh
$ time bitbake agl-image-flutter
```
**IC-EG container image :**
```sh
# TBD
```
**Virt-EG demo image :**
```sh
# TBD
```
## 3. Deploying the AGL Demo Image
Deploying the image consists of decompressing the image and then
booting it using either QEMU, VirtualBox or physical system.
The examples below are usually for the 'agl-ivi-demo-qt' target.
Please adapt accordingly to your target image.
**3.1 QEMU**
Depending on your Linux distribution, use these commands to install QEMU:
If you built your image with bitbake, you can now just use the ``runqemu`` wrapper, after sourcing `agl-init-build-env` inside the build-dir :
For this example :
```sh
$ source $AGL_TOP/master/qemux86-64/agl-init-build-env
```
In general :
```sh
$ source $AGL_TOP/<release-branch-name>/<build-dir>/
```
And further use `runqemu` to boot the image :
```sh
$ runqemu tmp/deploy/images/qemux86-64/agl-ivi-demo-qt-qemux86-64.qemuboot.conf kvm serialstdio slirp publicvnc audio
```
If you need to run it outside of the bitbake environment or need special settings for
hardware pass-through using `qemu` :
**NOTE:** if you have created an AGL crosssdk, it will contain a
QEMU binary for the build host.
This SDK QEMU binary does not support graphics.
Consequently, you cannot use it to boot the AGL image and
need to call your host's qemu binary instead.
**NOTE:** the VM images need UEFI in the emulator to boot. Thus you need
to install the necessary files with below commands (ovmf).
If your build host is running
[Arch Linux](https://www.archlinux.org/), use the following commands:
```sh
sudo pacman -S qemu ovmf
export OVMF_PATH=/usr/share/ovmf/x64/OVMF_CODE.fd
```
If your build host is running Debian or Ubuntu, use the following commands:
```sh
sudo apt-get install qemu-system-x86 ovmf
export OVMF_PATH=/usr/share/ovmf/OVMF.fd
```
If you build host is running Fedora, use the following commands:
```sh
sudo yum install qemu qemu-kvm edk2-ovmf
export OVMF_PATH=/usr/share/edk2/ovmf/OVMF_CODE.fd
```
**Note:**
Once QEMU is installed, boot the image with KVM support:
```sh
qemu-system-x86_64 -enable-kvm -m 2048 \
-bios ${OVMF_PATH} \
-hda ${IMAGE_NAME} \
-cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \
-vga virtio -show-cursor \
-device virtio-rng-pci \
-serial mon:stdio -serial null \
-soundhw hda \
-net nic \
-net user,hostfwd=tcp::2222-:22
```
**NOTE:** KVM may not be supported within a virtualized environment such as
VirtualBox. This is indicated by the qemu command above giving the error
message `Could not access KVM kernel module: No such file or directory` or
the kernel log output contains the error message `kvm: no hardware support`.
The image can be booted in such an environment by removing `-enable-kvm` from
the qemu command line, however this will result in lower perfromance within
the AGL demo.
**3.2 VirtualBox**
Once VirtualBox is installed, follow these steps to boot the image:
1. Install and set up [Virtual Box](https://www.virtualbox.org/wiki/Linux_Downloads).
2. Extract the vmdk file :
```sh
cd tmp/deploy/images/qemux86-64
xz -d ${IMAGE_NAME}
```
3. Configure virtual box for AGL :
- Click on `New` or `Add`.
- Enter Name as `agl-demo`.
- Type as `Linux`.
- Version as `Other Linux (64-bit)`, click on `Next`.
![vbox-step-1](images/vbox-1.png)
- Select Memory size. Recommended is `2048 MB`, click on `Next`.
![vbox-step-2](images/vbox-2.png)
- Click on `Use an existing virtual hard disk file`, and select the extracted `agl-ivi-demo-qt-qemux86-64.vmdk.xz` or `<html5-image?>` file, click on `Create`.
![vbox-step-3](images/vbox-3.png)
- Go to `Settings`, and into `System`. Select `Chipset : IHC9`. Check on `Enable EFI (special OSes only)` and click on `OK`.
![vbox-step-4](images/vbox-4.png)
- Go to `Storage`, and change the attribute to `Type : AHCI` and click on `OK`.
![vbox-step-5](images/vbox-5.png)
- Click on `Start`.
- For troubleshooting, you can refer [here](https://lists.automotivelinux.org/g/agl-dev-community/message/8474).
**3.3 x86 physical system**
**NOTE :** UEFI enabled system is required.
1. Extract the image into USB drive :
```sh
$ cd tmp/deploy/images/qemux86-64
$ lsblk
$ sudo umount <usb_device_name>
$ xzcat agl-ivi-demo-qt-qemux86-64.wic.xz | sudo dd of=<usb_device_name> bs=4M
$ sync
```
2. Boot from USB drive on the x86 system.
|