|
| 1 | +# Eclipse Leda on Automotive Grade Linux (AGL) |
| 2 | + |
| 3 | +[Automotive Grade Linux](https://www.automotivelinux.org/) |
| 4 | + · |
| 5 | +[Meta Leda](https://github.com/eclipse-leda/meta-leda) |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +Eclipse Leda and AGL are both operating systems for the automotive domain. |
| 10 | +Both rely on the Yocto/BitBake toolchain and provide OpenEmbedded layers containing multiple recipes. |
| 11 | +AGL primarily started in infotainment, whereas Eclipse Leda is an integration platform for different Eclipse SDV technologies, |
| 12 | +such as the KUKSA Databroker or Eclipse Kanto. |
| 13 | +There is some overlap between both OS regarding software/firmware update strategies. |
| 14 | + |
| 15 | +This manual allows to build and run components of the Eclipse Leda project (namely recipes from the meta-leda meta layer) |
| 16 | +on top of the AGL base image. |
| 17 | + |
| 18 | +> 📝 Note: The integration is tested with AGL version prickly pike 16.0.2 |
| 19 | +
|
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +In order to prepare the build, first install the [repo CLI](https://source.android.com/docs/setup/create/repo). |
| 23 | + |
| 24 | +## Getting started |
| 25 | + |
| 26 | +Install git submodules for AGL manifest. |
| 27 | + |
| 28 | +```bash |
| 29 | +git submodule init |
| 30 | +git submodule update |
| 31 | +``` |
| 32 | + |
| 33 | +Next, include the following meta layers into the repo manifest by changing the [repo manifest file](AGL-repo/pike_16.0.2.xml): |
| 34 | + |
| 35 | +* Meta-Rauc |
| 36 | +* Meta-Leda |
| 37 | +* Meta-Kanto |
| 38 | +* Meta-lts-mixins-go |
| 39 | + |
| 40 | +As AGL is built on top of the Yocto Project and currently utilizes Yocto Kirkstone, all components |
| 41 | +we incorporate must be compatible with older versions of Yocto. Consequently, each of the four projects we aim to integrate |
| 42 | +maintains dedicated branches tailored to the Yocto Kirkstone version. |
| 43 | +Utilizing the milestone [M03](https://github.com/eclipse-leda/leda-distro/releases/tag/v0.1.0-M3) of the Eclipse Leda project, we can test the integration by executing the |
| 44 | +[companion-application](https://github.com/eclipse-sdv-blueprints/companion-application/blob/main/interact-seat-adjuster.md#run-kuksa-client) |
| 45 | +example. |
| 46 | + |
| 47 | +```xml |
| 48 | +<!-- meta-lts-mixins-go --> |
| 49 | +<project name="meta-lts-mixins" path="external/meta-lts-mixins-go" remote="yocto" revision="a0384aea22a3ddfc70202a26ee1372c91b1fcfc9" upstream="kirkstone/go" /> |
| 50 | + |
| 51 | +<!-- meta-kanto --> |
| 52 | +<project name="eclipse-kanto/meta-kanto" path="external/meta-kanto" remote="github" revision="7a3dcd355b88c70b7cfa6b37948c7eb7c5b00c7e" upstream="kirkstone" /> |
| 53 | + |
| 54 | +<!-- meta-leda --> |
| 55 | +<project name="eclipse-leda/meta-leda" path="external/meta-leda" remote="github" revision="3f7e21a8484862076d4992d9463b3ce7aa2cbad0" upstream="kirkstone" /> |
| 56 | + |
| 57 | +<!-- meta-rauc --> |
| 58 | +<project name="rauc/meta-rauc" path="external/meta-rauc" remote="github" revision="9e206d6998b363315791be144815a4eabc3fe5a8" upstream="kirkstone" /> |
| 59 | +``` |
| 60 | + |
| 61 | +> 📝 Some Background: We need to add the lts-mixins-go layer to install a newer Golang version to compile the meta-kanto layer. |
| 62 | +
|
| 63 | +Unfortunately, this only takes effect after making a new commit on a new branch inside the AGL-repo submodule. |
| 64 | + |
| 65 | +```bash |
| 66 | +cd AGL-repo |
| 67 | +git checkout -b leda-integration |
| 68 | +git add . |
| 69 | +git commit -m "Add Eclipse Kanto and Eclipse Leda meta layers" |
| 70 | +``` |
| 71 | + |
| 72 | +Now, let us initialize the repo tool. |
| 73 | + |
| 74 | +```bash |
| 75 | +repo init -u ./AGL-repo -b leda-integration -m pike_16.0.2.xml |
| 76 | +repo sync |
| 77 | +``` |
| 78 | + |
| 79 | +Initialize the bitbake environment like this: |
| 80 | + |
| 81 | +```bash |
| 82 | +source meta-agl/scripts/aglsetup.sh -m qemux86-64 agl-demo agl-netboot |
| 83 | +``` |
| 84 | + |
| 85 | +Now, let us extend the `bblayers.conf` file with some configuration. |
| 86 | + |
| 87 | +```bash |
| 88 | +BBLAYERS =+ " \ |
| 89 | + ${METADIR}/external/meta-virtualization \ |
| 90 | + ${METADIR}/external/meta-kanto \ |
| 91 | + ${METADIR}/external/meta-leda/meta-leda-backports \ |
| 92 | + ${METADIR}/external/meta-rauc \ |
| 93 | + ${METADIR}/external/meta-leda/meta-leda-components \ |
| 94 | + " |
| 95 | +``` |
| 96 | + |
| 97 | +Finally, we can edit the local.conf bitbake configuration like this: |
| 98 | + |
| 99 | +```bash |
| 100 | +INHERIT += "rm_work" |
| 101 | + |
| 102 | +DISTRO_FEATURES:append = " sdv virtualization git containerd rauc" |
| 103 | +DISTRO_VERSION = "2022" |
| 104 | + |
| 105 | +IMAGE_ROOTFS_EXTRA_SPACE:append = " + 8000000" |
| 106 | + |
| 107 | +# Configure the kernel modules required to be included |
| 108 | +MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" |
| 109 | + |
| 110 | +# System initialization manager setup |
| 111 | +VIRTUAL-RUNTIME_init_manager = "systemd" |
| 112 | +DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" |
| 113 | +VIRTUAL-RUNTIME_initscripts = "systemd-compat-units" |
| 114 | + |
| 115 | +# Add the Eclipse Kanto components |
| 116 | +# leda-utils, blueprint-selector, kantui, kanto-auto-deployer, sdv-databroker-cli |
| 117 | +IMAGE_INSTALL:append = " suite-connector container-management update-manager leda-utils blueprint-selector kantui kanto-auto-deployer jq" |
| 118 | +``` |
| 119 | + |
| 120 | +> 📝 Note: The jq recipe is optional since we only use it to test the Kuksa client. |
| 121 | +> By utilizing the `IMAGE_ROOTFS_EXTRA_SPACE` variable, we allocate additional disk space for all containers deployed through Eclipse Kanto. |
| 122 | +
|
| 123 | +## Build the image |
| 124 | + |
| 125 | +### macOS |
| 126 | + |
| 127 | +BitBake does not natively run on macOS. Therefore, it is necessary to either use a Linux VM or a preconfigured |
| 128 | +container image named [crops](https://github.com/crops/poky-container), provided by the Yocto community. |
| 129 | +This repository contains a [Dockerfile](./Dockerfile) which extends the crops base image, e.g., by the repo CLI so that it does |
| 130 | +not need to be installed manually. |
| 131 | + |
| 132 | +Build the crops based image |
| 133 | + |
| 134 | +```bash |
| 135 | +docker build -t agl-build-image . |
| 136 | +``` |
| 137 | + |
| 138 | +Follow the [crops for Mac tutorial](https://github.com/crops/docker-win-mac-docs/wiki/Mac-Instructions) and create a volume and Samba server to mount the volume into the host machine. |
| 139 | + |
| 140 | +```bash |
| 141 | +docker volume create --name agl-volume |
| 142 | +docker run -it --rm -v agl-volume:/workdir busybox chown -R 1000:1000 /workdir |
| 143 | + |
| 144 | +docker create -t -p 445:445 --name samba -v agl-volume:/workdir crops/samba |
| 145 | +docker start samba |
| 146 | + |
| 147 | +sudo ifconfig lo0 127.0.0.2 alias up |
| 148 | +``` |
| 149 | + |
| 150 | +Start a container running the crops image |
| 151 | + |
| 152 | +```bash |
| 153 | +docker run --rm -it -v agl-volume:/workdir agl-build-image --workdir=/workdir |
| 154 | +``` |
| 155 | + |
| 156 | +Inside the container it is possible to continue the remaining prerequisites. |
| 157 | + |
| 158 | +### Linux |
| 159 | + |
| 160 | +We can now use bitbake to build our image by running `bitbake agl-demo-platform`. |
| 161 | +When you run this command on a Linux machine, the build should succeed. |
| 162 | +To get an isolated environment, you can use the Docker crops image described in the macOS section. |
| 163 | +Just build the image and start the container at the root of this project like this: |
| 164 | + |
| 165 | +```bash |
| 166 | +docker run --rm -it -v $(pwd):$(pwd) crops/poky:ubuntu-22.04 --workdir=$(pwd) |
| 167 | +``` |
| 168 | + |
| 169 | +Don't forget to source the environment inside the build directory `source build/agl-init-build-env` in order to use the |
| 170 | +bitbake command. |
| 171 | + |
| 172 | +Once the build has finished, run the image using qemu. |
| 173 | + |
| 174 | +## Run the image |
| 175 | + |
| 176 | +```bash |
| 177 | +qemu-system-x86_64 \ |
| 178 | + -kernel bzImage \ |
| 179 | + -hda agl-demo-platform-qemux86-64.ext4 \ |
| 180 | + -m 4096 \ |
| 181 | + -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \ |
| 182 | + -vga none -device virtio-gpu-pci \ |
| 183 | + -device virtio-rng-pci \ |
| 184 | + -serial mon:stdio -serial null \ |
| 185 | + -net nic \ |
| 186 | + -net user,hostfwd=tcp::2222-:22 \ |
| 187 | + -nographic \ |
| 188 | + -append "root=/dev/sda console=ttyS0 video=vesafb" |
| 189 | +``` |
| 190 | + |
| 191 | +There is also a convenient wrapper around the qemu command: |
| 192 | + |
| 193 | +```bash |
| 194 | +runqemu tmp/deploy/images/qemux86-64/agl-demo-platform-qemux86-64.qemuboot.conf kvm serialstdio slirp publicvnc |
| 195 | +``` |
| 196 | + |
| 197 | +Note that you have to source the environment file inside the build directory for using this command: |
| 198 | + |
| 199 | +`source build/agl-init-build-env`. |
| 200 | + |
| 201 | +After starting the image with qemu, you can log in via the user `root` and execute `osd-health` for a quick health check |
| 202 | +of the running instance. |
| 203 | + |
| 204 | +You are now able to start the example applications via `kanto-auto-deploy /var/containers/manifests`. |
| 205 | + |
| 206 | +## Versions overview |
| 207 | + |
| 208 | +| Component | Version | Branch | Commit | Repository | |
| 209 | +|--------------------|---------------------|--------------|-------------------------------------------|------------------------------------------------------------------------------------------------------------------| |
| 210 | +| AGL | Prickly Pike 16.0.2 | kirkstone | Ia6b326973619f34911200f77bfa63abed01daad8 | [Gerrit](https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL%2FAGL-repo.git;a=shortlog;h=refs%2Fheads%2Fpike) | |
| 211 | +| Eclipse Leda | Milestone 0.1.0-M3 | kirkstone | 3f7e21a8484862076d4992d9463b3ce7aa2cbad0 | [Github](https://github.com/eclipse-leda/meta-leda/releases/tag/0.1.0-M3) | |
| 212 | +| Eclipse Kanto | latest on branch | kirkstone | 7a3dcd355b88c70b7cfa6b37948c7eb7c5b00c7e | [Github](https://github.com/eclipse-kanto/meta-kanto/tree/kirkstone) | |
| 213 | +| Meta-lts-mixins-go | latest on branch | kirkstone/go | a0384aea22a3ddfc70202a26ee1372c91b1fcfc9 | [Github](https://git.yoctoproject.org/meta-lts-mixins/log/?h=kirkstone/go) | |
| 214 | + |
| 215 | +## Target state |
| 216 | + |
| 217 | +If everything was building correctly and the image is bootable, after loggin in into the root user, the output should look |
| 218 | +like shown in the screenshot below: |
| 219 | + |
| 220 | + |
| 221 | + |
| 222 | +In case you used the `kanto-auto-deploy` command to utilize and deploy the integrated container manifests, |
| 223 | +the output of `sdv-health` should look like this: |
| 224 | + |
| 225 | + |
| 226 | + |
| 227 | +> 📝 At present, no efforts have been undertaken to integrate |
| 228 | +> Rauc and the update mechanisms. The primary emphasis has remained on integrating the core components of Eclipse Leda. |
| 229 | +> Additionally, the cloud connector was not configured or provisioned. |
0 commit comments