From 8f9934b438a145d9d84beec0153c431996697507 Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Wed, 20 Sep 2017 10:24:51 +0200 Subject: Initial commit Signed-off-by: Sebastien Douheret --- docs/0-Doc-Revisions.md | 6 + docs/README.md | 29 ++ docs/SUMMARY.md | 16 ++ docs/_layouts/ebook/page.html | 36 +++ docs/_layouts/ebook/pdf_footer.html | 13 + docs/_layouts/ebook/pdf_header.html | 13 + docs/_layouts/ebook/summary.html | 58 ++++ docs/_layouts/layout.html | 28 ++ docs/part-1/0_Abstract.md | 27 ++ docs/part-1/1_install-client.md | 58 ++++ docs/part-1/2_install-xds-server.md | 203 ++++++++++++++ docs/part-1/3_install-sdks.md | 30 ++ docs/part-1/4_build-first-app.md | 299 ++++++++++++++++++++ docs/part-1/5_debug-first-app.md | 202 ++++++++++++++ docs/part-1/pictures/iotbzh_logo_small.png | Bin 0 -> 6989 bytes docs/part-1/pictures/nb_new-project-1.png | Bin 0 -> 44558 bytes docs/part-1/pictures/nb_new-project-2.png | Bin 0 -> 37485 bytes docs/part-1/pictures/nb_new-project-3.png | Bin 0 -> 58461 bytes docs/part-1/pictures/nb_newtool.png | Bin 0 -> 51208 bytes docs/part-1/pictures/nb_project_debug-1.png | Bin 0 -> 59680 bytes docs/part-1/pictures/nb_xds_options.png | Bin 0 -> 50882 bytes docs/part-1/pictures/xds-block-diagram.png | Bin 0 -> 130080 bytes docs/part-1/pictures/xds-conf.png | Bin 0 -> 86650 bytes docs/part-1/pictures/xds-dashboard-icon-1.png | Bin 0 -> 894 bytes docs/part-1/pictures/xds-dashboard-icon-2.png | Bin 0 -> 381 bytes docs/part-1/pictures/xds-dashboard-icon-3.png | Bin 0 -> 785 bytes docs/part-1/pictures/xds-dashboard-prj-1.png | Bin 0 -> 63430 bytes docs/part-1/pictures/xds-dashboard-prj-2.png | Bin 0 -> 149124 bytes docs/part-2/0_Abstract.md | 6 + docs/part-2/1_xds-server.md | 336 ++++++++++++++++++++++ docs/part-2/2_xds-agent.md | 166 +++++++++++ docs/part-2/3_xds-exec.md | 296 ++++++++++++++++++++ docs/part-2/4_xds-gdb.md | 201 ++++++++++++++ docs/part-2/pictures/.gitkeep | 0 docs/resources/cover.svg | 210 ++++++++++++++ docs/resources/ebook.css | 386 ++++++++++++++++++++++++++ docs/resources/make_cover.sh | 27 ++ 37 files changed, 2646 insertions(+) create mode 100644 docs/0-Doc-Revisions.md create mode 100644 docs/README.md create mode 100644 docs/SUMMARY.md create mode 100644 docs/_layouts/ebook/page.html create mode 100644 docs/_layouts/ebook/pdf_footer.html create mode 100644 docs/_layouts/ebook/pdf_header.html create mode 100644 docs/_layouts/ebook/summary.html create mode 100644 docs/_layouts/layout.html create mode 100644 docs/part-1/0_Abstract.md create mode 100644 docs/part-1/1_install-client.md create mode 100644 docs/part-1/2_install-xds-server.md create mode 100644 docs/part-1/3_install-sdks.md create mode 100644 docs/part-1/4_build-first-app.md create mode 100644 docs/part-1/5_debug-first-app.md create mode 100644 docs/part-1/pictures/iotbzh_logo_small.png create mode 100644 docs/part-1/pictures/nb_new-project-1.png create mode 100644 docs/part-1/pictures/nb_new-project-2.png create mode 100644 docs/part-1/pictures/nb_new-project-3.png create mode 100644 docs/part-1/pictures/nb_newtool.png create mode 100644 docs/part-1/pictures/nb_project_debug-1.png create mode 100644 docs/part-1/pictures/nb_xds_options.png create mode 100644 docs/part-1/pictures/xds-block-diagram.png create mode 100644 docs/part-1/pictures/xds-conf.png create mode 100644 docs/part-1/pictures/xds-dashboard-icon-1.png create mode 100644 docs/part-1/pictures/xds-dashboard-icon-2.png create mode 100644 docs/part-1/pictures/xds-dashboard-icon-3.png create mode 100644 docs/part-1/pictures/xds-dashboard-prj-1.png create mode 100644 docs/part-1/pictures/xds-dashboard-prj-2.png create mode 100644 docs/part-2/0_Abstract.md create mode 100644 docs/part-2/1_xds-server.md create mode 100644 docs/part-2/2_xds-agent.md create mode 100644 docs/part-2/3_xds-exec.md create mode 100644 docs/part-2/4_xds-gdb.md create mode 100644 docs/part-2/pictures/.gitkeep create mode 100644 docs/resources/cover.svg create mode 100644 docs/resources/ebook.css create mode 100755 docs/resources/make_cover.sh (limited to 'docs') diff --git a/docs/0-Doc-Revisions.md b/docs/0-Doc-Revisions.md new file mode 100644 index 0000000..6d9d0a7 --- /dev/null +++ b/docs/0-Doc-Revisions.md @@ -0,0 +1,6 @@ +Document revisions +================== + +| Date | Version | Designation  | Author | +|-------------|---------|--------------------------------------|-------------------------| +| Sept 2017 | 0.1 | Initial release | S. Douheret [ Iot.bzh ] | diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..6dcccc3 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,29 @@ +# Introduction + +**X**(cross) **D**evelopment **S**ystem is a tool that allows user to easily +cross build applications. + +The first goal is to provide a multi-platform cross development tool with +near-zero installation. +The second goal is to keep application sources locally (on user's machine) to +make it compatible with existing IT policies (e.g. corporate backup or SCM), +and let user to continue to work as usual (use his favorite editor, +keep performance while editing/browsing sources). + +
+
+
+
+
+ +| *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/docs/SUMMARY.md b/docs/SUMMARY.md new file mode 100644 index 0000000..cdba733 --- /dev/null +++ b/docs/SUMMARY.md @@ -0,0 +1,16 @@ +# Summary + +* [Document revisions](0-Doc-Revisions.md) + +* [Part 1 - Getting Started for Users](part-1/0_Abstract.md) + * [Installing xds client tools](part-1/1_install-client.md) + * [Installing xds-server](part-1/2_install-xds-server.md) + * [Installing AGL SDKs](part-1/3_install-sdks.md) + * [Create your first AGL application](part-1/4_build-first-app.md) + * [Debug your first AGL application](part-1/5_debug-first-app.md) + +* [Part 2 - XDS internals](part-2/0_Abstract.md) + * [xds-server](part-2/1_xds-server.md) + * [xds-agent](part-2/2_xds-agent.md) + * [xds-exec](part-2/3_xds-exec.md) + * [xds-gdb](part-2/4_xds-gdb.md) diff --git a/docs/_layouts/ebook/page.html b/docs/_layouts/ebook/page.html new file mode 100644 index 0000000..bf325e9 --- /dev/null +++ b/docs/_layouts/ebook/page.html @@ -0,0 +1,36 @@ +{% extends "layout.html" %} + +{% block title %}{{ page.title }}{% endblock %} +{% block description %}{{ page.description }}{% endblock %} + +{% block style %} + {### Include theme css before plugins css ###} + {% if not fileExists(config.styles.print) %} + {% if options.format %} + + {% else %} + + {% endif %} + {% endif %} + + {{ super() }} + + {### Custom stylesheets for the book ###} + + {% for type, style in config.styles %} + {% if fileExists(style) and (type == "ebook" or type == "print" or type == options.format) %} + + {% endif %} + {% endfor %} +{% endblock %} + +{% block body %} +
+ {% block page %} +

{{ page.title }}

