diff options
Diffstat (limited to 'agl-documentation/sdk-devkit')
51 files changed, 1902 insertions, 0 deletions
diff --git a/agl-documentation/sdk-devkit/book.json b/agl-documentation/sdk-devkit/book.json new file mode 100644 index 0000000..a27df96 --- /dev/null +++ b/agl-documentation/sdk-devkit/book.json @@ -0,0 +1,11 @@ +{ + "title": "AGL Development Kit", + "subtitle": "Developer Documentation", + "description": "Build from scratch an image and your first AGL application", + "keywords": "AGL, Development, SDK, Build, scratch, Porter, docker, container, application", + "author": "IoT.Bzh Team", + "website": "http://iot.bzh", + "published": "March 2017", + "version": "3.1", + "pdf_filename": "AGL-Development-Kit" +} diff --git a/agl-documentation/sdk-devkit/docs/0-Doc-Revisions.md b/agl-documentation/sdk-devkit/docs/0-Doc-Revisions.md new file mode 100644 index 0000000..ab5867b --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/0-Doc-Revisions.md @@ -0,0 +1,12 @@ +Document revisions +================== + +| Date | Version | Designation | Author | +|-------------|---------|--------------------------------------|-------------------------| +| 11 Feb 2016 | 0.1 | Initial release | S. Desneux [ Iot.bzh ] <br> Y. Gicquel [ Iot.bzh ] | +| 18 Feb 2016 | 0.2 | Fixes, multi-platform (Windows, Mac) | M.Bachmann [ Iot.bzh] | +| 29 Feb 2016 | 0.3 | Fixes for multi-platform | M.Bachmann [ Iot.bzh] | +| 29 Feb 2016 | 1.0 | Final Review | S. Desneux [ IoT.bzh ] | +| 29 Mar 2016 | 1.1 | Public version without proprietary drivers | S. Desneux [ IoT.bzh ] <br> Y. Gicquel [ Iot.bzh ] | +| 15 Jul 2016 | 2.0 | Update for AGL 2.0, SDK generation <br> & installation added | S. Desneux [ IoT.bzh] <br> M.Bachmann [IoT.bzh] | +| 20 Mar 2017 | 3.1 | Convert doc sources to markdown <br> Align on AGL Chinook | S. Douheret [ IoT.bzh ] <br> S.Desneux [ IoT.bzh ] | diff --git a/agl-documentation/sdk-devkit/docs/README.md b/agl-documentation/sdk-devkit/docs/README.md new file mode 100644 index 0000000..e1bb79c --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/README.md @@ -0,0 +1,24 @@ +# Introduction + +AGL Development Kit allows developers and integrators to rebuild complete bootable images +from source code, as well as developing new applications for AGL. + +It leverages Docker capabilities to propose a unified environment suitable for most development tasks: + +* compatible with AGL 3.x (based on Yocto/Poky 2.x) +* support all AGL boards inc. reference boards (Renesas, Intel) +* low-level development of drivers +* system services development and integration +* applications development (build, deploy, debug) using AGL SDK and AGL Application Framework + +| *Meta* | *Data* | +| -- | -- | +| **Title** | {{ config.title }} | +| **Author** | {{ config.author }} | +| **Description** | {{ config.description }} | +| **Keywords** | {{ config.keywords }} | +| **Language** | English | +| **Published** | Published {{ config.published }} as an electronic book | +| **Updated** | {{ gitbook.time }} | +| **Collection** | Open-source | +| **Website** | [{{ config.website }}]({{ config.website }}) | diff --git a/agl-documentation/sdk-devkit/docs/SUMMARY.md b/agl-documentation/sdk-devkit/docs/SUMMARY.md new file mode 100644 index 0000000..110d4c9 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/SUMMARY.md @@ -0,0 +1,18 @@ +# Summary + +* [Document revisions](0-Doc-Revisions.md) + +* [Part 1 - Build AGL image from scratch](part-1/1_0_Abstract.md) + * [Deploy an image using containers](part-1/1_1-Deploy_image.md) + * [Setting up your operating system](part-1/1_2-Setting-up-your_os.md) + * [Install AGL Yocto image for Porter board using Docker container](part-1/1_3-Install-agl-for-porter.md) + * [Inside the container](part-1/1_4-Inside-the-container.md) + * [Build an image for Porter board](part-1/1_5-Build-image-Porter.md) + * [Porter image deployment on target](part-1/1_6-Porter-image-deployment.md) + * [AGL SDK compilation and installation](part-1/1_7-SDK-compilation-installation.md) + +* [Part 2 - Build your 1st application](part-2/2_0_Abstract.md) + * [Initializing SDK environment and templates](part-2/2_1-Init-sdk-env.md) + * [Trying out the template](part-2/2_2-Trying-out-template.md) + * [Developing smoothly with the container](part-2/2_3-Dev-with-container.md) + * [Creating your own hybrid application](part-2/2_4-Use-app-templates.md) diff --git a/agl-documentation/sdk-devkit/docs/part-1/1_0_Abstract.md b/agl-documentation/sdk-devkit/docs/part-1/1_0_Abstract.md new file mode 100644 index 0000000..46bf74e --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/1_0_Abstract.md @@ -0,0 +1,27 @@ +# Part 1 - Build AGL image from scratch + +## Abstract + +The AGL DevKit allows developers to rebuild a complete bootable image +and its associated SDK from source code.\ +It uses Yocto/Poky version 2.x with latest version of Renesas BSP and + enables low-level development of drivers and system services. + +The AGL DevKit contains: + +- This guide, which describes how to create a Docker container able to + build AGL images and associated SDKs.\ + The container is also suitable to build AGL Applications + independently of Yocto/Bitbake. +- Applications templates and demos available on Github, to start + developing various types of applications independently of Yocto: + - services + - native applications + - HTML5 applications + - ... +- A documentation guide "**AGL Devkit - Build your 1st AGL + Application**" which explains how to use the AGL SDK to create applications + based on templates. + +*This document focuses on building from scratch an AGL image for Porter +board, within a Docker container, and then install the associated SDK.* diff --git a/agl-documentation/sdk-devkit/docs/part-1/1_1-Deploy_image.md b/agl-documentation/sdk-devkit/docs/part-1/1_1-Deploy_image.md new file mode 100644 index 0000000..52319b1 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/1_1-Deploy_image.md @@ -0,0 +1,47 @@ +# Deploy an image using containers + +## Motivation + +The Yocto build environment is subject to many variations depending on: + +- Yocto/Poky/OpenEmbedded versions and revisions +- Specific layers required for building either the BSP or the whole distribution +- Host distribution and version [1] +- User environment + +In particular, some recent Linux host distributions (Ubuntu 15.x, Debian +8.x, OpenSUSE 42.x, CentOS 7.x) do not officially support building with +Yocto 2.0. +Unfortunately, there's no easy solution to solve this kind of +problem: + +- we will still observe for quite a long time a significant gap + between the latest OS versions and a fully certified build environment. + +To circumvent those drawbacks and get more deterministic results amongst +the AGL community of developers and integrators, using virtualization is +a good workaround. +A Docker container is now available for AGL images: + +- it is faster, easier and less error-prone to use a prepared Docker + container because it provides all necessary components to build and + deploy an AGL image, including a validated base OS, independently of the + user's host OS. + +Moreover, light virtualization mechanisms used by Docker +do not add much overhead when building: + +- performances are nearly equal to native mode. + +[1] *The list of validated host distros is defined in the Poky distro, in +the file `meta-yocto/conf/distro/poky.conf` and also at [http://www.yoctoproject.org/docs/2.0/ref-manual/ref-manual.html#detailed-supported-distros](http://www.yoctoproject.org/docs/2.0/ref-manual/ref-manual.html#detailed-supported-distros)* + +## Prerequisites + +To run an AGL Docker image, the following prerequisites must be +fulfilled: + +- You must run a 64-bit operating system, with administrative rights, +- Docker engine v1.8 or greater must be installed, +- An internet connection must be available to download the Docker + image on your local host. diff --git a/agl-documentation/sdk-devkit/docs/part-1/1_2-Setting-up-your_os.md b/agl-documentation/sdk-devkit/docs/part-1/1_2-Setting-up-your_os.md new file mode 100644 index 0000000..2420c68 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/1_2-Setting-up-your_os.md @@ -0,0 +1,217 @@ +# Setting up your operating system + +In this section, we describe the Docker installation procedure depending +on your host system. We will be focusing on the most popular systems; +for a full list of supported operating systems, please refer to Docker +online documentation: [https://docs.docker.com/](https://docs.docker.com/) + +## Linux (Ubuntu / Debian) + +At the time of writing, Docker project supports these Ubuntu/Debian +releases: + +- Ubuntu Yakkety 16.10 +- Ubuntu Xenial 16.04 LTS +- Ubuntu Trusty 14.04 LTS +- Debian 8.0 (64-bit) +- Debian 7.7 (64-bit) + +For an updated list of supported distributions, you can refer to the +Docker project website, at these locations: + +- [https://docs.docker.com/engine/installation/linux/debian/](https://docs.docker.com/engine/installation/linux/debian/) +- [https://docs.docker.com/engine/installation/linux/ubuntu/](https://docs.docker.com/engine/installation/linux/ubuntu/) + +Here are the commands needed to install the Docker engine on your local +host: + +```bash +sudo apt-get update +sudo apt-get install wget curl +wget -qO- https://get.docker.com/ | sh +``` + +This will register a new location in your "sources.list" file and +install the "docker.io" package and its dependencies: + +```bash +$ cat /etc/apt/sources.list.d/docker.list +$ deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main +$ docker --version +Docker version 17.03.0-ce, build 60ccb22 +``` + +It is then recommended to add your user to the new "docker" system +group: + +```bash +sudo usermod -aG docker *<your-login>* +``` + +... and after that, to log out and log in again to have these credentials +applied. + +You can reboot your system or start the Docker daemon using: + +```bash +sudo service docker start +``` + +If everything went right, you should be able to list all locally +available images using: + +```bash +$ docker images +REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE +``` + +In our case, no image is available yet, but the environment is ready to +go on. + +A SSH client must also be installed: + +```bash +sudo apt-get install openssh-client +``` + +## Windows © (7, 8, 8.1, 10) + +**WARNING: although Windows© can work for this purpose, not only are lots +of additional steps needed, but the build process performance itself is +suboptimal. Please consider moving to Linux for a better experience.** + +We will be downloading the latest Docker Toolbox at the following +location: + +[*https://www.docker.com/docker-toolbox*](https://www.docker.com/docker-toolbox) + +and by clicking on the "*Download (Windows)*" button: + +![window install windows 1](pictures/docker_install_windows_1.png)\ +We will answer "Yes", "Next" and "Install" in the next dialog boxes. + +![window install windows 2](pictures/docker_install_windows_2.png){style width:60%;} + +![window install windows 3](pictures/docker_install_windows_3.png){style width:48%; float:left; margin-right:0.3em} +![window install windows 4](pictures/docker_install_windows_4.png){style width:48%; float:right} + +![window install windows 5](pictures/docker_install_windows_5.png) + +We can then start it by double-clicking on the "Docker Quickstart +Terminal" icon: + +![window install windows 6](pictures/docker_install_windows_6.png) + +It will take a certain amount time to setup everything, until this +banner appears: + +![window install windows 7](pictures/docker_install_windows_7.png) + +Docker Toolbox provides a 1 Gb RAM/20 Go HDD virtual machine; this is +clearly insufficient for our needs. Let us expand it to 4 Gb RAM/50 +HDD (*these are minimal values; feel free to increase them if your computer +has more physical memory and/or free space*) : + +```bash +export VBOXPATH=/c/Program\ Files/Oracle/VirtualBox/ +export PATH="$PATH:$VBOXPATH" + +docker-machine stop default + +VBoxManage.exe modifyvm default --memory 4096 +VBoxManage.exe createhd --filename build.vmdk --size 51200 --format VMDK +VBoxManage.exe storageattach default --storagectl SATA --port 2 --medium build.vmdk --type hdd + +docker-machine start default + +docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mklabel msdos" +docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mkpart primary ext4 1% 99%" +docker-machine ssh default "sudo mkfs.ext4 /dev/sdb1" +docker-machine ssh default "sudo mkdir /tmp/sdb1" +docker-machine ssh default "sudo mount /dev/sdb1 /tmp/sdb1" +docker-machine ssh default "sudo cp -ra /mnt/sda1/* /tmp/sdb1" + +docker-machine stop default + +VboxManage.exe storageattach default --storagectl SATA --port 2 --medium none +VboxManage.exe storageattach default --storagectl SATA --port 1 --medium build.vmdk --type hdd + +docker-machine start default +``` + +We will then finalize the setup: + +```bash +VboxManage.exe modifyvm default --natpf1 sshredir,tcp,127.0.0.1,2222,,2222 +docker-machine start default +docker-machine ssh default "echo mkdir /sys/fs/cgroup/systemd | sudo tee /var/lib/boot2docker/bootlocal.sh" +docker-machine restart default +``` + +A SSH client must also be installed. We will grab *PuTTY* at the +following URL: +[*http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe*](http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe) + +## Mac OS X © + +We will be downloading the latest Docker Toolbox at the following +location: +[https://www.docker.com/docker-toolbox](https://www.docker.com/docker-toolbox) + +and by clicking on the "*Download (Mac)*" button: + +![window install macro 1](pictures/docker_install_macos_1.png) + +We will answer "Continue" and "Install" in the next dialog boxes: + +![window install macro 2](pictures/docker_install_macos_2.png) + +![window install macro 3](pictures/docker_install_macos_3.png){style width:80%;} +![window install macro 4](pictures/docker_install_macos_4.png){style width:80%;} + +Then, when we go to our "Applications" folder, we now have a "Docker" +subfolder where we can start "Docker Quickstart Terminal": + +![window install macro 5](pictures/docker_install_macos_5.png) + +It will take a certain amount of time to setup everything, until this +banner appears: + +![window install macro 6](pictures/docker_install_macos_6.png) + +Docker Toolbox provides a 1 Gb RAM/20 Go HDD virtual machine; this is +clearly insufficient for our needs. Let us expand it to 4 Gb RAM/50 +HDD (*these are minimal values; feel free to increase them if your computer +has more physical memory and/or free space*) : + +```bash +docker-machine stop default + +VboxManage modifyvm default --memory 4096 +VboxManage createhd --filename build.vmdk --size 51200 --format VMDK +VboxManage storageattach default --storagectl SATA --port 2 --medium build.vmdk --type hdd + +docker-machine start default + +docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mklabel msdos" +docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mkpart primary ext4 1% 99%" +docker-machine ssh default "sudo mkfs.ext4 /dev/sdb1" +docker-machine ssh default "sudo mkdir /tmp/sdb1" +docker-machine ssh default "sudo mount /dev/sdb1 /tmp/sdb1" +docker-machine ssh default "sudo cp -ra /mnt/sda1/* /tmp/sdb1" + +docker-machine stop default + +VboxManage storageattach default --storagectl SATA --port 2 --medium none +VboxManage storageattach default --storagectl SATA --port 1 --medium build.vmdk --type hdd + +docker-machine start default +``` + +We will then finalize the setup: + +```bash +VboxManage modifyvm default --natpf1 sshredir,tcp,127.0.0.1,2222,,2222 +docker-machine ssh default "echo mkdir /sys/fs/cgroup/systemd | sudo tee /var/lib/boot2docker/bootlocal.sh" +docker-machine restart default +``` diff --git a/agl-documentation/sdk-devkit/docs/part-1/1_3-Install-agl-for-porter.md b/agl-documentation/sdk-devkit/docs/part-1/1_3-Install-agl-for-porter.md new file mode 100644 index 0000000..905eb2a --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/1_3-Install-agl-for-porter.md @@ -0,0 +1,276 @@ +# Install AGL Yocto image for Porter board using Docker container + +## Overview + +This section gives details on a procedure which allows system developers +and integrators to set up a the build environment image on their local +host. + +The prepared environment is deployed and available thanks to lightweight +virtualization containers using Docker technology +(See [https://www.docker.com/](https://www.docker.com/)). +The pre-built image for AGL development activities is currently designed to be +accessed using SSH Protocol. + +## Download the docker image + +At the time of writing, we distribute the image as a compressed archive +which can be downloaded faster as its footprint is around 226 MB. You +can then import it into Docker with the following command: + +```bash +curl https://download.automotivelinux.org/AGL/snapshots/sdk/docker/docker_agl_worker-3.0.tar.xz | docker load +``` + +You can check that the new Docker image is available by running the +`docker images` command : + +```bash +$ docker images +REPOSITORY TAG IMAGE ID CREATED SIZE +docker.automotivelinux.org/agl/worker 3.0 18a6db4db383 2 months ago 925 MB +``` + +*Note*: if you want to rebuild from scratch this docker image, you should +use scripts located into `docker-worker-generator` repository. + +```bash +git clone https://gerrit.automotivelinux.org/gerrit/AGL/docker-worker-generator +``` + +Then, please refer to `README.md` file for more details. + +## Start the container + +<a id="anchor-start-container"></a> + +Once the image is available on your local host, you can start the +container and the SSH service. We'll also need a local directory on the +host to store bitbake mirrors (download cache and sstate cache): this +mirror helps to speed up builds. + +First, create a local directory and make it available to everyone: + +```bash +MIRRORDIR=<your path here, ~/mirror for example>; +mkdir -p $MIRRORDIR +chmod 777 $MIRRORDIR +``` + +Then we can start the docker image using the following command: + +```bash +docker run \ + --publish=2222:22 \ + --publish=8000:8000 \ + --publish=69:69/udp --publish=10809:10809 \ + --detach=true --privileged \ + --hostname=bsp-devkit --name=bsp-devkit \ + -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ + -v $MIRRORDIR:/home/devel/mirror \ + docker.automotivelinux.org/agl/worker:3.0 +``` + +Then, you can check that the image is running with the following +command: + +```bash +$ docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +3126423788bd docker.automotivelinux.org/agl/worker:3.0 "/usr/bin/wait_for..." 2 seconds ago Up 2 seconds 0.0.0.0:2222->22/tcp, 0.0.0.0:69->69/udp, 0.0.0.0:8000->8000/tcp, 0.0.0.0:10809->10809/tcp bsp-devkit +``` + +The container is now ready to be used. A dedicated user has been +declared: + +- login: **devel** +- password: **devel** + +The following port redirections allow access to some services in the +container: + +- port 2222: SSH access using `ssh -p 2222 devel@localhost` +- port 8000: access to Toaster WebUI through [http://localhost:8000/](http://localhost:8000/) + when started (see Yocto documentation) +- ports 69 (TFTP) and 10809 (NBD): used for network boot (future enhancement) + +For easier operations, you can copy your ssh identity inside the +container: + +```bash +ssh-copy-id -p 2222 <devel@localhost> # password is 'devel' +``` + +## Connect to Yocto container through SSH + +The DevKit container provides a pre-built set of tools which can be +accessed through a terminal by using Secure Shell protocol (SSH). + +### Linux, Mac OS X © + +On Linux-based systems, you may need to install an SSH client. + +To launch the session, you can enter the following under Linux or Mac OS X: + +```bash +ssh -p 2222 devel@localhost +``` + +The password is "**devel**". You should obtain the following prompt +after success: + +```bash +devel@localhost's password: **devel** + +The programs included with the Debian GNU/Linux system are free +software; the exact distribution terms for each program are described in the +individual files in /usr/share/doc/*/copyright. + +Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent +permitted by applicable law. +[11:28:27] devel@bsp-devkit:~$ +``` + +### Windows © + +You will need *PuTTY*, downloaded during the setup +section. Run it using its icon: + +![windows putty 1](pictures/windows_putty_1.png){style width:60px;} + +We can then connect to "**localhost**" on port +"**2222**". + +![windows putty 2](pictures/windows_putty_2.png){style width:60%;} + +Credentials are the same as for Linux: user is "**devel**" with password +"**devel**". + +## Set up a persistent workspace + +<a id="anchor-setup-persist-wks"></a> + +AGL Docker image brings a set of tools and here we describe a way to +prepare a "shared directory" on your local host accessible from the +container. The aim of this shared directory is to allow your ongoing +developments to stay independent from the container upgrades. + +Please note this whole procedure is not mandatory, but highly +recommended as it will save disk space later when you will deploy the SD +card image on your target. + +### From Linux host using a shared directory + +Current docker implementation has a limitation about UID:GID mapping +between hosts and containers. In the long run, the planned mechanism is +to use the "user namespace" feature. But for now, we propose another +approach unfortunately less flexible. + +We can use a directory on the local host with a dedicated Unix group +using a common GID between the host and the container. This GID has been +fixed to "1664" ([see](https://en.wikipedia.org/wiki/Beer_in_France)) +and can be created on your linux host using the following commands: + +```bash +sudo groupadd --gid 1664 agl-sdk +sudo usermod -aG agl-sdk *<your-login>* +``` + +If this GID is already used on your local host, you will have to use it +for this sharing purpose as well. In case this is not possible, another +option to exchange workspace data can be the use of a network service +(like SSH, FTP) of the container and from your local host. + +Once the GID is ready to use, we can create a shared directory (not as +'root', but as your normal user): + +```bash +cd +mkdir $HOME/agl-workspace +sudo chgrp agl-sdk $HOME/agl-workspace +chmod ug+w $HOME/agl-workspace +``` + +And run the Docker image with the shared directory (new volume): + +```bash +$ docker run \ + --publish=2222:22 \ + --publish=8000:8000 \ + --publish=69:69/udp --publish=10809:10809 \ + --detach=true --privileged \ + --hostname=bsp-devkit --name=bsp-devkit \ + -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ + -v $MIRRORDIR:/home/devel/mirror \ + -v $HOME/agl-workspace:/xdt/workspace \ <--- shared directory + docker.automotivelinux.org/agl/worker:3.0 +``` + +### From Windows © host using a shared directory + +We will create a shared directory for our user: + +```bash +mkdir /c/Users/$USERNAME/agl-workspace +``` + +And run the Docker image with the shared directory (new volume): + +```bash +$ docker run \ + --publish=2222:22 --publish=8000:8000 \ + --publish=69:69/udp --publish=10809:10809 \ + --detach=true --privileged --hostname=bsp-devkit \ + --name=bsp-devkit \ + -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ + -v $MIRRORDIR:/home/devel/mirror \ + -v /c/Users/$USERNAME/agl-workspace:/xdt/workspace \ <--- shared directory + docker.automotivelinux.org/agl/worker:3.0 +``` + +### From the container using a remote directory (SSHFS) + +It's also possible to mount a remote directory inside the container if +the source host is running a ssh server. In that case, we will use a SSH +connection from the host to the container as a control link, and another +SSH connection from the container to the host as a data link. + +To do so, you can start the container normally as described in +[Start container chapter](#anchor-start-container), start an SSH session and +run the following commands to install the package "sshfs" inside the container: + +```bash +sudo apt-get update +sudo apt-get install -y sshfs +``` + +NB: sudo will ask for the password of the user "**devel**", which is +"**devel**". + +Now, if we want to mount the remote dir '/data/workspace' with user +'alice' on host 'computer42', then we would run: + +```bash +$ sshfs alice@computer42:/data/workspace -o nonempty $XDT_WORKSPACE +... +Password: <enter alice password on computer42> +``` + +NB: the directory on the remote machine must be owned by the remote user + +Verify that the mount is effective: + +```bash +$ df /xdt/workspace +Filesystem 1K-blocks Used Available Use% Mounted on +alice@computer42:/data/workspace 103081248 7138276 95612016 7% /xdt/workspace +``` + +From now, the files created inside the container in /xdt/workspace are +stored 'outside', in the shared directory with proper uid/gid. + +To unmount the shared directory, you can run: + +```bash +$sudo umount $XDT_WORKSPACE +``` diff --git a/agl-documentation/sdk-devkit/docs/part-1/1_4-Inside-the-container.md b/agl-documentation/sdk-devkit/docs/part-1/1_4-Inside-the-container.md new file mode 100644 index 0000000..3380b22 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/1_4-Inside-the-container.md @@ -0,0 +1,76 @@ +# Inside the container + +## Features + +Container features: + +- a Debian 8.5 based system with an SSH server listening on tcp/22, +- a dedicated user is defined to run the SSH session: **devel** + (password: **devel**) +- a script named "prepare_meta" for preparing the build environment + +## File system organization and shared volume + +The image has been designed with a dedicated file-system hierarchy. Here it is: + +```bash +devel@bsp-devkit:/$ **tree -L 2 /xdt** +/xdt +|-- build +| `-- conf +| |-- bblayers.conf +| |-- local.conf +| [snip] +|-- ccache +|-- downloads +|-- meta +| |-- agl-manifest +| |-- meta-agl +| |-- meta-agl-demo +| |-- meta-agl-extra +| |-- meta-amb +| |-- meta-intel +| |-- meta-intel-iot-security +| |-- meta-iot-agl +| |-- meta-oic +| |-- meta-openembedded +| |-- meta-qt5 +| |-- meta-renesas +| |-- meta-rust +| |-- meta-security-isafw +| `-- poky +|-- sdk +|-- sources +|-- sstate-cache +| |-- 00 +| |-- 01 +| |-- 02 +| |-- 03 +| |-- 04 +| |-- 05 +| |-- 06 +| |-- 07 + [snip] +`-- workspace +``` + +Noticeably, the BSP related features are located in the dedicated "/xdt" +directory. + +This directory contains sub-directories, and in particular the +following: + +- **build**: will contain the result of the build process, including + an image for the Porter board. +- **downloads**: (optional) contain the Yocto download cache, a + feature which will locally store the upstream projects sources codes + and which is fulfilled when an image is built for the first time. + When populated, this cache allow the user to built without any + connection to Internet. +- **meta**: contains the pre-selected Yocto layers required to built + the relevant AGL image for the Porter board. +- **sstate-cache**: (optional) contain the Yocto shared state + directory cache, a feature which store the intermediate output of + each task for each recipe of an image. This cache enhance the image + creation speed time by avoiding Yocto task to be run when they are + identical to a previous image creation. diff --git a/agl-documentation/sdk-devkit/docs/part-1/1_5-Build-image-Porter.md b/agl-documentation/sdk-devkit/docs/part-1/1_5-Build-image-Porter.md new file mode 100644 index 0000000..a13e9d3 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/1_5-Build-image-Porter.md @@ -0,0 +1,175 @@ +# Build an image for Porter board + +In this section, we will go on the image compilation for the Porter +board within the Docker container. + +## Download Renesas proprietary drivers + +For the Porter board, we first need to download the proprietary drivers +from Renesas web site. The evaluation version of these drivers can be +found here: + +[http://www.renesas.com/secret/r_car_download/rcar_demoboard.jsp](http://www.renesas.com/secret/r_car_download/rcar_demoboard.jsp) + +under the **Target hardware: R-Car H2, M2 and E2** section: + +![renesas download](pictures/renesas_download.jpg) + +Note that you have to register with a free account on MyRenesas and +accept the license conditions before downloading them. The operation is +fast and simple but nevertheless mandatory to access evaluation of non +open-source drivers for free. + +Once you register, you can download two zip files: store them in a +directory visible from the container, for example in the directory +`$MIRRORDIR/proprietary-renesas-r-car` (`$MIRRORDIR` was created +previously in section [Start the container](#anchor-start-container) and adjust +the permissions. The zip files should then be visible from the inside of the +container in `/home/devel/mirror`: + +```bash +$ chmod +r /home/devel/mirror/proprietary-renesas-r-car/*.zip +$ ls -l /home/devel/mirror/proprietary-renesas-r-car/ +total 8220 +-rw-r--r-- 1 1000 1000 6047383 Jul 11 11:03 R-Car_Series_Evaluation_Software_Package_for_Linux-20151228.zip +-rw-r--r-- 1 1000 1000 2394750 Jul 11 11:03 R-Car_Series_Evaluation_Software_Package_of_Linux_Drivers-20151228.zip +``` + +## Setup the build environment + +We should first prepare the environment to build images. + +This can be easily done thanks to a helper script named `prepare_meta`. +This script does the following: + +- check for an updated version at + [https://github.com/iotbzh/agl-manifest](https://github.com/iotbzh/agl-manifest) +- pull Yocto layers from git repositories, following a snapshot manifest +- setup build configuration (build/conf files) + +The following options are available: + +```bash +devel@bsp-devkit:~$ prepare_meta -h +prepare_meta [options] + +Options: + -f|--flavour <flavour[/tag_or_revision]> + what flavour to us + default: 'iotbzh' + possible values: 'stable','unstable','testing', 'iotbzh' ... see agl-manifest git repository + -o|--outputdir <destination_dir> + output directory where subdirectories will be created: meta, build, ... + default: current directory (.) + -l|--localmirror <directory> + specifies a local mirror directory to initialize meta, download_dir or sstate-cache + default: none + -r|--remotemirror <url> + specifies a remote mirror directory to be used at build time for download_dir or sstate-cache + default: none + -p|--proprietary <directory> + Directory containing Renesas proprietary drivers for RCar platform (2 zip files) + default: none + -e|--enable <option> + enable a specific option + available options: ccache, upgrade + -d|--disable <option> + disable a specific option + available options: ccache, upgrade + -t|--target <name> + target platform + default: porter + valid options: intel-corei7-64, qemux86, qemux86-64, wandboard + -h|--help + get this help + +Example: + prepare_meta -f iotbzh/master -o /tmp/xdt -l /ssd/mirror -p /vol/xdt/proprietary-renesas-rcar/ -t porter +``` + +In our case, we can start it with the following arguments: + +- build in `/xdt` (-o /xdt) +- build for porter board (`-t porter`) +- build the 'iotbzh' flavour (`-f iotbzh`), which contains the standard + AGL layers + security and app framework. Flavours are stored in the + agl-manifest repository. +- Use a local mirror (`-l <mirror path>`). This directory may + contain some directories generated in a previous build: `downloads`, + `sstate-cache`, `ccache`, `meta`. If found, the mirror directories + will be specified in configuration files. +- specify proprietary drivers location (`-p <drivers path>`) + +So we can run the helper script: + +```bash +devel@bsp-devkit:~$ prepare_meta -o /xdt -t porter -f rel2.0 -l /home/devel/mirror/ -p /home/devel/mirror/proprietary-renesas-r-car/ -e wipeconfig +[...] +=== setup build for porter +Using proprietary Renesas drivers for target porter +=== conf: build.conf +=== conf: download caches +=== conf: sstate caches +=== conf: local.conf +=== conf: bblayers.conf.inc -> bblayers.conf +=== conf: porter_bblayers.conf.inc -> bblayers.conf +=== conf: bblayers_proprietary.conf.inc is empty +=== conf: porter_bblayers_proprietary.conf.inc is empty +=== conf: local.conf.inc is empty +=== conf: porter_local.conf.inc is empty +=== conf: local_proprietary.conf.inc is empty +=== conf: porter_local_proprietary.conf.inc is empty +===================================================================== + +Build environment is ready. To use it, run: + +# source /xdt/meta/poky/oe-init-build-env /xdt/build + +then + +# bitbake agl-demo-platform +``` + +Now, the container shell is ready to build an image for Porter. + +## Launch the build + +To start the build, we can simply enter the indicated commands: + +```bash +devel@bsp-devkit:~$ . /xdt/build/agl-init-build-env +### Shell environment set up for builds. ### + +You can now run 'bitbake <target>' + +Common target are: + + agl-demo-platform + +devel@bsp-devkit:/xdt/build$ bitbake agl-demo-platform +[snip] +NOTE: Tasks Summary: Attempted 5108 tasks of which 4656 didn't need to +be rerun and all succeeded. + +Summary: There were 19 WARNING messages shown. +``` + +Without mirror, it will take a few hours to build all the required +component of the AGL distribution, depending on: your host machine CPU, +disk drives types and internet connection. + +## Updating the local mirror + +Optionally, at the end of the build, some directories may be synced to +the mirror dir, for future usage: + +- `/xdt/meta`: contains all layers used to build AGL +- `/xdt/downloads`: download cache (avoid fetching source from remote sites) +- `/xdt/sstate-cache`: binary build results (avoid recompiling sources) + +This can be done with the following command: + +```bash +$ for x in meta downloads sstate-cache; do rsync -Pav \ + --delete /xdt/$x /home/devel/mirror/$x; done +``` diff --git a/agl-documentation/sdk-devkit/docs/part-1/1_6-Porter-image-deployment.md b/agl-documentation/sdk-devkit/docs/part-1/1_6-Porter-image-deployment.md new file mode 100644 index 0000000..2c2bc2f --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/1_6-Porter-image-deployment.md @@ -0,0 +1,257 @@ +# Porter image deployment on target + +Once the Porter image has been built with Yocto, we can deploy it on an +empty SD card to prepare its use on the target. + +## SD card image creation + +First, we need to generate an SD card disk image file. For this purpose, +a helper script is provided within the container. Here below is the way +to use it. + +### Linux, Mac OS X © + +```bash +cd /xdt/build +mksdcard /xdt/build/tmp/deploy/images/porter/agl-demo-platform-porter-20XXYYZZxxyyzz.rootfs.tar.bz2 /home/devel/mirror +``` + +### Windows © + +```bash +cd /xdt/build +sudo dd if=/dev/zero of=/sprs.img bs=1 count=1 seek=4G +sudo mkfs.ext4 /sprs.img +sudo mkdir /tmp/sprs +sudo mount /sprs.img /tmp/sprs +sudo mksdcard /xdt/build/tmp/deploy/images/porter/agl-demo-platform-porter-20XXYYZZxxyyzz.rootfs.tar.bz2 +/tmp/sprs/sdcard.img +xz -dc /tmp/sprs/sdcard.img.xz > $XDT_WORKSPACE/agl-demo-platform-porter-sdcard.img +``` + +You should get the following prompt during the `mksdcard` step: + +```bash +Creating the image agl-demo-platform-porter-sdcard.img ... +0+0 records in +0+0 records out +0 bytes (0 B) copied, 6.9187e-05 s, 0.0 kB/s +mke2fs 1.42.12 (29-Aug-2014) +Discarding device blocks: done +Creating filesystem with 524287 4k blocks and 131072 inodes +Filesystem UUID: 5307e815-9acd-480b-90fb-b246dcfb28d8 +Superblock backups stored on blocks: + 32768, 98304, 163840, 229376, 294912 + +Allocating group tables: done +Writing inode tables: done +Creating journal (8192 blocks): done +Writing superblocks and filesystem accounting information: done + +Extracting image tarball... +done + +Image agl-demo-platform-porter-sdcard.img created! + +Set the following uboot environment +setenv bootargs_console 'console=ttySC6,38400 ignore_loglevel' +setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60' +setenv bootargs_root 'root=/dev/mmcblk0p1 rootdelay=3 rw rootfstype=ext3 rootwait' +setenv bootmmc '1:1' +setenv bootcmd_sd 'ext4load mmc ${bootmmc} 0x40007fc0 boot/uImage+dtb' +setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root}; run bootcmd_sd; bootm 0x40007fc0' +saveenv + +NB: replace bootmmc value '1:1' with '0:1' or '2:1' to access the good slot + use 'ext4ls mmc XXX:1' to test access + +$ ls -lh $XDT_WORKSPACE +-rw-r--r-- 1 devel devel 2.0G Feb 15 14:13 agl-demo-platform-porter-sdcard.img + +``` + +After the disk image is created, we can copy it on the SD card itself +using an SD card adapter. To do so, we need to gain access to the SD +card image file from our host machine. + +If you already share a directory between your host machine and the +container (as described in section [Set up a persistent workspace](#anchor-setup-persist-wks)), +this state is already reached and you go directly on sections relating the SD +card image installation. + +Otherwise, you need to copy the SD card image file out of the container +and into your host machine using SSH protocol: + +- On Linux and Mac OS X hosts, you can use the `scp` command, which is part of + the OpenSSH project, +- On Windows hosts, you can use the + [`pscp.exe`](http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe) + binary, which is part of the [PuTTY project](http://www.putty.org/). + +## Deployment from a Linux or Mac OS X host + +Now that the SD card image is ready, the last step required is to +"flash" it onto the SD card itself. + +First, you need an SD card adapter connected to your host machine. +Depending on your adapter type and OS, the relevant block device can +change. Mostly, you can expect: + +- `/dev/sdX` block device; usually for external USB adapters on + Linux hosts. +- `/dev/mmcblkN`: when using a laptop internal adapter on Linux + hosts. +- `/dev/diskN`: on Mac OS X hosts. + +### Linux + +If you do not know which block device you should use, you can check the +kernel logs using the following command to figure out what is the +associated block devices: + +```bash +$ dmesg | grep mmcblk +$ dmesg | grep sd +[...snip...] +[1131831.853434] sd 6:0:0:0: [sdb] 31268864 512-byte logical blocks: (16.0 GB/14.9 GiB) +[1131831.853758] sd 6:0:0:0: [sdb] Write Protect is on +[1131831.853763] sd 6:0:0:0: [sdb] Mode Sense: 4b 00 80 08 +[1131831.854152] sd 6:0:0:0: [sdb] No Caching mode page found +[1131831.854157] sd 6:0:0:0: [sdb] Assuming drive cache: write through +[1131831.855174] sd 6:0:0:0: [sdb] No Caching mode page found +[1131831.855179] sd 6:0:0:0: [sdb] Assuming drive cache: write through +[...snip...] +$ +``` + +In this example, no `mmcblk` device where found, but a 16.0GB disk was +listed and can be accessed on **`/dev/sdb`** which in our case is the +physical SD card capacity. + +The command `lsblk` is also a good solution to explore block devices: + +```bash +$ lsblk +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT +sda 8:0 0 931.5G 0 disk +|--sda1 8:1 0 8G 0 part / +|--sda2 8:2 0 16G 0 part [SWAP] +|--sda3 8:3 0 907.5G 0 part + |--vg0-usr 254:0 0 32G 0 lvm /usr + |--vg0-data 254:1 0 200G 0 lvm /data + |--vg0-home 254:2 0 100G 0 lvm /home + |--vg0-var 254:3 0 8G 0 lvm /var + |--vg0-docker 254:4 0 100G 0 lvm /docker +sdb 8:16 0 223.6G 0 disk +|--sdb1 8:17 0 223.6G 0 part /ssd +sdc 8:32 1 3.7G 0 disk <-- SD card plugged into USB card reader +|--sdc1 8:33 1 2G 0 part <-- +sr0 11:0 1 1024M 0 rom +``` + +In this example, the 4GB device `/dev/sdc` is listed as removable +(column RM) and corresponds to a SD Card plugged into an USB card +reader. + +Finally, as we know the block device which corresponds to our SD card, +we can raw-copy the image on it using the following command __**from your +host terminal**__ : (replace `/dev/sdZ` by the appropriate device) + +```bash +$ xzcat ~/mirror/agl-demo-platform-porter-20XXYYZZxxyyzz.raw.xz | sudo dd of=/dev/sdZ bs=1M +2048+0 records in +2048+0 records out +2147483648 bytes (2.0 GB) copied, 69 s, 39.2 MB/s +$ sync +``` + +This will take few minutes to copy and sync. You should not remove the +card from its slot until both commands succeed. + +Once it is finished, you can unplug the card and insert it in the +micro-SD card slot on the Porter board, and perform a power cycle to +start your new image on the target. + +__**NB:**__ The output format is also suitable to `bmaptool` utility (source +code available here: [https://github.com/01org/bmap-tools](https://github.com/01org/bmap-tools): +this significantly speeds up the copy as only relevant data are written on +the Sdcard (filesystem "holes" are not written). It's also supporting +direct access to URLs pointing to compressed images. + +### Mac OS X © + +If you do not know which block device you should use, you can use the +`diskutil` tool to list them: + +```bash +$ diskutil list +[...snip...] + +/dev/disk2 +#: TYPE NAME SIZE IDENTIFIER +0: Fdisk_partition_scheme 7.9 GB disk2 +1: Linux 7.9 GB disk2s1 +[...snip...] +$ +``` + +In this example, we have a 8.0GB disk which can be accessed on +**`/dev/disk2`** which in our case is the physical SD card capacity. + +Finally, as we know the block device which accesses our SD card, we can +raw-copy the image on it using the following command __from your host +terminal__: + +```bash +$ xzcat ~/mirror/agl-demo-platform-porter-20XXYYZZxxyyzz.raw.xz | sudo dd of=/dev/disk2 bs=1M +2048+0 records in +2048+0 records out +2147483648 bytes (2.0 GB) copied, 69 s, 39.2 MB/s +$ sync +``` + +This will take few minutes to copy and sync. You should not remove the +card from its slot until both commands succeed. + +Once it is finished, you can unplug the card and insert it in the +micro-SD card slot on the Porter board, and perform a power cycle to +start your new image on the target. + +## Deployment from a Windows host + +Now that the SD card image is ready, the last step required is to "flash" it +onto the SD card itself. + +First, you need an SD card adapter connected to your host machine. + +We will then use the `Win32DiskImager` program which we will download at +this URL: + +[http://sourceforge.net/projects/win32diskimager/](http://sourceforge.net/projects/win32diskimager/) + +and by clicking on this button: +![windows win32diskimager 1](pictures/windows_win32diskimager_1.png) + +We will then install it: + +![windows win32diskimager 2](pictures/windows_win32diskimager_2.png){style width:48%; float:left; margin-right:0.3em} +![windows win32diskimager 3](pictures/windows_win32diskimager_3.png){style width:48%; float:right} + +And then start it with its icon: +![windows win32diskimager 4](pictures/windows_win32diskimager_4.png) + +We can then click on the "blue folder" button to select our .img file +(uncompress the XZ image first using utilities like 7zip for example). + +**After having verified that the drive letter on the +right matches our SD card reader**, we click on the "**Write**" button +to start the flashing process. + +![windows win32diskimager 5](pictures/windows_win32diskimager_5.png) + +This will take few minutes to copy and sync. You should not remove the +card from its slot until both commands succeed. + +Once it is finished, you can unplug the card and insert it in the +micro-SD card slot on the Porter board, and perform a power cycle to +start your new image on the target. diff --git a/agl-documentation/sdk-devkit/docs/part-1/1_7-SDK-compilation-installation.md b/agl-documentation/sdk-devkit/docs/part-1/1_7-SDK-compilation-installation.md new file mode 100644 index 0000000..6fe789b --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/1_7-SDK-compilation-installation.md @@ -0,0 +1,49 @@ +# AGL SDK compilation and installation + +Now that we have both a finalized development container and a deployed +Porter image, let us create and install the SDK (Software Development +Kit), so that we can develop new components for our image. + +Going back to the container, let's generate our SDK files: + +```bash +bitbake agl-demo-platform-crosssdk +``` + +This will take some time to complete. + +Alternatively, you can download a prebuilt SDK file suitable for AGL 2.0 +on automotivelinux website: + +```bash +mkdir -p /xdt/build/tmp/deploy/sdk +cd /xdt/build/tmp/deploy/sdk +wget https://download.automotivelinux.org/AGL/release/chinook/3.0.2/porter-nogfx/deploy/sdk/poky-agl-glibc-x86_64-core-image-minimal-cortexa15hf-neon-toolchain-3.0.0+snapshot.sh +``` + +Once you have the prompt again, let's install our SDK to its final +destination. For this, run the script `install_sdk` with the SDK +auto-installable archive as argument: + +```bash +install_sdk /xdt/build/tmp/deploy/sdk/poky-agl-glibc-x86_64-core-image-minimal-cortexa15hf-neon-toolchain-3.0.0+snapshot.sh +``` + +The SDK files should be now installed in `/xdt/sdk`: + +```bash +$ tree -L 2 /xdt/sdk +/xdt/sdk/ +|-- environment-setup-cortexa15hf-neon-agl-linux-gnueabi +|-- site-config-cortexa15hf-neon-agl-linux-gnueabi +|-- sysroots +| |-- cortexa15hf-neon-agl-linux-gnueabi +| |-- x86_64-aglsdk-linux +`-- version-cortexa15hf-neon-agl-linux-gnueabi +``` + +You can now use them to develop new services, and native/HTML +applications. + +Please refer to the document entitled "Build Your 1st AGL Application" +to learn how to do this. diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_1.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_1.png Binary files differnew file mode 100644 index 0000000..10036f1 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_1.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_2.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_2.png Binary files differnew file mode 100644 index 0000000..d720bb9 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_2.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_3.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_3.png Binary files differnew file mode 100644 index 0000000..5e9ec54 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_3.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_4.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_4.png Binary files differnew file mode 100644 index 0000000..3cf3e8e --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_4.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_5.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_5.png Binary files differnew file mode 100644 index 0000000..d1c5b0d --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_5.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_6.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_6.png Binary files differnew file mode 100644 index 0000000..80818e8 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_macos_6.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_1.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_1.png Binary files differnew file mode 100644 index 0000000..cc412d0 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_1.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_2.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_2.png Binary files differnew file mode 100644 index 0000000..18ecf1a --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_2.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_3.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_3.png Binary files differnew file mode 100644 index 0000000..29272b5 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_3.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_4.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_4.png Binary files differnew file mode 100644 index 0000000..1ff33e4 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_4.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_5.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_5.png Binary files differnew file mode 100644 index 0000000..a7f2c5b --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_5.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_6.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_6.png Binary files differnew file mode 100644 index 0000000..685ddb9 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_6.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_7.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_7.png Binary files differnew file mode 100644 index 0000000..900ef44 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/docker_install_windows_7.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/renesas_download.jpg b/agl-documentation/sdk-devkit/docs/part-1/pictures/renesas_download.jpg Binary files differnew file mode 100644 index 0000000..a4bdc29 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/renesas_download.jpg diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_putty_1.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_putty_1.png Binary files differnew file mode 100644 index 0000000..ecae750 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_putty_1.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_putty_2.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_putty_2.png Binary files differnew file mode 100644 index 0000000..09ecd52 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_putty_2.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_1.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_1.png Binary files differnew file mode 100644 index 0000000..2276c5b --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_1.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_2.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_2.png Binary files differnew file mode 100644 index 0000000..2485849 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_2.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_3.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_3.png Binary files differnew file mode 100644 index 0000000..38d94e3 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_3.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_4.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_4.png Binary files differnew file mode 100644 index 0000000..68a5fa6 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_4.png diff --git a/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_5.png b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_5.png Binary files differnew file mode 100644 index 0000000..e4aade2 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-1/pictures/windows_win32diskimager_5.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/2_0_Abstract.md b/agl-documentation/sdk-devkit/docs/part-2/2_0_Abstract.md new file mode 100644 index 0000000..e7eae95 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/2_0_Abstract.md @@ -0,0 +1,25 @@ +# Part 2 - Build your 1st application + +## Abstract + +In the first part of this document, entitled "** Build AGL image from scratch**", +we rebuilt a complete bootable AGL image from source code. We also generated +and installed related SDK files in our development container. +This document describes the next step: using the SDK to build applications and +deploy them on a target board running an AGL image. + +AGL DevKit as a whole contains: + +- "**AGL Devkit - Image and SDK for porter**" guide for preparing a + Docker container with AGL SDK, ready to build AGL applications +- Application templates and demos, allowing developers to start developing + various types of applications: + - Services + - Native applications + - HTML5 applications + - ... +- This guide, focused on how to use these applications templates + +*This document focuses on: initializing the SDK environment, building the +development templates, modifying them, and installing them on the +target.* diff --git a/agl-documentation/sdk-devkit/docs/part-2/2_1-Init-sdk-env.md b/agl-documentation/sdk-devkit/docs/part-2/2_1-Init-sdk-env.md new file mode 100644 index 0000000..c6cf67a --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/2_1-Init-sdk-env.md @@ -0,0 +1,79 @@ +# Initializing SDK environment and templates + +## Initializing the SDK environment + +*(This document assumes that you are logged inside the **bsp-devkit** Docker +container, used to produce Rcar Gen3 BSP image and AGL SDK in the +previous **"SDK quick setup"** document)* + +To be able to use the toolchain and utilities offered by AGL SDK, it is +necessary to source the proper setup script. This script is in the SDK +root folder and is named `/xdt/sdk/environment-setup-*` (full name +depends on the target machine) + +For Rcar Gen3 boards, we source the required SDK environment variables like +this: + +```bash +source /xdt/sdk/environment-setup-aarch64-agl-linux +``` + +To verify that it succeeded, we should obtain a non-empty result for +this command: + +```bash +echo $CONFIG_SITE | grep sdk /xdt/sdk/site-config-aarch64-agl-linux +``` + +## Application categories + +We provide multiple development templates for the AGL SDK: + +- Service + + A Service is a headless background process, allowing Bindings to expose + various APIs accessible through the transports handled by the application + framework, which are currently: + - [HTTP REST (HTTP GET, POST...)](https://en.wikipedia.org/wiki/Representational_state_transfer) + - [WebSocket](https://en.wikipedia.org/wiki/WebSocket) + - [D-Bus](https://www.freedesktop.org/wiki/Software/dbus/) + +- Native application + + A Native application is a compiled application, generally written in C/C++, + accessing one or more services, either by its own means or using a helper + library with HTTP REST/WebSocket capabilities. + + *(our template is written in C and uses the "libafbwsc" helper library + available in the app-framework-binder source tree on AGL Gerrit)* + +- HTML5 application + + An HTML5 application is a web application, generally written with a framework + (AngularJS, Zurb Foundation...), accessing services with its built-in HTTP + REST/WebSocket capabilities. + +- Legacy application + + A legacy application contains a native application not made for AGL + Application Framework but launched by it. For such application, only + security setup is made. + +## Getting helloworld templates + +Application Framework _helloworld_ example live in a dedicated Git +Repository, currently hosted on GitHub at the following address: + +[https://github.com/iotbzh/helloworld-service](https://github.com/iotbzh/helloworld-service) + +To get the templates in our development container, let us simply clone +the source repository: + +```bash +$ cd ~ +$ git clone --recursive https://github.com/iotbzh/helloworld-service +Cloning into 'helloworld-service'... +[...snip...] +Resolving deltas: 100% (125/125), done. +Checking connectivity... done. +``` diff --git a/agl-documentation/sdk-devkit/docs/part-2/2_2-Trying-out-template.md b/agl-documentation/sdk-devkit/docs/part-2/2_2-Trying-out-template.md new file mode 100644 index 0000000..e477755 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/2_2-Trying-out-template.md @@ -0,0 +1,134 @@ +# Trying out the templates + +In this section, we describe how to build the various templates, how to +package them and finally how to deploy and run them on the target board. + +Every template is stored in a single directory and is independent of the +rest of the tree: each template can be used as a foundation for a fresh +new application. + +For deployment, we assume that the target board is booted with an AGL +image and available on the network. Let us use the `BOARDIP` variable +for the board IP address (replace by appropriate address or hostname) +and test the SSH connection: + +```bash +$ export BOARDIP=1.2.3.4 +$ ssh root@$BOARDIP cat /etc/os-release +ID="poky-agl" +NAME="Automotive Grade Linux" +VERSION="1.0+snapshot-20160717 (master)" +VERSION_ID="1.0+snapshot-20160717" +PRETTY_NAME="Automotive Grade Linux 1.0+snapshot-20160717 (master)" +``` + +## Building + +All operations are executed inside the Docker "Devkit" container. For +convenience, a build script named `autobuild` can build template and +package at once. + +Compile the service: + +```bash +$ cd ~/helloworld-service/ +$ ./conf.d/autobuild/agl/autobuild package +-- The C compiler identification is GNU 6.3.1 +-- The CXX compiler identification is GNU 6.3.1 +[snip] +[100%] Generating helloworld-service.wgt +NOTICE: -- PACKING widget helloworld-service.wgt from directory /home/claneys/Workspace/Sources/IOTbzh/helloworld-service/build/package +++ Install widget file using in the target : afm-util install helloworld-service.wgt +``` + +This produced a `helloworld-service.wgt` package. Let us copy it to the +target: + +```bash +$ scp helloworld-service.wgt root@$BOARDIP:~/ +helloworld-service.wgt 100% 24KB 24.3KB/s 00:00 +``` + +## Installing on the target + +And then, in a separate window, log in to the target board: + +```bash +ssh root@$BOARDIP +``` + +and install our packages: + +```bash +$ afm-util install helloworld-service.wgt +{ "added": "helloworld-service@1.0" } +``` + +We can verify that they were correctly installed by listing all +available applications: + +```bash +$ afm-util list +[ { "description": "The name says it all!", "name": "helloworld-service", "shortname": "", "id": "helloworld-service@1.0", "version": "1.0", "author": "Stephane Desneux <sdx@iot.bzh>", "author-email": "", "width": "", "height": "" } ] +``` + +## Running the template + +Even if the template is mostly skeleton application, we can still +start them and see them in action. + +Once installed Application Framework created appropriate systemD unit file +to get able to manage the application. You can directly connect to the unix +socket to get connected to the application template, it will be launched +automatically if not already started. + +when systemD receives a connection to an existing socket that it handles, it +launch the associated application using its service unit. Service unit is +generated by wgtpkg-unit at installation, its content depends of the +`config.xml` configuration file located in its specific directory +(`/var/local/lib/afm/applications/<appname>/<version>/config.xml`). + +Generation is controlled by the global `/etc/afm/afm-unit.conf` config +file. + +This file defines how various applications types are handled by the +system and application framework. + +### Run and connect to the service + +Let us first run the Service: + +```bash +$ afm-util run helloworld-service@1.0 +1 +``` + +Then confirm it is running: + +```bash +$ afm-util ps +[ { "runid": 20091, "pids": [ 20091 ], "state": "running", "id": "helloworld-service@1.0" } ] +$ ps -ef | grep afb +ps -ef|grep afb +root 5764 3876 0 15:34 ? 00:00:00 /usr/bin/afb-daemon --rootdir=/var/local/lib/afm/applications/helloworld-service/1.0 --workdir=/home/root/app-data/helloworld-service --roothttp=htdocs --binding=/var/local/lib/afm/applications/helloworld-service/1.0/lib/afb-helloworld.so --ws-server=sd:helloworld --no-httpd +``` + +We can see that an afb-daemon (Binder) process for this Service started +and get a websocket server up, meaning that an unix socket is available +from directory `/var/run/user/<uid>/apis/ws` named as the api name. +We also see that the shared library as been loaded as binding using `binding` +flag. + +A Service has no user interface, but we can still try the binding API. +Looking at the Service source code, we see that the Service implements +an API named '**helloworld**' providing a `ping` verb. Let us try to launch +a websocket client connected to that service invoking the `ping` verb. + +First as we don't know security token used to launch the service, we still can +connect to through the unix socket and use the websocket client demo: + +```bash +$ afb-daemon --ws-client=/var/run/user/0/apis/ws/helloworld --port=12345 --token='' --roothttp=. +$ afb-client-demo ws://localhost:12345/api?token= helloworld ping +ON-REPLY 1:helloworld/ping: {"response":"Make the World great again!","jtype":"afb-reply","request":{"status":"success","info":"Ping Binder Daemon tag=pingSample count=2 query=\"null\"","uuid":"2edcfee9-943b-40d7-a0c6-08a31141f045"}} +``` diff --git a/agl-documentation/sdk-devkit/docs/part-2/2_3-Dev-with-container.md b/agl-documentation/sdk-devkit/docs/part-2/2_3-Dev-with-container.md new file mode 100644 index 0000000..eb83c8f --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/2_3-Dev-with-container.md @@ -0,0 +1,93 @@ +# Developing smoothly with the container + +The previous chapter pretty much illustrated the virtues of the Docker +container by letting you compile AGL applications, independently of your +host machine. + +There is one catch, though, in that the container does not feature a +full graphical environment similar to those which developers are used to. +But this can be circumvented. + +For this reason, and before we start developing our own apps, we will +explain how to get the best from the provided development container. + +## Remote display + +<a id="anchor-remote-display"></a> + +Apart from popular console tools such as `vi, git, patch, diff...` our +container also features graphical applications: `gvim` text editor, +`gitg` frontend for Git, `gvimdiff` ... + +You can display them on your host machine by taking advantage of X11 +protocol remoting capabilities. The procedure differs depending on your +host machine. + +### Linux + +You have to connect to your container by specifying the `-X` option: + +```bash +ssh -X -p 2222 devel@localhost +``` + +and then any graphical window, such as `gvim`'s, should display on your +host screen. + +### Mac OS X + +You have to connect to your container by specifying the `-X` option: + +```bash +ssh -X -p 2222 devel@localhost +``` + +together with a running X11 server such as XQuartz. + +XQuartz was included in old versions such as 10.5 Leopard; you can find it +under `Applications -> Utilities -> X11`. +For more recent versions starting from 10.6.3, you may have to download and +install it from the following URL: +[https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.9.dmg](https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.9.dmg) +(it will end up in the same location). + +![mac x11](pictures/mac_x11_logo.png) + +And then after having activated the "X11" icon, any graphical window, such as +`gvim`'s, should display on your host screen. + +### Windows + +You have to use PuTTY, as suggested in the previous "**Image and SDK +for porter**" document, together with a running X server such as Xming +([https://sourceforge.net/projects/xming/files/latest/download](https://sourceforge.net/projects/xming/files/latest/download)). + +Before connecting with PuTTY as usual, you have to go +to `Connection -> SSH -> X11` and check the `Enable X11 forwarding` checkbox. + +![putty config](pictures/putty_config.png) + +Then, if Xming is installed and running, as displayed +in the bottom right of the screen: + +![xming server](pictures/xming_server.png) + +any graphical window, such as `gvim`'s, should display on your screen. + +## Installing new applications (IDE...) + +The container has access to the whole Linux Debian distribution library, +and can benefit of only package available for it. + +For instance, to install the popular Eclipse IDE, please type: + +```bash +sudo apt-get install eclipse +``` + +And then, using the method described in section ["Remote display"](anchor-remote-display), +you can run it on your host screen by just typing: + +```bash +eclipse +``` diff --git a/agl-documentation/sdk-devkit/docs/part-2/2_4-Use-app-templates.md b/agl-documentation/sdk-devkit/docs/part-2/2_4-Use-app-templates.md new file mode 100644 index 0000000..363333c --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/2_4-Use-app-templates.md @@ -0,0 +1,362 @@ +# AGL CMake templates + +Files used to build an application, or binding, project with the +AGL Application Framework. + +To build your AGL project using these templates, you have to install +them within your project and adjust compilation option in `config.cmake`.\ +For technical reasons, you also have to specify **cmake** target in +sub CMakeLists.txt installed.\ +Make a globbing search to find source files +isn't recommended now to handle project build especially in a multiuser +project because CMake will not be aware of new or removed source files. + +You'll find usage samples here: + +- [helloworld-service](https://github.com/iotbzh/helloworld-service) +- [low-level-can-service](https://gerrit.automotivelinux.org/gerrit/apps/low-level-can-service) +- [high-level-viwi-service](https://github.com/iotbzh/high-level-viwi-service) +- [audio-binding](https://github.com/iotbzh/audio-binding) +- [unicens2-binding](https://github.com/iotbzh/unicens2-binding) + +## Quickstart + +### Initialization + +To use these templates files on your project just install the reference files using +**git submodule** then use `config.cmake` file to configure your project specificities : + +```bash +git submodule add https://gerrit.automotivelinux.org/gerrit/apps/app-templatesconf.d/app-templates conf.d/app-templates +mkdir conf.d/cmake +cp conf.d/app-templates/cmake/config.cmake.sample conf.d/cmake/config.cmake +``` + +Edit the copied config.cmake file to fit your needs. + +Now, create your top CMakeLists.txt file which include `config.cmake` file. + +An example is available in **app-templates** submodule that you can copy and +use: + +```bash +cp conf.d/app-templates/cmake/CMakeLists.txt CMakeLists.txt +``` + +### Create your CMake targets + +For each target part of your project, you need to use ***PROJECT_TARGET_ADD*** +to include this target to your project. + +Using it, make available the cmake variable ***TARGET_NAME*** until the next +***PROJECT_TARGET_ADD*** is invoked with a new target name. + +So, typical usage defining a target is: + +```cmake +PROJECT_TARGET_ADD(SuperExampleName) --> Adding target to your project + +add_executable/add_library(${TARGET_NAME}.... --> defining your target sources + +SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES.... --> fit target properties +for macros usage + +INSTALL(TARGETS ${TARGET_NAME}.... +``` + +### Targets PROPERTIES + +You should set properties on your targets that will be used to package your +apps in a widget file that could be installed on an AGL system. + +Specify what is the type of your targets that you want to be included in the +widget package with the property **LABELS**: + +Choose between: + +- **BINDING**: Shared library that be loaded by the AGL Application Framework +- **HTDOCS**: Root directory of a web app +- **DATA**: Resources used by your application +- **EXECUTABLE**: Entry point of your application executed by the AGL + Application Framework + +```cmake +SET_TARGET_PROPERTIES(${TARGET_NAME} + PREFIX "afb-" + LABELS "BINDING" + OUTPUT_NAME "file_output_name") +``` + +> **TIP**: You should use the prefix _afb-_ with your **BINDING* targets which +> stand for **Application Framework Binding**. + +## More details: Typical project architecture + +A typical project architecture would be : + +```tree +<project-root-path> +│ +├── conf.d/ +│ ├── autobuild/ +│ │ ├── agl +│ │ │ └── autobuild +│ │ ├── linux +│ │ │ └── autobuild +│ │ └── windows +│ │ └── autobuild +│ ├── app-templates/ +│ │ ├── README.md +│ │ ├── autobuild/ +│ │ │ ├── agl +│ │ │ │ └── autobuild.in +│ │ │ ├── linux +│ │ │ │ └── autobuild.in +│ │ │ └── windows +│ │ │ └── autobuild.in +│ │ ├── cmake/ +│ │ │ ├── config.cmake.sample +│ │ │ ├── export.map +│ │ │ └── macros.cmake +│ │ ├── deb/ +│ │ │ └── config.deb.in +│ │ ├── rpm/ +│ │ │ └── config.spec.in +│ │ └── wgt/ +│ │ ├── config.xml.in +│ │ ├── config.xml.in.sample +│ │ ├── icon-default.png +│ │ ├── icon-html5.png +│ │ ├── icon-native.png +│ │ ├── icon-qml.png +│ │ └── icon-service.png +│ ├── packaging/ +│ │ ├── config.spec +│ │ └── config.deb +│ ├── cmake +│ │ └── config.cmake +│ └── wgt +│ └── config.xml.in +├── <libs> +├── <target> +│ └── <files> +├── <target> +│ └── <file> +└── <target> + └── <files> +``` + +| # | Parent | Description | +| - | -------| ----------- | +| \<root-path\> | - | Path to your project. Hold master CMakeLists.txt and general files of your projects. | +| conf.d | \<root-path\> | Holds needed files to build, install, debug, package an AGL app project | +| app-templates | conf.d | Git submodule to app-templates AGL repository which provides CMake helpers macros library, and build scripts. config.cmake is a copy of config.cmake.sample configured for the projects. SHOULD NOT BE MODIFIED MANUALLY !| +| autobuild | conf.d | Scripts generated from app-templates to build packages the same way for differents platforms.| +| cmake | conf.d | Contains at least config.cmake file modified from the sample provided in app-templates submodule. | +| wgt | conf.d | Contains at least config.xml.in template file modified from the sample provided in app-templates submodule for the needs of project (See config.xml.in.sample file for more details). | +| packaging | conf.d | Contains output files used to build packages. | +| \<libs\> | \<root-path\> | External dependencies libraries. This isn't to be used to include header file but build and link statically specifics libraries. | Library sources files. Can be a decompressed library archive file or project fork. | +| \<target\> | \<root-path\> | A target to build, typically library, executable, etc. | + +### Update app-templates submodule + +You may have some news bug fixes or features available from app-templates +repository that you want.\ +To update your submodule proceed like the following: + +```bash +git submodule update --remote +git commit -s conf.d/app-templates +``` + +This will update the submodule to the HEAD of master branch repository. + +You could just want to update at a specified repository tag or branch or commit +, here are the method to do so: + +```bash +cd conf.d/app-templates +# Choose one of the following depending what you want +git checkout <tag_name> +git checkout --detach <branch_name> +git checkout --detach <commit_id> +# Then commit +cd ../.. +git commit -s conf.d/app-templates +``` + +### Build a widget + +#### config.xml.in file + +To build a widget you need a _config.xml_ file describing what is your apps and +how Application Framework would launch it.\ +This repo provide a simple default file _config.xml.in_ that should work +for simple application without interactions with others bindings. + +It is recommanded that you use the sample one which is more complete. You can +find it at the same location under the name _config.xml.in.sample_ (stunning +isn't it).\ +Just copy the sample file to your _conf.d/wgt_ directory and name it +_config.xml.in_, then edit it to fit your needs. + +> ***CAUTION*** : The default file is only meant to be use for a +> simple widget app, more complicated ones which needed to export +> their api, or ship several app in one widget need to use the provided +> _config.xml.in.sample_ which had all new Application Framework +> features explained and examples. + +#### Using cmake template macros + +To leverage all cmake templates features, you have to specify ***properties*** +on your targets.\ +Some macros will not works without specifying which is the target type. + +As the type is not always specified for some custom targets, like an ***HTML5*** +application, macros make the difference using ***LABELS*** property. + +Choose between: + +- **BINDING**: Shared library that be loaded by the AGL Application Framework +- **HTDOCS**: Root directory of a web app +- **DATA**: Resources used by your application +- **EXECUTABLE**: Entry point of your application executed by the AGL + Application Framework + +Example: + +```cmake +SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + LABELS "HTDOCS" + OUTPUT_NAME dist.prod + ) +``` + +If your target output is not named as the ***TARGET_NAME***, you need to specify +***OUTPUT_NAME*** property that will be used by the ***populate_widget*** macro. + +Use the ***populate_widget*** macro as latest statement of your target +definition. Then at the end of your project definition you should use the macro +***build_widget*** that make an archive from the populated widget tree using the +`wgtpkg-pack` Application Framework tools. + +## Macro reference + +### PROJECT_TARGET_ADD + +Typical usage would be to add the target to your project using macro +`PROJECT_TARGET_ADD` with the name of your target as parameter. + +Example: + +```cmake +PROJECT_TARGET_ADD(low-can-demo) +``` + +> ***NOTE***: This will make available the variable `${TARGET_NAME}` +> set with the specificied name. This variable will change at the next call +> to this macros. + +### project_subdirs_add + +This macro will search in all subfolder any `CMakeLists.txt` file. If found then +it will be added to your project.\ +This could be use in an hybrid application by example where the binding +lay in a sub directory. + +Usage : + +```cmake +project_subdirs_add() +``` + +You also can specify a globbing pattern as argument to filter which folders +will be looked for. + +To filter all directories that begin with a number followed by a dash the +anything: + +```cmake +project_subdirs_add("[0-9]-*") +``` + +## Advanced customization + +### Including additionnals cmake files + +Advanced tuning is possible using addionnals cmake files that are included +automatically from some specifics locations.\ +They are included in that order: + +- Project CMake files normaly located in _\<project-root-path\>/conf.d/app-templates/cmake/cmake.d_ +- Home CMake files located in _$HOME/.config/app-templates/cmake.d_ +- System CMake files located in _/etc/app-templates/cmake.d_ + +CMake files has to be named using the following convention: `XX-***.cmake`, +where `XX` are numbers, `***` file name (ie. `99-my_customs.cmake`). + +So, saying that you should be aware that every normal cmake variables used at +project level could be overwrited by home or system located cmake files if +variables got the same name.\ +Exceptions are cached variables set using **CACHE** keyword: + +Example: + +```cmake +set(VARIABLE_NAME 'value string random' CACHE STRING 'docstring') +``` + +### Include customs templated scripts + +As well as for additionnals cmake files you can include your own templated +scripts that will be passed to cmake command `configure_file`. + +Just create your own script to the following directories: + +- Home location in _$HOME/.config/app-templates/scripts_ +- System location in _/etc/app-templates/scripts_ + +Scripts only needs to use the extension `.in` to be parsed and configured by +CMake command. + +## Autobuild script usage + +### Generation + +To be integrated in the Yocto build workflow you have to generate `autobuild` +scripts using _autobuild_ target. + +To generate those scripts proceeds: + +```bash +mkdir -p build +cd build +cmake .. && make autobuild +``` + +You should see _conf.d/autobuild/agl/autobuild_ file now. + +### Available targets + +Here are the available targets available from _autobuild_ scripts: + +- **clean** : clean build directory from object file and targets results. +- **distclean** : delete build directory +- **configure** : generate project Makefile from CMakeLists.txt files. +- **build** : compile all project targets. +- **package** : build and output a wgt package. + +You can specify variables that modify the behavior of compilation using +the following variables: + +- **CONFIGURE_ARGS** : Variable used at **configure** time. +- **BUILD_ARGS** : Variable used at **build** time. +- **DEST** : Directory where to output ***wgt*** file. + +Variable as to be in CMake format. (ie: BUILD_ARGS="-DC_FLAGS='-g -O2'") + +Usage example: + +```bash +./conf.d/autobuild/wgt/autobuild package DEST=/tmp +``` diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/cpu_hybrid_qml.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/cpu_hybrid_qml.png Binary files differnew file mode 100644 index 0000000..c3b35f5 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/cpu_hybrid_qml.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/html5_app.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/html5_app.png Binary files differnew file mode 100644 index 0000000..62b8d5e --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/html5_app.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_html5_app.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_html5_app.png Binary files differnew file mode 100644 index 0000000..bfb09b3 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_html5_app.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_html5_app_on_target.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_html5_app_on_target.png Binary files differnew file mode 100644 index 0000000..f4639dd --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_html5_app_on_target.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_qml_app.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_qml_app.png Binary files differnew file mode 100644 index 0000000..d27dfb2 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/hybrid_qml_app.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/mac_x11_logo.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/mac_x11_logo.png Binary files differnew file mode 100644 index 0000000..6dace7d --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/mac_x11_logo.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/putty_config.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/putty_config.png Binary files differnew file mode 100644 index 0000000..56f8d88 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/putty_config.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/qml_app.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/qml_app.png Binary files differnew file mode 100644 index 0000000..30f574d --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/qml_app.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/web-runtime_app.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/web-runtime_app.png Binary files differnew file mode 100644 index 0000000..c15e98d --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/web-runtime_app.png diff --git a/agl-documentation/sdk-devkit/docs/part-2/pictures/xming_server.png b/agl-documentation/sdk-devkit/docs/part-2/pictures/xming_server.png Binary files differnew file mode 100644 index 0000000..566cec7 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/part-2/pictures/xming_server.png diff --git a/agl-documentation/sdk-devkit/docs/resources/iotbzh_logo.png b/agl-documentation/sdk-devkit/docs/resources/iotbzh_logo.png Binary files differnew file mode 100644 index 0000000..ae6bc48 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/resources/iotbzh_logo.png diff --git a/agl-documentation/sdk-devkit/docs/resources/iotbzh_logo_small.png b/agl-documentation/sdk-devkit/docs/resources/iotbzh_logo_small.png Binary files differnew file mode 100644 index 0000000..6a98c60 --- /dev/null +++ b/agl-documentation/sdk-devkit/docs/resources/iotbzh_logo_small.png diff --git a/agl-documentation/sdk-devkit/mkdocs.yml b/agl-documentation/sdk-devkit/mkdocs.yml new file mode 100644 index 0000000..c340a9d --- /dev/null +++ b/agl-documentation/sdk-devkit/mkdocs.yml @@ -0,0 +1,20 @@ +site_name: AGL Application Framework Binder +theme: readthedocs +docs_dir: docs +pages: +- 'Document revisions' : '0-Doc-Revisions.md' +- 'Part 1 - Build AGL image from scratch': + - 'Abstract' : 'part-1/1_0_Abstract.md' + - '1. Deploy an image using containers' : 'part-1/1_1-Deploy_image.md' + - '2. Setting up your operating system' : 'part-1/1_2-Setting-up-your_os.md' + - '3. Install AGL Yocto image for Porter board using Docker container' : 'part-1/1_3-Install-agl-for-porter.md' + - '4. Inside the container' : 'part-1/1_4-Inside-the-container.md' + - '5. Build an image for Porter board' : 'part-1/1_5-Build-image-Porter.md' + - '6. Porter image deployment on target' : 'part-1/1_6-Porter-image-deployment.md' + - '7. AGL SDK compilation and installation' : 'part-1/1_7-SDK-compilation-installation.md' +- 'Part 2 - Build your 1st application' : + - 'Abstract' : 'part-2/2_0_Abstract.md' + - '1. Initializing SDK environment and templates' : 'part-2/2_1-Init-sdk-env.md' + - '2. Trying out the templates' : 'part-2/2_2-Trying-out-templates.md' + - '3. Developing smoothly with the container' : 'part-2/2_3-Dev-with-container.md' + - '4. Creating your own hybrid application' : 'part-2/2_4-Creating-hybrid-app.md' |