+
+ {{ page.content|safe }} +
+ {% endblock %} +
+{% endblock %} diff --git a/docs/_layouts/ebook/pdf_footer.html b/docs/_layouts/ebook/pdf_footer.html new file mode 100644 index 0000000..679e562 --- /dev/null +++ b/docs/_layouts/ebook/pdf_footer.html @@ -0,0 +1,13 @@ +{% extends "./page.html" %} +{% block body %} + + + + +{% endblock %} diff --git a/docs/_layouts/ebook/pdf_header.html b/docs/_layouts/ebook/pdf_header.html new file mode 100644 index 0000000..ef49641 --- /dev/null +++ b/docs/_layouts/ebook/pdf_header.html @@ -0,0 +1,13 @@ +{% extends "./page.html" %} +{% block body %} +
+ IoT.Bzh + {{ config.title }} +
+ + + + +{% endblock %} \ No newline at end of file diff --git a/docs/_layouts/ebook/summary.html b/docs/_layouts/ebook/summary.html new file mode 100644 index 0000000..be328a4 --- /dev/null +++ b/docs/_layouts/ebook/summary.html @@ -0,0 +1,58 @@ +{% extends "./page.html" %} + +{% block title %}{{ "SUMMARY"|t }}{% endblock %} + +{% macro articles(_articles) %} + {% for article in _articles %} +
  • + + {% if article.path or article.url %} + {% if article.path %} + {{ article.title }} + {% else %} + {{ article.title }} + {% endif %} + {% else %} + {{ article.title }} + {% endif %} + {% if 1 %} + {{ article.level }} + {% endif %} + + {% if article.articles.length > 0 %} +
      + {{ articles(article.articles) }} +
    + {% endif %} +
  • + {% endfor %} +{% endmacro %} + +{% block page %} +
    +

    {{ "SUMMARY"|t }}

    +
      + {% for part in summary.parts %} + {% if part.title %} +
    1. +

      {{ part.title }}

      +
    2. + {% endif %} + {{ articles(part.articles) }} + + {% if not loop.last %} +
    3. + {% endif %} + {% endfor %} + + {% if glossary.path %} +
    4. + + {{ "GLOSSARY"|t }} + +
    5. + {% endif %} +
    +
    +{% endblock %} + diff --git a/docs/_layouts/layout.html b/docs/_layouts/layout.html new file mode 100644 index 0000000..3d5aca6 --- /dev/null +++ b/docs/_layouts/layout.html @@ -0,0 +1,28 @@ + + + + + + {% block title %}{{ config.title|d("GitBook", true) }}{% endblock %} + + + + {% if config.author %}{% endif %} + {% if config.isbn %}{% endif %} + {% block style %} + {% for resource in plugins.resources.css %} + {% if resource.url %} + + {% else %} + + {% endif %} + {% endfor %} + {% endblock %} + + {% block head %}{% endblock %} + + + {% block body %}{% endblock %} + {% block javascript %}{% endblock %} + + diff --git a/docs/part-1/0_Abstract.md b/docs/part-1/0_Abstract.md new file mode 100644 index 0000000..d0e32de --- /dev/null +++ b/docs/part-1/0_Abstract.md @@ -0,0 +1,27 @@ +# Part 1 - Getting Started for Users + +## Abstract + +X(cross) Development System (XDS) is set of tools that provide a multi-platform +for cross development with near-zero installation. + +XDS allows you to keep developed application sources locally (on user's machine) +to make it compatible with existing IT policies (e.g. corporate backup or SCM), +and let user to continue to work as usual (use its favorite editor, +keep performance while editing/browsing sources). + +The two main blocks that compose XDS are the client part (`xds-agent`) running +on the user's machine and the server part (`xds-server`) running somewhere in a container or on a server machine (on local network or cloud). + +![](./pictures/xds-block-diagram.png){style width:98%;} + + + +The client part (`xds-agent`) is portable and is running on Linux, Windows or +MacOS machine and the following 3 main configurations are supported: + +- standalone (or local) config +- On-Premise (local network) +- SaaS (Cloud based) + +![](./pictures/xds-conf.png){style width:98%;} diff --git a/docs/part-1/1_install-client.md b/docs/part-1/1_install-client.md new file mode 100644 index 0000000..b596e57 --- /dev/null +++ b/docs/part-1/1_install-client.md @@ -0,0 +1,58 @@ +# Installing XDS client tools + +[xds-agent](https://github.com/iotbzh/xds-agent) is a client tool that must run +on your machine (user / developer host) to be able to use XDS. + +Installation of other XDS client tools, such as `xds-exec` or `xds-gdb` is +optional and depends of what you want to do : + +- [xds-exec](https://github.com/iotbzh/xds-exec) : command line tool to interact with XDS (also used by IDE integration). +- [xds-gdb](https://github.com/iotbzh/xds-gdb) : requested for debugging application. + +## Install packages for debian distro type + +```bash +# 'DISTRO' can be set to { xUbuntu_16.04, xUbuntu_16.10, xUbuntu_17.04, Debian_8.0, Debian_9.0} +seb@laptop ~$ export DISTRO="xUbuntu_16.04" + +seb@laptop ~$ wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add - +seb@laptop ~$ sudo bash -c "cat >> /etc/apt/sources.list.d/AGL.list < Installation based on Docker container + +### Prerequisites + +Docker is installed on the host machine, please refer to [Docker documentation](https://docs.docker.com/engine/installation/) for more details. + +### Get the container + +Load the pre-build AGL SDK docker image including `xds-server`: + +```bash +seb@laptop ~$ wget -O - http://iot.bzh/download/public/2017/XDS/docker/docker_agl_worker-xds-latest.tar.xz | docker load +``` + +You should get `docker.automotivelinux.org/agl/worker-xds:X.Y` image + +```bash +# List image that we just load +seb@laptop ~$ docker images "docker.automotivelinux.org/agl/worker-xds*" + +docker.automotivelinux.org/agl/worker-xds 4.0 786d65b2792c 6 days ago 654MB +``` + +### Create and start a new container + +Use provided script to create a new docker container and start it: + +```bash +# Get script +seb@laptop ~$ wget https://raw.githubusercontent.com/iotbzh/xds-server/master/scripts/xds-docker-create-container.sh + +# Create new XDS worker container +seb@laptop ~$ bash ./xds-docker-create-container.sh + +# Check that new container is running +seb@laptop ~$ docker ps | grep worker-xds + +b985d81af40c docker.automotivelinux.org/agl/worker-xds:3.99.1 "/usr/bin/wait_for..." 6 days ago Up 4 hours 0.0.0.0:8000->8000/tcp, 0.0.0.0:69->69/udp, 0.0.0.0:10809->10809/tcp, 0.0.0.0:2222->22/tcp agl-xds-seb@laptop-0-seb +``` + +### Check if xds-server is running + +`xds-server` is automatically started as a service on container startup. + +To check if xds-server is correctly install and running, you can access the web +interface, what we call the "Dashboard", using a web browser : + +```bash +# if container is running on your local host +# (else replace localhost by the name or the ip of the machine running the container) +seb@laptop ~$ xdg-open http://localhost:8000 +``` + +### Container settings + +This container (ID=0) exposes following ports: + +- 8000 : `xds-server` to serve XDS Dashboard +- 69 : TFTP +- 2222 : ssh + +This container also creates the following volumes (sharing directories between +inside and outside docker): + +| Directory on host | Directory inside docker | Comment | +|-------------------|-------------------------|---------| +| $HOME/xds-workspace | /home/devel/xds-workspace | XDS projects workspace location| +| $HOME/ssd/xdt_0 | /xdt | location to store SDKs | +| $HOME/devel/docker/share |/home/devel/share | another shared directory | + + + +Please refer to **part 2 - xds-server** documentation for additional info. + + +## Installation based on VirtualBox appliance + +_coming soon ..._ + +## Native installation + + +Only Linux host OS is supported and tested for native installation ! + + +### Install packages for debian distro type + +```bash +# 'DISTRO' can be set to { xUbuntu_16.04, xUbuntu_16.10, xUbuntu_17.04, Debian_8.0, Debian_9.0} +seb@laptop ~$ export DISTRO="xUbuntu_16.04" + +seb@laptop ~$ wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add - +seb@laptop ~$ sudo bash -c "cat >> /etc/apt/sources.list.d/AGL.list < +>**Note**: you can use your own JSON config by settings `APP_CONFIG` variable of +`/etc/default/xds-server` file to your file, for example +`/home/MYUSER/.xds/server/config.json` + + +Supported fields in JSON configuration file are : + +- **httpPort** : HTTP port of client webapp / dashboard +- **webAppDir** : location of client dashboard (default: webapp/dist) +- **shareRootDir** : root directory where projects will be copied +- **logsDir** : directory to store logs (eg. syncthing output) +- **sdkRootDir** : root directory where cross SDKs are installed +- **syncthing.binDir** : syncthing binaries directory (default: executable directory) +- **syncthing.home"** : syncthing home directory (usually .../syncthing-config) +- **syncthing.gui-address** : syncthing gui url (default http://localhost:8384) +- **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated) + +All fields are optional and example below corresponds to the default values: + +```json +{ + "httpPort": 8000, + "webAppDir": "webapp/dist", + "shareRootDir": "${HOME}/.xds-server/projects", + "logsDir": "/tmp/logs", + "sdkRootDir": "/xdt/sdk", + "syncthing": { + "binDir": "./bin", + "home": "${HOME}/.xds-server/syncthing-config", + "gui-address": "http://localhost:8384", + "gui-apikey": "123456789", + } +} +``` + +>**NOTE:** environment variables are supported by using `${MY_VAR}` syntax. + +### Start/Stop xds-server + +`xds-server` can be managed as a systemd service with the following commands: + +```bash +# Status XDS server: +seb@laptop ~$ sudo systemctl status xds-server.service + +# Stop XDS server +seb@laptop ~$ sudo systemctl stop xds-server.service + +# Start XDS server +seb@laptop ~$ sudo systemctl start xds-server.service + +# Get XDS server logs +seb@laptop ~$ sudo journalctl --unit=xds-server.service --output=cat +``` + +To check if xds-server is correctly install and running, you can access the web +interface, what we call the "Dashboard", using a web browser : + +```bash +seb@laptop ~$ xdg-open http://localhost:8000 +``` diff --git a/docs/part-1/3_install-sdks.md b/docs/part-1/3_install-sdks.md new file mode 100644 index 0000000..3b85573 --- /dev/null +++ b/docs/part-1/3_install-sdks.md @@ -0,0 +1,30 @@ +# Installing AGL SDKs + +To build your AGL services or AGL applications using XDS you must install a SDK +matching the target/board you want to use. A SDK is a package that includes all +tools you need to cross-build and cross-debug your service/application. + +You can generate the AGL SDK for the board you want to use or you can download +a pre-packaged AGL SDK. + +## Installing SDK cross-toolchain + +`xds-server` uses SDK cross-toolchain installed into directory pointed by +`sdkRootDir` setting (see `xds-server` configuration chapter for more details). + +For now, you can only install SDK using a bash script but in a near future you +will be able to do that using XDS Dashboard. + +So to install a SDK, use provided `install-agl-sdks` script: + +```bash +# Optional - Log into the container (only necessary when xds-server is running within a docker container) +seb@laptop ~$ ssh -p 2222 devel@localhost + +# For example, Install ARM64 SDK (automatic download) +devel@docker ~$ sudo /opt/AGL/xds/server/xds-utils/install-agl-sdks.sh --arch aarch64 + +# Install Intel corei7-64 SDK (using an SDK tarball that has been built or downloaded manually) +devel@docker ~$ sudo /opt/AGL/xds/server/xds-utils/install-agl-sdks.sh --arch corei7-64 --file /tmp/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain- +4.0.1.sh +``` diff --git a/docs/part-1/4_build-first-app.md b/docs/part-1/4_build-first-app.md new file mode 100644 index 0000000..d698bab --- /dev/null +++ b/docs/part-1/4_build-first-app.md @@ -0,0 +1,299 @@ +# Create your first AGL application + +## Setup + +Let's use for example helloworld-native-application, so you need first to clone +this project into a directory that will be accessible by `xds-server`. +Depending of the project sharing method: + +- Cloud sync: you can clone project anywhere on your local disk, +- Path mapping: you must clone project into `$HOME/xds-workspace` directory. + + +> **Note** : [helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) project is an AGL +project based on [app-templates](https://git.automotivelinux.org/apps/app-templates/) +(included as a git submodule). This CMake templating, used to develop application +with the AGL Application Framework, will automatically generate makefile rules +(eg. `remote-target-populate`) or scripts (eg. `build/target/xxx` scripts). + +For more info about app-template, please refer to [this documentation](http://docs.automotivelinux.org/docs/devguides/en/dev/reference/sdk-devkit/docs/part-2/2_4-Use-app-templates.html). + + +### Clone project + +```bash +cd $HOME/xds-workspace +git clone --recursive https://github.com/iotbzh/helloworld-native-application.git +``` + +### Declare project into XDS + +Use XDS Dashboard to declare your project. Open a browser and connect to XDS +Dashboard. URL depends of your config, for example `http://localhost:8000` + +Click cog icon ![](./pictures/xds-dashboard-icon-1.png){style display:inline; padding:0;} +to open configuration panel and then create/declare a new project by with the +plus icon +![](./pictures/xds-dashboard-icon-2.png){style display:inline; padding:0;} +of `Projects` bar. + +Set `Sharing Type` and paths according to your setup. + +![](./pictures/xds-dashboard-prj-1.png){style width:90%;} + + +>**Note:** when you select `Path mapping`, you must clone your project into +`$HOME/xds-workspace` directory (named "Local Path" in modal window) and +"Server Path" must be set to `/home/devel/xds-workspace/xxx` where xxx is your +project directory name. If you select `Cloud Sync`, you can clone your project +where you want on your local disk. + + +## Build from XDS dashboard + +Open the build page (icon ![](./pictures/xds-dashboard-icon-3.png){style display:inline; padding:0;}), then select your **Project** and the **Cross SDK** you want to use and click on +**Clean / Pre-Build / Build / Populate** buttons to execute various build actions. + +![](./pictures/xds-dashboard-prj-2.png){style width:90%;} + +## Build from command line + +You need to determine which is the unique id of your project. You can find +this ID in project page of XDS dashboard or you can get it from command line +using the `--list` option. This option lists all existing projects ID: + +```bash +./bin/xds-exec --list + +List of existing projects: + CKI7R47-UWNDQC3_myProject + CKI7R47-UWNDQC3_test2 + CKI7R47-UWNDQC3_test3 +``` + +Now to refer your project, just use --id option or use `XDS_PROJECT_ID` +environment variable. + +You are now ready to use XDS to for example cross build your project. +Here is an example to build a project based on CMakefile: + +```bash +# Add xds-exec in the PATH +export PATH=${PATH}:/opt/AGL/bin + +# Go into your project directory +cd $MY_PROJECT_DIR + +# Create a build directory +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- mkdir build + +# Generate build system using cmake +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- cd build && cmake .. + +# Build the project +xds-exec --id=CKI7R47-UWNDQC3_myProject --sdkid=poky-agl_aarch64_4.0.1 --url=http://localhost:8000 -- cd build && make all +``` + +To avoid to set project id, xds server url, ... at each command line, you can +define these settings as environment variable within an env file and just set +`--config` option or source file before executing xds-exec. + +For example, the equivalence of above command is: + +```bash +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cd $MY_PROJECT_DIR +cat > xds-project.conf << EOF + export XDS_SERVER_URL=localhost:8000 + export XDS_PROJECT_ID=CKI7R47-UWNDQC3_myProject + export XDS_SDK_ID=poky-agl_corei7-64_4.0.1 +EOF + +xds-exec --config xds-project.conf -- mkdir build + +# Or sourcing env file +source xds-project.conf +xds-exec -- mkdir -o build && cd build && cmake .. +xds-exec -- cd build && make all +``` + + +>**Note:** all parameters after a double dash (--) are considered as the command +to execute on xds-server. + + +## Build from IDE + +First create the XDS config file that will be used later by xds-exec commands. +For example we use here aarch64 SDK to cross build application for a Renesas +Gen3 board. + +```bash +# create file at root directory of your project +# for example: +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cat > $MY_PROJECT_DIR/xds-gen3.conf << EOF + export XDS_SERVER_URL=localhost:8000 + export XDS_PROJECT_ID=cde3b382-9d3b-11e7_helloworld-native-application + export XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF +``` + +### NetBeans + +__Netbeans 8.x :__ + +- Open menu **Tools** -> **Options** + - Open **C/C++** tab, in **Build Tools** sub-tab, click on **Add** button: + + ![Add new tool panel](./pictures/nb_newtool.png) + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png) + + - Finally click on **OK** button. + +- Open menu **File** -> **New Project** + +- Select **C/C++ Project with Existing Sources** ; + Click on **Next** button + +- Specify the directory where you cloned your project and click on **Finish** button to keep all default settings: + + ![Select Model panel](./pictures/nb_new-project-1.png) + +- Edit project properties (using menu **File** -> **Project Properties**) to add a new configuration that will use XDS to cross-compile your application for example for a Renesas Gen3 board) + + - in **Build** category, click on **Manage Configurations** button and then **New** button to add a new configuration named for example "Gen3 board" + + ![Select Model panel](./pictures/nb_new-project-2.png) + + - Click on **Set Active** button + + - Select **Pre-Build** sub-category, and set: + - Working Directory: `build_gen3` + - Command Line: `xds-exec -c ../xds-gen3.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ..` + - Pre-build First: `ticked` + + - Select **Make** sub-category, and set: + - Working Directory: `build_gen3` + - Build Command: `xds-exec -c ../xds-gen3.conf -- make remote-target-populate` + - Clean Command: `xds-exec -c ../xds-gen3.conf -- make clean` + + ![Select Model panel](./pictures/nb_new-project-3.png) + + - Click on **OK** button to save settings + +By changing configuration from **Default** to **Gen3 board**, you can now simply +compile your helloworld application natively (**Default** configuration) or +cross-compile your application through XDS for a Renesas Gen3 board (**Gen3 board** configuration). + +### Visual Studio Code + +Open your project in VS Code + +```bash +cd $MY_PROJECT_DIR +code . & +``` + +Add new tasks : press `Ctrl+Shift+P` and select the `Tasks: Configure Task Runner` command and you will see a list of task runner templates. + +And define your own tasks, here is an example to build [unicens2-binding](https://github.com/iotbzh/unicens2-binding) AGL binding based on cmake (_options value of args array must be updated regarding your settings_): + +```json +{ + "version": "0.1.0", + "linux": { + "command": "/opt/AGL/bin/xds-exec" + }, + "isShellCommand": true, + "args": [ + "-url", "localhost:8000", + "-id", "CKI7R47-UWNDQC3_myProject", + "-sdkid", "poky-agl_aarch64_4.0.1", + "--" + ], + "showOutput": "always", + "tasks": [{ + "taskName": "clean", + "suppressTaskName": true, + "args": [ + "rm -rf build/* && echo Cleanup done." + ] + }, + { + "taskName": "pre-build", + "isBuildCommand": true, + "suppressTaskName": true, + "args": [ + "mkdir -p build && cd build && cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt" + ] + }, + { + "taskName": "build", + "isBuildCommand": true, + "suppressTaskName": true, + "args": [ + "cd build && make widget" + ], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["absolute"], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "populate", + "suppressTaskName": true, + "args" : [ + "cd build && make widget-target-install" + ] + } + ] +} +``` + +> **NOTE** You can also add your own keybindings to trig above tasks, for example: +> ```json +> // Build +> { +> "key": "alt+f9", +> "command": "workbench.action.tasks.runTask", +> "args": "clean" +> }, +> { +> "key": "alt+f10", +> "command": "workbench.action.tasks.runTask", +> "args": "pre-build" +> }, +> { +> "key": "alt+f11", +> "command": "workbench.action.tasks.runTask", +> "args": "build" +> }, +> { +> "key": "alt+f12", +> "command": "workbench.action.tasks.runTask", +> "args": "populate" +> }, +> ``` +> +> More details about VSC keybindings [here](https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks) +> +> More details about VSC tasks [here](https://code.visualstudio.com/docs/editor/tasks) + +#### Qt Creator +Please refer to [agl-hello-qml](https://github.com/radiosound-com/agl-hello-qml#clone--build-project) project. +Thanks to Dennis for providing this useful example. + +#### Others IDE +*Coming soon...* diff --git a/docs/part-1/5_debug-first-app.md b/docs/part-1/5_debug-first-app.md new file mode 100644 index 0000000..f9f0a6e --- /dev/null +++ b/docs/part-1/5_debug-first-app.md @@ -0,0 +1,202 @@ +# Debug your first AGL application + +Debug is based on gdb and you need to use `xds-gdb` as a wrapper on gdb to cross-debug your application. +This tool allows you to debug an application built with an xds-server without the need to install gdb or any cross tool. +Two debugging models are supported: + +1. native debugging + +1. XDS remote debugging requiring an XDS server and allowing cross debug your + application. + + By default XDS remote debug is used and you need to define `XDS_NATIVE_GDB` +variable to use native gdb debug mode instead. + +> **SEE ALSO**: [xds-server](https://github.com/iotbzh/xds-server), a web server +used to remotely cross build applications. +> **SEE ALSO**: [xds-exec](https://github.com/iotbzh/xds-exec), +wrappers on `exec` command that allows to cross build your application through `xds-server`. + +## Configuration + + `xds-gdb` configuration is defined by variables (see listed below). + These variables may be set using : + +- environment variables (inherited), +- or a config file set with `XDS_CONFIG` environment variable, for example: + `XDS_CONFIG=/tmp/my_xds_gdb_config.env xds-gdb` +- or by setting variables within a gdb ini file (see details below), +- or a "user" config file located in following directory (first found is taken): + 1. $(CURRENT_DIRECTORY)/.xds-gdb.env + 1. $(CURRENT_DIRECTORY)/../xds-gdb.env + 1. $(CURRENT_DIRECTORY)/target/xds-gdb.env + 1. $(HOME)/.config/xds/xds-gdb.env + +### Configuration Variables + + `XDS_CONFIG` + Config file defining `XDS_xxx` configuration variables. Variables of this file + will overwrite inherited environment variables. Variables definition may be + prefixed or not by "export" keyword. + Here is an example of + +```bash +# for example: +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cat > $MY_PROJECT_DIR/xds-gen3.conf << EOF +export XDS_SERVER_URL=http://docker:8000 +export XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +export XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF +``` + +`XDS_LOGLEVEL` + +Set logging level (supported levels: panic, fatal, error, warn, info, debug) + +`XDS_LOGFILE` + +Set logging file, default `/tmp/xds-gdb.log`. + +`XDS_NATIVE_GDB` + +Use native gdb mode instead of remote XDS server mode. + +`XDS_PROJECT_ID` *(mandatory with XDS server mode)* + +Project ID you want to build + +`XDS_RPATH` + +Relative path into project + +`XDS_SDK_ID` *(mandatory with XDS server mode)* + +Cross Sdk ID to use to build project + +`XDS_SERVER_URL` *(mandatory with XDS server mode)* + +Remote XDS server url + +### Configuration variables set within gdb init command file + +Above `XDS_xxx` variables may also be defined within gdb init command file +(see --command or -x option of genuine Gdb). +You must respect the following syntax: commented line including `:XDS-ENV:` tag + +Example of gdb init file where we define project and sdk ID: + +```bash + # :XDS-ENV: XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject + # :XDS-ENV: XDS_SDK_ID=poky-agl_aarch64_4.0.1 +``` + +## Using xds-gdb from command line + +### XDS remote debugging mode + +First the project you want to debug must be declared on an xds-server and this +project may also has been built using this xds-server (see [xds-server](https://github.com/iotbzh/xds-server) for more details). + +So to debug it you need to know the xds-server url (eg. ), +you also need the project and sdk unique id. You can find these IDs in project +page of XDS dashboard or you can get them from command line using the `--list` +option. +This option lists all existing projects ID: + +```bash +XDS_SERVER_URL=http://docker:8000 xds-gdb --list +``` + +Now to refer your project, just set `XDS_PROJECT_ID` and `XDS_SDK_ID` variables. + +You are now ready to use `xds-gdb` to for example cross debug your project. +Here is an example to build and debug a project based on CMakefile and +[AGL app-templates](https://git.automotivelinux.org/apps/app-templates/): + +```bash +# Go into your project directory (for example helloworld-native-application) +cd ~/xds-workspace +git clone https://github.com/iotbzh/helloworld-native-application.git +cd helloworld-service + +# Declare your project on xds-server +# + +# Define XDS config +cat <./xds-config.env +XDS_SERVER_URL=http://docker:8000 +XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF + +# Tell to xds-exec and xds-gdb which is your config file +export XDS_CONFIG=../xds-gen3.conf + +# Create a new build directory +mkdir build && cd build + +# Start remote cross build +xds-exec -- cmake -DRSYNC_TARGET=root@myTarget .. +xds-exec -- make +xds-exec -- make remote-target-populate + +# Start debugging +xds-gdb -x target/gdb-on-root@myTarget.ini +``` + + +> **Note** : [helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) project is an AGL +project based on [app-templates](https://git.automotivelinux.org/apps/app-templates/) +(included as a git submodule). This CMake templating, used to develop application +with the AGL Application Framework, will automatically generate makefile rules +(eg. `remote-target-populate`) or scripts (eg. `build/target/xxx` scripts). + +For more info about app-template, please refer to [this documentation](http://docs.automotivelinux.org/docs/devguides/en/dev/reference/sdk-devkit/docs/part-2/2_4-Use-app-templates.html). + + +### Native debugging + +To enable native debugging mode, you need to define `XDS_NATIVE_GDB` variable. + +## Using xds-gdb within an IDE + +### Netbeans + +__Netbeans 8.x :__ + +- Open menu **Tools** -> **Options** + - Open **C/C++** tab, in **Build Tools** sub-tab, click on **Add** button: + + ![Add new tool panel](./pictures/nb_newtool.png) + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png) + + - Finally click on **OK** button. + +- Edit project properties (using menu **File** -> **Project Properties**) to update Debug settings: + + - Be sure that "Gen3 board" configuration is selected + + - Select **Run** category, and set: + - Run Command: `target/start-on-root@renesas-gen3.sh` + (_script name may depend of RSYNC_TARGET variable you set in pre-build command_) + - Run Directory: `build_gen3` + + - Select **Debug** category, and set: + - Debug command: `/bin/true` + - Working Directory: _empty field_ + - Gdb Init File: `target/gdb-on-root@renesas-gen3.ini` + (_script name may depend of RSYNC_TARGET variable you set in pre-build command_) + + ![Select Model panel](./pictures/nb_project_debug-1.png) + + - Click on **Apply** and then **OK** button to save settings + +You can now start debugging your application with menu **Debug** -> **Debug Project** (or **CTRL+F5** shortcut) + +### Others IDE + +*Coming soon...* diff --git a/docs/part-1/pictures/iotbzh_logo_small.png b/docs/part-1/pictures/iotbzh_logo_small.png new file mode 100644 index 0000000..6a98c60 Binary files /dev/null and b/docs/part-1/pictures/iotbzh_logo_small.png differ diff --git a/docs/part-1/pictures/nb_new-project-1.png b/docs/part-1/pictures/nb_new-project-1.png new file mode 100644 index 0000000..33d68ca Binary files /dev/null and b/docs/part-1/pictures/nb_new-project-1.png differ diff --git a/docs/part-1/pictures/nb_new-project-2.png b/docs/part-1/pictures/nb_new-project-2.png new file mode 100644 index 0000000..b0a41eb Binary files /dev/null and b/docs/part-1/pictures/nb_new-project-2.png differ diff --git a/docs/part-1/pictures/nb_new-project-3.png b/docs/part-1/pictures/nb_new-project-3.png new file mode 100644 index 0000000..051bfdd Binary files /dev/null and b/docs/part-1/pictures/nb_new-project-3.png differ diff --git a/docs/part-1/pictures/nb_newtool.png b/docs/part-1/pictures/nb_newtool.png new file mode 100644 index 0000000..ac527aa Binary files /dev/null and b/docs/part-1/pictures/nb_newtool.png differ diff --git a/docs/part-1/pictures/nb_project_debug-1.png b/docs/part-1/pictures/nb_project_debug-1.png new file mode 100644 index 0000000..7d89fc5 Binary files /dev/null and b/docs/part-1/pictures/nb_project_debug-1.png differ diff --git a/docs/part-1/pictures/nb_xds_options.png b/docs/part-1/pictures/nb_xds_options.png new file mode 100644 index 0000000..02bd3a9 Binary files /dev/null and b/docs/part-1/pictures/nb_xds_options.png differ diff --git a/docs/part-1/pictures/xds-block-diagram.png b/docs/part-1/pictures/xds-block-diagram.png new file mode 100644 index 0000000..cd11ad8 Binary files /dev/null and b/docs/part-1/pictures/xds-block-diagram.png differ diff --git a/docs/part-1/pictures/xds-conf.png b/docs/part-1/pictures/xds-conf.png new file mode 100644 index 0000000..64ba8a9 Binary files /dev/null and b/docs/part-1/pictures/xds-conf.png differ diff --git a/docs/part-1/pictures/xds-dashboard-icon-1.png b/docs/part-1/pictures/xds-dashboard-icon-1.png new file mode 100644 index 0000000..9aea05e Binary files /dev/null and b/docs/part-1/pictures/xds-dashboard-icon-1.png differ diff --git a/docs/part-1/pictures/xds-dashboard-icon-2.png b/docs/part-1/pictures/xds-dashboard-icon-2.png new file mode 100644 index 0000000..5df47b6 Binary files /dev/null and b/docs/part-1/pictures/xds-dashboard-icon-2.png differ diff --git a/docs/part-1/pictures/xds-dashboard-icon-3.png b/docs/part-1/pictures/xds-dashboard-icon-3.png new file mode 100644 index 0000000..4a642e6 Binary files /dev/null and b/docs/part-1/pictures/xds-dashboard-icon-3.png differ diff --git a/docs/part-1/pictures/xds-dashboard-prj-1.png b/docs/part-1/pictures/xds-dashboard-prj-1.png new file mode 100644 index 0000000..c675b90 Binary files /dev/null and b/docs/part-1/pictures/xds-dashboard-prj-1.png differ diff --git a/docs/part-1/pictures/xds-dashboard-prj-2.png b/docs/part-1/pictures/xds-dashboard-prj-2.png new file mode 100644 index 0000000..821b573 Binary files /dev/null and b/docs/part-1/pictures/xds-dashboard-prj-2.png differ diff --git a/docs/part-2/0_Abstract.md b/docs/part-2/0_Abstract.md new file mode 100644 index 0000000..51aa70d --- /dev/null +++ b/docs/part-2/0_Abstract.md @@ -0,0 +1,6 @@ +# Part 2 - XDS internals + +## Abstract + +This 2nd part is the "technical" documentation of all XDS pieces that allows +to fine tune XDS configuration or rebuild all XDS tools for scratch. diff --git a/docs/part-2/1_xds-server.md b/docs/part-2/1_xds-server.md new file mode 100644 index 0000000..d4ae63c --- /dev/null +++ b/docs/part-2/1_xds-server.md @@ -0,0 +1,336 @@ +# XDS - X(cross) Development System Server + +`xds-server` is a web server that allows user to remotely cross build applications. + +The first goal is to provide a multi-platform cross development tool with +near-zero installation. +The second goal is to keep application sources locally (on user's machine) to +make it compatible with existing IT policies (e.g. corporate backup or SCM), +and let user to continue to work as usual (use his favorite editor, +keep performance while editing/browsing sources). + +This powerful and portable webserver (written in [Go](https://golang.org)) +exposes a REST interface over HTTP and also provides a Web dashboard to configure projects and execute _(for now)_ only basics commands. + +`xds-server` uses [Syncthing](https://syncthing.net/) tool to synchronize +projects files from user machine to build server machine or container. + +> **NOTE**: For now, only Syncthing sharing method is supported to synchronize +projects files. But in a near future and for restricted configurations, `xds-server` +will also support "standard" folder sharing (eg. nfs mount points or docker +volumes). + +> **SEE ALSO**: [xds-exec](https://github.com/iotbzh/xds-exec), +wrappers on `exec` commands that allows you to send commands to `xds-server` +and for example build your application from command-line or from your favorite +IDE (such as Netbeans or Visual Studio Code) through `xds-server`. + +## How to run + +`xds-server` has been designed to easily compile and debug +[AGL](https://www.automotivelinux.org/) applications. That's why `xds-server` has +been integrated into AGL SDK docker container. + +>**NOTE** For more info about AGL SDK docker container, please refer to +[AGL SDK Quick Setup](http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/setup-sdk-environment.html) + +### Get the container + +Load the pre-build AGL SDK docker image including `xds-server`: + +```bash +seb@laptop ~$ wget -O - http://iot.bzh/download/public/2017/XDS/docker/docker_agl_worker-xds-latest.tar.xz | docker load +``` + +### List container + +You should get `docker.automotivelinux.org/agl/worker-xds:X.Y` image + +```bash +# List image that we just built +seb@laptop ~$ docker images | grep worker-xds + +docker.automotivelinux.org/agl/worker-xds 3.99.1 786d65b2792c 6 days ago 602MB +``` + +### Start xds-server within the container + +Use provided script to create a new docker image and start a new container: + +```bash +# Get script +seb@laptop ~$ wget https://raw.githubusercontent.com/iotbzh/xds-server/master/scripts/xds-docker-create-container.sh + +# Create new XDS worker container +seb@laptop ~$ bash ./xds-docker-create-container.sh + +# Check that new container is running +seb@laptop ~$ docker ps | grep worker-xds + +b985d81af40c docker.automotivelinux.org/agl/worker-xds:3.99.1 "/usr/bin/wait_for..." 6 days ago Up 4 hours 0.0.0.0:8000->8000/tcp, 0.0.0.0:69->69/udp, 0.0.0.0:10809->10809/tcp, 0.0.0.0:2222->22/tcp agl-xds-seb@laptop-0-seb +``` + +This container (ID=0) exposes following ports: + +- 8000 : `xds-server` to serve XDS Dashboard +- 69 : TFTP +- 2222 : ssh + +#### Manually setup docker user id + +If you plan to **use path-mapping sharing type for your projects**, you need to have the same user id and group id inside and outside docker. By default user and group name inside docker is set `devel` (id `1664`), use following commands to replace id `1664` with your user/group id: +```bash +# Set docker container name to use (usually agl-xds-xxx where xxx is USERNAME@MACHINENAME-IDX-NAME) +seb@laptop ~$ export CONTAINER_NAME=agl-xds-seb@laptop-0-seb + +# First stop xds-server +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "systemctl stop xds-server" + +# Change user and group id inside docker to match your ids +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "usermod -u $(id -u) devel" +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "groupmod -g $(id -g) devel" + +# Update some files ownership +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "chown -R devel:devel /home/devel /tmp/xds*" + +# Restart xds-server +seb@laptop ~$ docker exec ${CONTAINER_NAME} bash -c "systemctl start xds-server" +``` + +## Check if xds-server is running (open XDS Dashboard) + +**`xds-server` is automatically started** as a service on container startup. + +If the container is running on your localhost, you can access the web interface (what we call the "Dashboard"): + +```bash +seb@laptop ~$ xdg-open http://localhost:8000 +``` + +If needed you can status / stop / start it manually using following commands: + +```bash +# Log into docker container +seb@laptop ~$ ssh -p 2222 devel@localhost + +# Status XDS server: +devel@docker ~$ sudo systemctl status xds-server.service + +# Stop XDS server +devel@docker ~$ sudo systemctl stop xds-server.service + +# Start XDS server +devel@docker ~$ sudo systemctl start xds-server.service + +# Get XDS server logs +devel@docker ~$ sudo journalctl --unit=xds-server.service --output=cat +``` + +### Manually Start XDS server + +XDS server is started as a service by Systemd. + +```bash +/lib/systemd/system/xds-server.service +``` + +This Systemd service starts a bash script `/opt/AGL/xds/server/xds-server-start.sh` + +If you needed you can change default setting by defining specific environment +variables in `/etc/default/xds-server`. +For example to control log level, just set LOG_LEVEL env variable knowing that +supported *level* are: panic, fatal, error, warn, info, debug. + +```bash +seb@laptop ~$ ssh -p 2222 devel@localhost +devel@docker ~$ echo 'LOG_LEVEL=debug' | sudo tee --append /etc/default/xds-server > /dev/null +devel@docker ~$ sudo systemctl restart xds-server.service +devel@docker ~$ tail -f /tmp/xds-server/logs/xds-server.log +``` + +### Install SDK cross-toolchain + +`xds-server` uses SDK cross-toolchain installed into directory pointed by +`sdkRootDir` setting (see configuration section below for more details). +For now, you need to install manually SDK cross toolchain. There are not embedded +into docker image by default because the size of these tarballs is too big. + +Use provided `install-agl-sdks` script, for example to install SDK for ARM64 and +Intel corei7-64: + +```bash +seb@laptop ~$ ssh -p 2222 devel@localhost + +# Install ARM64 SDK (automatic download) +devel@docker ~$ sudo /opt/AGL/xds/server/xds-utils/install-agl-sdks.sh --arch aarch64 + +# Install Intel corei7-64 SDK (using an SDK tarball that has been built or downloaded manually) +devel@docker ~$ sudo /opt/AGL/xds/server/xds-utils/install-agl-sdks.sh --arch corei7-64 --file /tmp/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain- +3.99.1+snapshot.sh + +``` + +### XDS Dashboard + +`xds-server` serves a web-application at [http://localhost:8000](http://localhost:8000) +when XDS server is running on your host. Just replace `localhost` by the host +name or ip when XDS server is running on another host. So you can now connect +your browser to this url and use what we call the **XDS dashboard**. + +```bash +xdg-open http://localhost:8000 +``` + +Then follow instructions provided by this dashboard, knowing that the first time +you need to download and start `xds-agent` on your local machine. + +To download this tool, just click on download icon in dashboard configuration +page or download one of `xds-agent` released tarball: [https://github.com/iotbzh/xds-agent/releases](https://github.com/iotbzh/xds-agent/releases). + +See also `xds-agent` [README file](https://github.com/iotbzh/xds-agent) for more details. + +## Build xds-server from scratch + +### Dependencies + +- Install and setup [Go](https://golang.org/doc/install) version 1.7 or +higher to compile this tool. +- Install [npm](https://www.npmjs.com/) +- Install [gulp](http://gulpjs.com/) + +Ubuntu: + +```bash + sudo apt-get install golang npm curl git zip + sudo npm install -g gulp-cli +``` + +openSUSE: + +```bash + sudo zypper install go npm git curl zip + sudo npm install -g gulp-cli +``` + +Don't forget to open new user session after installing the packages. + +### Building + +#### Native build + +Create a GOPATH variable(must be a full path): + +```bash + export GOPATH=$(realpath ~/workspace_go) +``` + +Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile: + +```bash + mkdir -p $GOPATH/src/github.com/iotbzh + cd $GOPATH/src/github.com/iotbzh + git clone https://github.com/iotbzh/xds-server.git + cd xds-server + make all +``` + +And to install `xds-server` (by default in `/opt/AGL/xds/server`): + +```bash + make install +``` + +>**NOTE:** Used `DESTDIR` to specify another install directory +>```bash +>make install DESTDIR=$HOME/opt/xds-server +>``` + +#### XDS docker image + +As an alternative to a pre-build image, you can rebuild the container from scratch. +`xds-server` has been integrated as a flavour of AGL SDK docker image. +So to rebuild docker image just execute following commands: + +```bash +# Clone docker-worker-generator git repo +git clone https://git.automotivelinux.org/AGL/docker-worker-generator +# Start build that will create a docker image +cd docker-worker-generator +make build FLAVOUR=xds +``` + +### Configuration + +`xds-server` configuration is driven by a JSON config file (`config.json`). + +Here is the logic to determine which `config.json` file will be used: + +1. from command line option: `--config myConfig.json` +1. `$HOME/.xds-server/config.json` file +1. `/etc/xds-server/config.json` file +1. `/config.json` file + +Supported fields in configuration file are (all fields are optional and example +below corresponds to the default values): + +- **httpPort** : HTTP port of client webapp / dashboard +- **webAppDir** : location of client dashboard (default: webapp/dist) +- **shareRootDir** : root directory where projects will be copied +- **logsDir** : directory to store logs (eg. syncthing output) +- **sdkRootDir** : root directory where cross SDKs are installed +- **syncthing.binDir** : syncthing binaries directory (default: executable directory) +- **syncthing.home"** : syncthing home directory (usually .../syncthing-config) +- **syncthing.gui-address** : syncthing gui url (default http://localhost:8384) +- **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated) + +```json +{ + "httpPort": 8000, + "webAppDir": "webapp/dist", + "shareRootDir": "${HOME}/.xds-server/projects", + "logsDir": "/tmp/logs", + "sdkRootDir": "/xdt/sdk", + "syncthing": { + "binDir": "./bin", + "home": "${HOME}/.xds-server/syncthing-config", + "gui-address": "http://localhost:8384", + "gui-apikey": "123456789", + } +} +``` + +>**NOTE:** environment variables are supported by using `${MY_VAR}` syntax. + +## Debugging + +### XDS server architecture + +The server part is written in *Go* and web app / dashboard (client part) in +*Angular2*. + +``` +| ++-- bin/ where xds-server binary file will be built +| ++-- agent-config.json.in example of config.json file +| ++-- glide.yaml Go package dependency file +| ++-- lib/ sources of server part (Go) +| ++-- main.go main entry point of of Web server (Go) +| ++-- Makefile makefile including +| ++-- README.md this readme +| ++-- scripts/ hold various scripts used for installation or startup +| ++-- tools/ temporary directory to hold development tools (like glide) +| ++-- vendor/ temporary directory to hold Go dependencies packages +| ++-- webapp/ source client dashboard (Angular2 app) +``` + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. diff --git a/docs/part-2/2_xds-agent.md b/docs/part-2/2_xds-agent.md new file mode 100644 index 0000000..eac157a --- /dev/null +++ b/docs/part-2/2_xds-agent.md @@ -0,0 +1,166 @@ +# XDS - X(cross) Development System Agent + +XDS-agent is a client that should run on your local / user development machine when you use XDS. + +This agent takes care, among others, of starting [Syncthing](https://syncthing.net/) +tool to synchronize your project files from your local host to XDS build server +machine or container (where `xds-server` is running). + +> **SEE ALSO**: [xds-server](https://github.com/iotbzh/xds-server), a web server +used to remotely cross build applications. + +## How to install xds-agent + +### Install package for debian distro type + +```bash +export DISTRO="Debian_8.0" +wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add - +sudo bash -c "cat >> /etc/apt/sources.list.d/AGL.list</agent-config.json` file + +Supported fields in configuration file are (all fields are optional and example +below corresponds to the default values): + +- **httpPort** : http port of agent REST interface +- **logsDir** : directory to store logs (eg. syncthing output) +- **xds-apikey** : xds-agent api-key to use (always set value to "1234abcezam") +- **syncthing.binDir** : syncthing binaries directory (default: executable directory) +- **syncthing.home"** : syncthing home directory (usually .../syncthing-config) +- **syncthing.gui-address** : syncthing gui url (default http://localhost:8384) +- **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated) + +```json +{ + "httpPort": "8010", + "logsDir": "/tmp/logs", + "xds-apikey": "1234abcezam", + "syncthing": { + "binDir": ".", + "home": "${HOME}/.xds/agent/syncthing-config", + "gui-address": "http://localhost:8384", + "gui-apikey": "1234abcezam", + } +} +``` + +>**NOTE:** environment variables are supported by using `${MY_VAR}` syntax. + +## Start-up + +Simply to start `xds-agent` executable + +```bash +./xds-agent & +``` + +>**NOTE** if need be, you can increase log level by setting option +`--log `, supported *level* are: panic, fatal, error, warn, info, debug. + +You can now use XDS dashboard and check that connection with `xds-agent` is up. +(see also [xds-server README](https://github.com/iotbzh/xds-server/blob/master/README.md#xds-dashboard)) + +## Build xds-agent from scratch + +### Dependencies + +Install and setup [Go](https://golang.org/doc/install) version 1.8 or +higher to compile this tool. + +### Building + +Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile: + +```bash + mkdir -p $GOPATH/src/github.com/iotbzh + cd $GOPATH/src/github.com/iotbzh + git clone https://github.com/iotbzh/xds-agent.git + cd xds-agent + make all +``` + +And to install xds-agent (by default in `/usr/local/bin`): + +```bash +make install +``` + +>**NOTE:** Used `DESTDIR` to specify another install directory +>```bash +>make install DESTDIR=$HOME/opt/xds-agent +>``` + +#### Cross build + +For example on a Linux machine to cross-build for Windows, just execute: + +```bash +export GOOS=windows +export GOARCH=amd64 +make all +make package +``` diff --git a/docs/part-2/3_xds-exec.md b/docs/part-2/3_xds-exec.md new file mode 100644 index 0000000..7899ba9 --- /dev/null +++ b/docs/part-2/3_xds-exec.md @@ -0,0 +1,296 @@ +# xds-exec: wrapper on exec for XDS + +`xds-exec` is a wrapper on exec linux command for X(cross) Development System. + +As well as `xds-exec` is a wrapper on exec command and can be use to execute any +command on a remote `xds-server`. + +This tool can be used in lieu of "standard" `exec` command to execute any +command on a remote `xds-server`. For example you can trig your project build by +executing : `xds-exec --config conf.env -- make build` + +> **SEE ALSO**: +> - [xds-agent](https://github.com/iotbzh/xds-agent), an agent that should run +on your local host in order to use XDS. +> - [xds-server](https://github.com/iotbzh/xds-server), a web server +used to remotely cross build applications. + +## Getting Started + +You must have a running `xds-server` (locally or on the Cloud), see +[README of xds-server](https://github.com/iotbzh/xds-server/blob/master/README.md) +for more details. + +Connect your favorite Web browser to the XDS dashboard (default url +http://localhost:8000) and follow instructions to start local `xds-agent` on +your local host. Please refer to instructions provided by XDS dashboard or see +`README of xds-agent`. + +Then create your project you XDS dashboard. + +### Installing xds-exec + +#### Install package for debian distro type + +```bash +export DISTRO="Debian_8.0" +wget -O - http://download.opensuse.org/repositories/isv:/LinuxAutomotive:/app-Development/${DISTRO}/Release.key | sudo apt-key add - +sudo bash -c "cat >> /etc/apt/sources.list.d/AGL.list < config.env << EOF + export XDS_SERVER_URL=localhost:8000 + export XDS_PROJECT_ID=CKI7R47-UWNDQC3_myProject + export XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF + +xds-exec --config config.env -- mkdir build + +# Or sourcing env file +source config.env +xds-exec -- cd build && cmake .. +xds-exec -- cd build && make all +``` + +### Using xds-exec within an IDE + +#### Visual Studio Code + +Open your project in VSC + +```bash +cd $MY_PROJECT_DIR +code . & +``` +Add new tasks : press `Ctrl+Shift+P` and select the `Tasks: Configure Task Runner` command and you will see a list of task runner templates. + +And define your own tasks, here is an example to build [unicens2-binding](https://github.com/iotbzh/unicens2-binding) AGL binding based on cmake (_options value of args array must be updated regarding your settings_): + +```json +{ + "version": "0.1.0", + "linux": { + "command": "/opt/AGL/agl-xds-exec/xds-exec" + }, + "isShellCommand": true, + "args": [ + "-url", "localhost:8010", + "-id", "W2EAQBA-HQI75XA_unicens2-binding", + "-sdkid", "poky-agl_aarch64_4.0.1", + "--" + ], + "showOutput": "always", + "tasks": [{ + "taskName": "clean", + "suppressTaskName": true, + "args": [ + "rm -rf build/* && echo Cleanup done." + ] + }, + { + "taskName": "pre-build", + "isBuildCommand": true, + "suppressTaskName": true, + "args": [ + "mkdir -p build && cd build && cmake -DRSYNC_TARGET=root@192.168.168.11 -DRSYNC_PREFIX=./opt" + ] + }, + { + "taskName": "build", + "isBuildCommand": true, + "suppressTaskName": true, + "args": [ + "cd build && make widget" + ], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["absolute"], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "populate", + "suppressTaskName": true, + "args" : [ + "cd build && make widget-target-install" + ] + } + ] +} +``` + +> **NOTE** You can also add your own keybindings to trig above tasks, for example: +> ```json +> // Build +> { +> "key": "alt+f9", +> "command": "workbench.action.tasks.runTask", +> "args": "clean" +> }, +> { +> "key": "alt+f10", +> "command": "workbench.action.tasks.runTask", +> "args": "pre-build" +> }, +> { +> "key": "alt+f11", +> "command": "workbench.action.tasks.runTask", +> "args": "build" +> }, +> { +> "key": "alt+f12", +> "command": "workbench.action.tasks.runTask", +> "args": "populate" +> }, +> ``` +> +> More details about VSC keybindings [here](https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks) +> +> More details about VSC tasks [here](https://code.visualstudio.com/docs/editor/tasks) + +#### Qt Creator +Please refer to [agl-hello-qml](https://github.com/radiosound-com/agl-hello-qml#clone--build-project) project. +Thanks to Dennis for providing this useful example. + +#### Others IDE +*Coming soon...* + + +## How to build + +### Prerequisites + You must install and setup [Go](https://golang.org/doc/install) version 1.7 or + higher to compile this tool. + +### Building +Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile: +```bash + export GOPATH=$(realpath ~/workspace_go) + mkdir -p $GOPATH/src/github.com/iotbzh + cd $GOPATH/src/github.com/iotbzh + git clone https://github.com/iotbzh/xds-exec.git + cd xds-exec + make +``` + +## Debug + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. + +>**Tricks:** To debug both `xds-exec` (client part) and `xds-server` (server part), +it may be useful use the same local sources. +So you should replace `xds-server` in `vendor` directory by a symlink. +So clone first `xds-server` sources next to `xds-exec` directory. +You should have the following tree: +``` +> tree -L 3 src +src +|-- github.com + |-- iotbzh + |-- xds-exec + |-- xds-server +``` +Then invoke `vendor/debug` Makefile rule to create a symlink inside vendor +directory : +```bash +cd src/github.com/iotbzh/xds-exec +make vendor/debug +``` diff --git a/docs/part-2/4_xds-gdb.md b/docs/part-2/4_xds-gdb.md new file mode 100644 index 0000000..5fe0ab9 --- /dev/null +++ b/docs/part-2/4_xds-gdb.md @@ -0,0 +1,201 @@ +# xds-gdb: wrapper on gdb for XDS + +`xds-gdb` is a wrapper on gdb debugger for X(cross) Development System. + +This tool allows you to debug an application built with an xds-server without +the need to install gdb or any cross tool. + +Two debugging models are supported: + +1. native debugging + +1. XDS remote debugging requiring an XDS server and allowing cross debug your + application. + + + By default XDS remote debug is used and you need to define `XDS_NATIVE_GDB` +variable to use native gdb debug mode instead. + +> **SEE ALSO**: [xds-server](https://github.com/iotbzh/xds-server), a web server +used to remotely cross build applications. +> **SEE ALSO**: [xds-exec](https://github.com/iotbzh/xds-exec), +wrappers on `exec` command that allows to cross build your application through `xds-server`. + +## Getting Started + +## Installing xds-gdb + +Download latest `xds-gdb` release on [https://github.com/iotbzh/xds-gdb/releases](https://github.com/iotbzh/xds-gdb/releases). + +Extract the tarball anywhere you want, for example: + +```bash +mkdir -p ~/opt/bin +unzip -j $DOWNLOAD_DIR/xds-gdb_linux-amd64-v1.0.0.zip xds-gdb/xds-gdb ~/opt/bin +``` + +## Configuration + + `xds-gdb` configuration is defined by variables (see listed below). + These variables may be set using : + +- environment variables (inherited), +- or a config file set with `XDS_CONFIG` environment variable, for example: + `XDS_CONFIG=/tmp/my_xds_gdb_config.env xds-gdb` +- or by setting variables within a gdb ini file (see details below), +- or a "user" config file located in following directory (first found is taken): + 1. $(CURRENT_DIRECTORY)/.xds-gdb.env + 1. $(CURRENT_DIRECTORY)/../xds-gdb.env + 1. $(CURRENT_DIRECTORY)/target/xds-gdb.env + 1. $(HOME)/.config/xds/xds-gdb.env + +### Configuration Variables + + `XDS_CONFIG` : + Config file defining `XDS_xxx` configuration variables. Variables of this file + will overwrite inherited environment variables. Variables definition may be + prefixed or not by "export" keyword. + Here is an example of + +```bash +cat $HOME/myProject/xds-gdb.env + +export XDS_SERVER_URL=http://xds-docker:8000 +export XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +export XDS_SDK_ID=poky-agl_aarch64_4.0.1 +``` + +`XDS_LOGLEVEL` : +Set logging level (supported levels: panic, fatal, error, warn, info, debug) + +`XDS_LOGFILE` : +Set logging file, default `/tmp/xds-gdb.log`. + +`XDS_NATIVE_GDB` : +Use native gdb mode instead of remote XDS server mode. + +`XDS_PROJECT_ID` : *(mandatory with XDS server mode)* +Project ID you want to build + +`XDS_RPATH` : +Relative path into project + +`XDS_SDK_ID` : *(mandatory with XDS server mode)* +Cross Sdk ID to use to build project + +`XDS_SERVER_URL` : *(mandatory with XDS server mode)* +Remote XDS server url + +### Configuration variables set within gdb init command file + +Above `XDS_xxx` variables may also be defined within gdb init command file +(see --command or -x option of genuine Gdb). +You must respect the following syntax: commented line including `:XDS-ENV:` tag + +Example of gdb init file where we define project and sdk ID: + +```bash + # :XDS-ENV: XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject + # :XDS-ENV: XDS_SDK_ID=poky-agl_aarch64_4.0.1 +``` + +## Using xds-gdb from command line + +### XDS remote debugging mode + +First the project you want to debug must be declared on an xds-server and this +project may also has been built using this xds-server (see [xds-server](https://github.com/iotbzh/xds-server) for more details). + +So to debug it you need to know the xds-server url (eg. ), +you also need the project and sdk unique id. You can find these IDs in project +page of XDS dashboard or you can get them from command line using the `--list` +option. +This option lists all existing projects ID: + +```bash +XDS_SERVER_URL=http://xds-docker:8000 xds-gdb --list +``` + +Now to refer your project, just set `XDS_PROJECT_ID` and `XDS_SDK_ID` variables. + +You are now ready to use `xds-gdb` to for example cross debug your project. +Here is an example to build and debug a project based on CMakefile and +[AGL app-templates](https://git.automotivelinux.org/apps/app-templates/): + +```bash +# Go into your project directory (for example helloworld-service) +git clone https://github.com/iotbzh/helloworld-service.git +cd helloworld-service + +# Declare your project on xds-server +# + +# Define XDS config +cat <./xds-config.env +XDS_SERVER_URL=http://xds-docker:8000 +XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF + +# Tell to xds-exec and xds-gdb which is your config file +export XDS_CONFIG=../xds-config.env + +# Create a new build directory +mkdir build && cd build + +# Start remote cross build +xds-exec -- cmake .. +xds-exec -- make +xds-exec -- make remote-target-populate + +# Start debugging +xds-gdb -x target/gdb-on-root@myTarget.ini +``` + +> **Notes** : [Helloworld-service project](https://github.com/iotbzh/helloworld-service) +is an AGL project based on app-templates that can be build and debug using XDS. + +### Native debugging + +To enable native debugging mode, you need to define `XDS_NATIVE_GDB` variable. + +## Using xds-gdb within an IDE + +### Netbeans + +__Netbeans 8.x :__ +Open menu Tools -> Options +Then open C/C++ tab, in "Build Tools" sub-tab, click on "Add" button: +![Add new tool panel](./docs/images/nb_newtool.jpg) + +Then, you should set *Debugger Command* to point to xds-gdb + +![Add new tool panel](./docs/images/nb_xds_options.jpg) + +### Others IDE + +*Coming soon...* + +## How to build xds-gdb from scratch + +### Prerequisites + + You must install and setup [Go](https://golang.org/doc/install) version 1.7 or + higher to compile this tool. + +### Building + +Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Makefile: + +```bash + export GOPATH=$(realpath ~/workspace_go) + mkdir -p $GOPATH/src/github.com/iotbzh + cd $GOPATH/src/github.com/iotbzh + git clone https://github.com/iotbzh/xds-gdb.git + cd xds-gdb + make +``` + +## Debug + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. diff --git a/docs/part-2/pictures/.gitkeep b/docs/part-2/pictures/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/resources/cover.svg b/docs/resources/cover.svg new file mode 100644 index 0000000..6726de7 --- /dev/null +++ b/docs/resources/cover.svg @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + {title} + + {subtitle} + + {version} {date} + diff --git a/docs/resources/ebook.css b/docs/resources/ebook.css new file mode 100644 index 0000000..39f126c --- /dev/null +++ b/docs/resources/ebook.css @@ -0,0 +1,386 @@ +/* IoT.Bzh theaming */ + +h1 { + color: #330066; + border-bottom: 2px solid #330066; +} + +h2 { + color: #330066; +} + +h3 { + color: #330066; +} + +h4 { + color: #330066; +} + + +/* GENERAL ELEMENTS */ + +/* clear both */ + +.clear { + clear: both; +} + +.section> :last-child { + margin-bottom: 0 !important; +} + +.section> :first-child { + margin-top: 0 !important; +} + + +/* SPECIAL ELEMENTS */ + + +/* page break always after element on pdf/print definition */ + +div.pagebreak { + page-break-after: always; +} + + +/* no page break inside element on pdf/print definition */ + +div.nopb { + page-break-inside: avoid !important; + margin: 4px 0 4px 0; +} + + +/* note blocks */ + +div.note { + background: #FCF8E3 none repeat scroll 0% 0%; + color: #8A6D3B; + padding: 15px; + margin-bottom: 10px; + border-bottom: 5px solid #DDD; + border-color: #FAEBCC; + page-break-inside: avoid; +} + +div.note p { + padding-bottom: 0; + margin-bottom: 0; +} + + +/* images, figures and captions */ + +p img { + /* center all images */ + display: block; + margin: 0 auto; + padding: 10px 0; +} + +figure { + margin: 1.0em 0px; + padding: 10px 0; + text-align: center; + page-break-inside: avoid; + display: block; +} + +figure img { + display: block; + margin: 0 auto; +} + +figcaption { + clear: left; + margin: 1.0em 0 0 0; + text-align: center; + font-style: italic; + line-height: 1.5em; + font-size: 80%; + color: #666; + display: block; +} + +.page .section p img { + margin-top: 10px; +} + + +/* ul, ol list margin fix */ + +.page .section ol, +.page .section ul { + margin-bottom: 10px; +} + + +/* blockquotes */ + +.page .section blockquote { + margin: 0 0 0 5%; + font-style: italic; +} + + +/* PAGE SPECIFIC */ + + +/* set summary page to right side of the paper */ + +.page .toc h1 { + page-break-before: right; +} + +.page .section.toc { + page-break-inside: always; +} + +/* table headers */ + +div#README\.md table { + margin-top: 30px; + font-size: 95%; +} + +div#README\.md table thead { + display: none; +} + + + +/* CITATION AND IMAGES */ + + +/* math image styles */ + +.page .section p img.svg, +.page .section p img.png { + margin-top: 0px; + margin-bottom: -2px; +} + +.page .section p img.math { + vertical-align: middle; + height: auto; + width: auto; + margin-top: -4px; + max-height: 15px; +} + +.page .section p img.math.line1 { + margin-top: -7px; + max-height: 19px; +} + +.page .section p img.math.line2 { + margin-top: -1px; + max-height: 30px; +} + + +/* credits page */ + +.page .section ul.pictures { + margin-left: -30px; +} + +.page .section ul.pictures li { + list-style: outside none none; +} + +.page .section ul.pictures li a { + float: left; +} + +.page .section ul.pictures li span { + display: block; + margin-left: 100px; +} + + + +/* sub and super script */ + +.page .section sub { + font-size: 80%; + margin-left: 1px; +} + + +/* citations and references */ + +.page .section sup { + margin-left: -1px; + margin-right: 2px; + font-size: 80%; +} + +.page .section sup:before { + content: " "; +} + +.page .section ul.citations, +.page .section ul.references { + margin-left: -30px; +} + + +.page .section ul.citations li:nth-child(1) { + margin-top: 20px; + padding-top: 20px; + border-top: 1px solid #BBB; +} + +.page .section ul.citations li, +.page .section ul.references li { + list-style: outside none none; +} + +.page .section ul.citations li { + font-size: 80%; +} + +.page .section ul.citations li>span:nth-child(1), +.page .section ul.references li>span:nth-child(1) { + display: block; + float: left; + text-align: left; + width: 70px +} + +.page .section ul.citations li>span:nth-child(1) { + width: 50px +} + +.page .section ul.references li div { + margin-left: 70px; +} + +.page .section ul.citations li div { + margin-left: 50px; +} + +.page .section a[href="#"], +.page .section a[href="#"]:link, +.page .section a[href="#"]:visited, +.page .section a[href="#"]:hover, +.page .section a[href="#"]:focus { + text-decoration: none; + color: inherit; + cursor: text; + font-style: italic; +} + + +/* self referential footnotes */ + +.page .section div[type="selfref"] a[href="#"], +.page .section div[type="selfref"] a[href="#"]:link, +.page .section div[type="selfref"] a[href="#"]:visited, +.page .section div[type="selfref"] a[href="#"]:hover, +.page .section div[type="selfref"] a[href="#"]:focus { + font-style: normal; +} + +.page .section div[type="selfref"] span:nth-child(1) { + display: none; +} + + +/* page break always after element on pdf/print definition */ + +div.page-break { + page-break-inside: always; +} + +div.page-break:before { + content: ' '; +} + + +/* no page break inside element on pdf/print definition */ + +div.nopb { + page-break-inside: avoid; +} + +/* justify text */ +p { + text-align: justify; +} + +/* page header and footer */ + +.pdf-footer, +.pdf-header { + margin-top: 20px; + color: #aaa; +} + +.pdf-header .header-left { + float: left; + margin-left: 2em; + margin-right: auto; +} + +.pdf-header .header-right { + display: table; + margin-left: auto; + margin-right: 2em; +} + +.pdf-footer .sub { + padding-top: 8px; + font-size: 70%; +} + +.pdf-header .sub { + padding-top: 2px; + font-size: 70%; +} + +.pdf-footer { + padding-top: 10px; + border-top: 1px solid #eee; +} + +.pdf-footer .footer-left { + float: left; + margin-left: 2em; + margin-right: auto; +} + +.pdf-footer .footer-center { + display: table; + margin-left: auto; + margin-right: auto; +} + +.pdf-footer .footer-right { + float: right; + margin-left: auto; + margin-right: 2em; +} + +.pdf-header { + padding-bottom: 10px; + border-bottom: 1px solid #eee; +} + +.pdf-header .header-pages-count { + float: right; + text-align: right; +} + +.pdf-header .header-pages-count a, +.pdf-header .header-pages-count a:visited, +.pdf-header .header-pages-count a:active, +.pdf-header .header-pages-count a:focus, +.pdf-header .header-pages-count a:link { + text-decoration: none; + color: #aaa; + cursor: text; +} diff --git a/docs/resources/make_cover.sh b/docs/resources/make_cover.sh new file mode 100755 index 0000000..1026ecb --- /dev/null +++ b/docs/resources/make_cover.sh @@ -0,0 +1,27 @@ +#!/bin/bash +DOCS_DIR=$(cd $(dirname $0)/.. && pwd) +BOOKFILE=$DOCS_DIR/../book.json + +TITLE=$(grep '"title":' $BOOKFILE | cut -d'"' -f 4) +SUBTITLE=$(grep '"subtitle":' $BOOKFILE | cut -d'"' -f 4) +VERSION="Version $(grep '"version":' $BOOKFILE | cut -d'"' -f 4)" +DATE=$(grep '"published":' $BOOKFILE | cut -d'"' -f 4) + +[ -z "$TITLE" ] && { echo "Error TITLE not set!" ; exit 1; } +[ -z "$VERSION" ] && { echo "Error VERSION not set!" ; exit 1; } +[ -z "$DATE" ] && { echo "Error DATE not set!" ; exit 1; } + + +cat $(dirname $0)/cover.svg | sed -e "s/{title}/$TITLE/g" \ + -e "s/font-size:87.5px/font-size:54px/g" \ + -e "s/{subtitle}/$SUBTITLE/g" \ + -e "s/font-size:62.5px/font-size:40px/g" \ + -e "s/{version}/$VERSION/g" \ + -e "s/{date}/$DATE/g" \ + > /tmp/cover.svg + +# use imagemagick convert tool (cover size must be 1800x2360) +convert -resize "1600x2160!" -border 100 -bordercolor white -background white \ + -flatten -quality 100 /tmp/cover.svg $DOCS_DIR/cover.jpg + +convert -resize "200x262!" $DOCS_DIR/cover.jpg $DOCS_DIR/cover_small.jpg -- cgit 1.2.3-korg