From bd814eafac20a5264782bad69ce2df1599921c68 Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Thu, 18 Jan 2018 09:44:34 +0100 Subject: Split markdown files to have a detailed TOC/summary. Change-Id: I7d578335ba0d1719030bc2efc6518da17a6150dc Signed-off-by: Sebastien Douheret --- book.json | 2 +- docs/0-Doc-Revisions.md | 3 +- docs/SUMMARY.md | 35 +- docs/cover.jpg | Bin 289362 -> 288540 bytes docs/cover_small.jpg | Bin 18768 -> 18769 bytes docs/part-1/1_install-client.md | 14 +- docs/part-1/2-1_install-xds-server-docker.md | 152 +++++++++ docs/part-1/2-2_install-xds-server-vm.md | 82 +++++ docs/part-1/2-3_install-xds-server-native.md | 72 +++++ docs/part-1/2_install-xds-server.md | 316 +----------------- docs/part-1/3_install-sdks.md | 2 +- docs/part-1/4-1_build-first-app-setup.md | 26 ++ docs/part-1/4-2_build-first-app-cmd.md | 117 +++++++ docs/part-1/4-3_build-first-app-dashboard.md | 47 +++ docs/part-1/4-4_build-first-app-ide.md | 187 +++++++++++ docs/part-1/4_build-first-app.md | 384 +--------------------- docs/part-1/5-1_debug-first-app-config.md | 76 +++++ docs/part-1/5-2_debug-first-app-cmd.md | 69 ++++ docs/part-1/5-3_debug-first-app-ide.md | 44 +++ docs/part-1/5_debug-first-app.md | 191 +---------- docs/part-2/0_Abstract.md | 45 --- docs/part-2/1_Prerequisites.md | 44 +++ docs/part-2/1_xds-server.md | 468 --------------------------- docs/part-2/1_xds-server/0_abstract.md | 41 +++ docs/part-2/1_xds-server/1_config.md | 86 +++++ docs/part-2/1_xds-server/2_how-to-run.md | 238 ++++++++++++++ docs/part-2/1_xds-server/3_build.md | 73 +++++ docs/part-2/1_xds-server/4_debug.md | 36 +++ docs/part-2/2_xds-agent.md | 201 ------------ docs/part-2/2_xds-agent/0_abstract.md | 19 ++ docs/part-2/2_xds-agent/1_config.md | 47 +++ docs/part-2/2_xds-agent/2_start.md | 14 + docs/part-2/2_xds-agent/3_build.md | 58 ++++ docs/part-2/2_xds-agent/4_debug.md | 69 ++++ docs/part-2/3_xds-cli.md | 233 ------------- docs/part-2/3_xds-cli/0_abstract.md | 15 + docs/part-2/3_xds-cli/1_config.md | 57 ++++ docs/part-2/3_xds-cli/2_commands.md | 119 +++++++ docs/part-2/3_xds-cli/3_build.md | 21 ++ docs/part-2/3_xds-cli/4_debug.md | 38 +++ docs/part-2/4_xds-gdb.md | 133 -------- docs/part-2/4_xds-gdb/0_abstract.md | 24 ++ docs/part-2/4_xds-gdb/1_config.md | 86 +++++ docs/part-2/4_xds-gdb/2_build.md | 21 ++ docs/part-2/4_xds-gdb/3_debug.md | 3 + docs/part-2/5_xds-exec.md | 5 - 46 files changed, 2043 insertions(+), 1970 deletions(-) create mode 100644 docs/part-1/2-1_install-xds-server-docker.md create mode 100644 docs/part-1/2-2_install-xds-server-vm.md create mode 100644 docs/part-1/2-3_install-xds-server-native.md create mode 100644 docs/part-1/4-1_build-first-app-setup.md create mode 100644 docs/part-1/4-2_build-first-app-cmd.md create mode 100644 docs/part-1/4-3_build-first-app-dashboard.md create mode 100644 docs/part-1/4-4_build-first-app-ide.md create mode 100644 docs/part-1/5-1_debug-first-app-config.md create mode 100644 docs/part-1/5-2_debug-first-app-cmd.md create mode 100644 docs/part-1/5-3_debug-first-app-ide.md create mode 100644 docs/part-2/1_Prerequisites.md delete mode 100644 docs/part-2/1_xds-server.md create mode 100644 docs/part-2/1_xds-server/0_abstract.md create mode 100644 docs/part-2/1_xds-server/1_config.md create mode 100644 docs/part-2/1_xds-server/2_how-to-run.md create mode 100644 docs/part-2/1_xds-server/3_build.md create mode 100644 docs/part-2/1_xds-server/4_debug.md delete mode 100644 docs/part-2/2_xds-agent.md create mode 100644 docs/part-2/2_xds-agent/0_abstract.md create mode 100644 docs/part-2/2_xds-agent/1_config.md create mode 100644 docs/part-2/2_xds-agent/2_start.md create mode 100644 docs/part-2/2_xds-agent/3_build.md create mode 100644 docs/part-2/2_xds-agent/4_debug.md delete mode 100644 docs/part-2/3_xds-cli.md create mode 100644 docs/part-2/3_xds-cli/0_abstract.md create mode 100644 docs/part-2/3_xds-cli/1_config.md create mode 100644 docs/part-2/3_xds-cli/2_commands.md create mode 100644 docs/part-2/3_xds-cli/3_build.md create mode 100644 docs/part-2/3_xds-cli/4_debug.md delete mode 100644 docs/part-2/4_xds-gdb.md create mode 100644 docs/part-2/4_xds-gdb/0_abstract.md create mode 100644 docs/part-2/4_xds-gdb/1_config.md create mode 100644 docs/part-2/4_xds-gdb/2_build.md create mode 100644 docs/part-2/4_xds-gdb/3_debug.md delete mode 100644 docs/part-2/5_xds-exec.md diff --git a/book.json b/book.json index 156a120..bca8e4b 100644 --- a/book.json +++ b/book.json @@ -6,7 +6,7 @@ "author": "Sebastien Douheret", "website": "http://iot.bzh", "published": "January 2018", - "version": "1.0.0", + "version": "1.0.1", "gitbook": "3.2.2", "root": "docs", diff --git a/docs/0-Doc-Revisions.md b/docs/0-Doc-Revisions.md index cdd8941..9c31870 100644 --- a/docs/0-Doc-Revisions.md +++ b/docs/0-Doc-Revisions.md @@ -6,4 +6,5 @@ Document revisions | Sept 2017 | 0.1 | Initial release | S. Douheret [ Iot.bzh ] | | Oct 2017 | 0.2 | Various updates to match new behavior | S. Douheret [ Iot.bzh ] | | Nov 2017 | 1.0.0-rc1 | Updates to match v1.0.0-rc1 behavior | S. Douheret [ Iot.bzh ] | -| Jan 2018 | 1.0.0 | Add VM appliance and document new SDK management | S. Douheret, R. Le Martret [ Iot.bzh ] | +| Jan 2018 | 1.0.0 | Add VM appliance and document
new SDK management | S. Douheret, R. Le Martret
[ Iot.bzh ] | +| Jan 2018 | 1.0.1 | Removed duplicated parts and
split in subchapters | S. Douheret, R. Le Martret
[ Iot.bzh ] | diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 1d8e43b..9b40ce3 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -5,13 +5,38 @@ * [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) + * [Based on Docker container](part-1/2-1_install-xds-server-docker.md) + * [Based on Virtual Machine appliance](part-1/2-2_install-xds-server-vm.md) + * [Native installation](part-1/2-3_install-xds-server-native.md) * [Installing AGL SDKs](part-1/3_install-sdks.md) * [Create your first AGL application](part-1/4_build-first-app.md) + * [Setup](part-1/4-1_build-first-app-setup.md) + * [Build using command line tool](part-1/4-2_build-first-app-cmd.md) + * [Build using XDS Dashboard](part-1/4-3_build-first-app-dashboard.md) + * [Build using a source code editor / IDE](part-1/4-4_build-first-app-ide.md) * [Debug your first AGL application](part-1/5_debug-first-app.md) + * [Configuration](part-1/5-1_debug-first-app-config.md) + * [xds-gdb from command line](part-1/5-2_debug-first-app-cmd.md) + * [xds-gdb within an IDE](part-1/5-3_debug-first-app-ide.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-cli](part-2/3_xds-cli.md) - * [xds-gdb](part-2/4_xds-gdb.md) - * [xds-exec](part-2/5_xds-exec.md) + * [Prerequisites](part-2/1_Prerequisites.md) + * [XDS-server](part-2/1_xds-server/0_abstract.md) + * [Configuration](part-2/1_xds-server/1_config.md) + * [How to run](part-2/1_xds-server/2_how-to-run.md) + * [Build from scratch](part-2/1_xds-server/3_build.md) + * [Debugging](part-2/1_xds-server/4_debug.md) + * [XDS-agent](part-2/2_xds-agent/0_abstract.md) + * [Configuration](part-2/2_xds-agent/1_config.md) + * [Start](part-2/2_xds-agent/2_start.md) + * [Build from scratch](part-2/2_xds-agent/3_build.md) + * [Debugging](part-2/2_xds-agent/4_debug.md) + * [XDS-cli](part-2/3_xds-cli/0_abstract.md) + * [Configuration](part-2/3_xds-cli/1_config.md) + * [CLI Commands](part-2/3_xds-cli/2_commands.md) + * [Build from scratch](part-2/3_xds-cli/3_build.md) + * [Debugging](part-2/3_xds-cli/4_debug.md) + * [XDS-gdb](part-2/4_xds-gdb/0_abstract.md) + * [Configuration](part-2/4_xds-gdb/1_config.md) + * [Build from scratch](part-2/4_xds-gdb/2_build.md) + * [Debugging](part-2/4_xds-gdb/3_debug.md) diff --git a/docs/cover.jpg b/docs/cover.jpg index e106be5..7b8af55 100644 Binary files a/docs/cover.jpg and b/docs/cover.jpg differ diff --git a/docs/cover_small.jpg b/docs/cover_small.jpg index d75bddd..328b180 100644 Binary files a/docs/cover_small.jpg and b/docs/cover_small.jpg differ diff --git a/docs/part-1/1_install-client.md b/docs/part-1/1_install-client.md index 255401d..2e26c7c 100644 --- a/docs/part-1/1_install-client.md +++ b/docs/part-1/1_install-client.md @@ -75,7 +75,7 @@ sudo zypper install agl-xds-gdb XDS-agent is a client tool that must run on your local / user development machine when you use XDS. -For Linux distro, a user systemd service is provided, `xds-agent.service`. +For **Linux** distro, a user systemd service is provided, `xds-agent.service`. To start it automatically at boot and you can enable it using following commands: @@ -93,3 +93,15 @@ systemctl --user start xds-agent.service # Get status and log of xds-agent service systemctl --user status xds-agent.service ``` + +On **MacOS** (or Linux), you can start-it manually using following commands: + +```batch +/opt/AGL/bin/xds-agent +``` + +On **Windows**, you can start-it manually using following commands: + +```batch +C:\AGL\xds\xds-agent\xds-agent.exe +``` diff --git a/docs/part-1/2-1_install-xds-server-docker.md b/docs/part-1/2-1_install-xds-server-docker.md new file mode 100644 index 0000000..85d9340 --- /dev/null +++ b/docs/part-1/2-1_install-xds-server-docker.md @@ -0,0 +1,152 @@ +# Installation based on Docker container + +## 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 +wget -O - http://iot.bzh/download/public/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 +docker images "docker.automotivelinux.org/agl/worker-xds*" + +REPOSITORY TAG IMAGE ID CREATED SIZE +docker.automotivelinux.org/agl/worker-xds 5.0 877979e534ff 3 hours ago 106MB +``` + +## Create and start a new container + +Use provided script to create a new docker image and start a new container: + +```bash +# Get script +wget -O xds-docker-create-container.sh 'https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git;a=blob_plain;f=scripts/xds-docker-create-container.sh;hb=master' + +# Create new XDS worker container +bash ./xds-docker-create-container.sh + +# Check that new container is running +docker ps | grep worker-xds +f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 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-HOSTNAME-0-USERNAME +``` + +This container exposes following ports: + +| Port number | Description | +|-------------|---------------------------------------------| +| 8000 | `xds-server`: serve XDS webapp and REST API | +| 69 | TFTP | +| 2222 | ssh | + +This container also creates the following volumes (shared folders between +inside and outside docker): + +| Directory on host | Directory inside docker | Comment | +|-------------------|-------------------------|---------| +| $HOME/xds-workspace | /home/devel/xds-workspace | XDS projects workspace location| +| $HOME/xds-workspace/.xdt_0 | /xdt | location to store SDKs | +| $USER_VOLUME | $USER_VOLUME | user path, see `--volume` option of `xds-docker-create-container.sh` script | + + +**Note:** + +You can add a new shared directory using `--volume` option in order +to use for example with Path-Mapping folder type. + +```bash +# Create new XDS worker container and share extra '$HOME/my-workspace' directory +bash ./xds-docker-create-container.sh --volume /my-workspace:$HOME/my-workspace +``` + +You can change docker used port with `-id` option + +```bash +# Create new XDS worker container with a different port number +bash ./xds-docker-create-container.sh -id ${ID} + +# Check that new container is running +docker ps | grep worker-xds +f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 0.0.0.0:(2222+ID)->22/tcp, 0.0.0.0:(69+ID)->69/udp, 0.0.0.0:(8000+ID)->8000/tcp, 0.0.0.0:(10809+ID)->10809/tcp agl-xds-HOSTNAME-ID-USERNAME +``` + + + +### Manually setup docker user id + + +**Note:** + +If you used `xds-docker-create-container.sh` script to create XDS +docker container, user uid/gid inside docker has already been changed by this script. + + +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) +export CONTAINER_NAME=agl-xds-seb@laptop-0-seb +docker ps | grep -q ${CONTAINER_NAME} || echo "ERROR: No container name \"${CONTAINER_NAME}\" please set a valid CONTAINER_NAME before you continue" + +# First kill all processes of devel user (including running xds-server) +docker exec ${CONTAINER_NAME} bash -c "/bin/loginctl kill-user devel" + +# Change user and group id inside docker to match your ids +docker exec ${CONTAINER_NAME} bash -c "usermod -u $(id -u) devel" +docker exec ${CONTAINER_NAME} bash -c "groupmod -g $(id -g) devel" + +# Update some files ownership +docker exec ${CONTAINER_NAME} bash -c "chown -R devel:devel /home/devel /tmp/xds*" + +# Restart devel autologin service +docker exec ${CONTAINER_NAME} bash -c "systemctl restart autologin" + +# Restart xds-server as a service (ssh port 2222 may depend on your container ID) +ssh -p 2222 devel@localhost -- "systemctl --user restart xds-server" +``` + +## Check if xds-server is running (open XDS webapp) + +**`xds-server` is automatically started** as a service on container startup. + +If the container is running on your localhost, you can access to a basic web +application: + +```bash +xdg-open http://localhost:8000 +``` + +If needed you can status / stop / start it manually using following commands: + +```bash +# Status XDS server: +ssh -p 2222 devel@localhost systemctl --user status xds-server.service + +# Stop XDS server +ssh -p 2222 devel@localhost systemctl --user stop xds-server.service + +# Start XDS server +ssh -p 2222 devel@localhost systemctl --user start xds-server.service + +# Get XDS server logs +ssh -p 2222 devel@localhost journalctl --user --unit=xds-server.service --output=cat +``` + +`xds-server` is now up and running, you can now install AGL SDKs, please refer +to next chapter named [Installing AGL SDKs](./3_install-sdks.html) + + +Please refer to [xds-server configuration](../part-2/1_xds-server/1_config.html) chapter for additional info about xds-server settings. + diff --git a/docs/part-1/2-2_install-xds-server-vm.md b/docs/part-1/2-2_install-xds-server-vm.md new file mode 100644 index 0000000..c93d982 --- /dev/null +++ b/docs/part-1/2-2_install-xds-server-vm.md @@ -0,0 +1,82 @@ +# Installation based on Virtual Machine appliance + +## Virtual Machine appliance prerequisites + +> VirtualBox is installed on the host machine + +please refer to [VirtualBox documentation](https://www.virtualbox.org/wiki/Downloads) for more details. + +## Get the appliance + +Load the pre-build AGL SDK appliance image including `xds-server`: + +```bash +wget http://iot.bzh/download/public/XDS/appliance/xds-vm-debian9_latest.ova +``` + +## Clean old appliance + +You must have one and one xds appliance only. + +So, first remove the oldest xds appliance if needed. + +```bash +# Get the virtual machine name +VDS_VMNAME=$(VBoxManage list vms | grep xds-vm-debian | cut -d "\"" -f2) +echo ${VDS_VMNAME} + +# Remove old XDS appliance +[ -n ${VDS_VMNAME} ] && VBoxManage controlvm ${VDS_VMNAME} poweroff +[ -n ${VDS_VMNAME} ] && VBoxManage unregistervm ${VDS_VMNAME} --delete +``` + +## Create and start a new appliance + +Used provided script to create a new appliance or you can use VirtualBox GUI: + +```bash +# Import image into VirtualBox +VBoxManage import ./xds-vm-debian9_latest.ova + +# Check import result +VDS_VMNAME=$(VBoxManage list vms | grep xds-vm-debian | cut -d "\"" -f2) +echo ${VDS_VMNAME} + +# Start XDS appliance +[ -n ${VDS_VMNAME} ] && VBoxManage startvm ${VDS_VMNAME} +``` + +**Mandatory**: + +Add share folder to appliance, to allow files sharing using pathmap method: + +```bash +# Create local share folder +mkdir -p $HOME/xds-workspace + +#Add share folder to appliance +vboxmanage sharedfolder add ${VDS_VMNAME} --name XDS-workspace --hostpath $HOME/xds-workspace +``` + +## Appliance settings + +This image exposes following network ports (NAT mode): + +- 8000 : `xds-server` to serve XDS basic web page +- 69 : TFTP +- 2222 : ssh + +## 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 basic web page that gives you some instructions: + +```bash +# if container/appliance is running on your local host +# (else replace localhost by the name or the ip of the machine running the container) +xdg-open http://localhost:8000 +``` + +`xds-server` is now up and running, you can now install AGL SDKs, please refer +to next chapter named [Installing AGL SDKs](./3_install-sdks.html) diff --git a/docs/part-1/2-3_install-xds-server-native.md b/docs/part-1/2-3_install-xds-server-native.md new file mode 100644 index 0000000..ffdbc7c --- /dev/null +++ b/docs/part-1/2-3_install-xds-server-native.md @@ -0,0 +1,72 @@ +# Native installation + +You can chose to install xds-server 'natively' instead of within a docker +container but note that only Linux host OSes are 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} +export DISTRO="xUbuntu_16.04" + +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 < +**Optional step**: skip this chapter if you plan to use default settings + + +Please refer to [Configuration chapter of xds-server](../part-2/1_xds-server/1_config.html) +documentation for more details about JSON configuration file. + +## Start/Stop xds-server + +`xds-server` can be managed as a systemd service with the following commands: + +```bash +# Status XDS server: +systemctl --user status xds-server.service + +# Stop XDS server +systemctl --user stop xds-server.service + +# Start XDS server +systemctl --user start xds-server.service + +# Get XDS server logs +systemctl --user --unit=xds-server.service --output=cat +``` + +To check if xds-server is correctly install and running, you can access the web +interface, using a web browser : + +```bash +xdg-open http://localhost:8000 +``` + +or get the current version using the following curl command: + +```bash +curl http://localhost:8000/api/v1/version +``` diff --git a/docs/part-1/2_install-xds-server.md b/docs/part-1/2_install-xds-server.md index cbbca44..76afee3 100644 --- a/docs/part-1/2_install-xds-server.md +++ b/docs/part-1/2_install-xds-server.md @@ -13,316 +13,6 @@ Several installation types are supported: | Install type | Supported OS | Section to refer | |--------------|--------------|------------------| -| Container | Linux or MacOS | [see Installation based on Docker container](#installation-based-on-docker-container) | -| Virtual Machine | Linux, MacOS or Windows | [see Installation based on VirtualBox appliance](#installation-based-on-virtual-machine-appliance) | -| Native | Linux | [see Native installation](#native-installation) | - -## Installation based on Docker container - -### 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 -wget -O - http://iot.bzh/download/public/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 -docker images "docker.automotivelinux.org/agl/worker-xds*" - -REPOSITORY TAG IMAGE ID CREATED SIZE -docker.automotivelinux.org/agl/worker-xds 5.0 877979e534ff 3 hours ago 106MB -``` - -### Create and start a new container - -Use provided script to create a new docker image and start a new container: - -```bash -# Get script -wget -O xds-docker-create-container.sh 'https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git;a=blob_plain;f=scripts/xds-docker-create-container.sh;hb=master' - -# Create new XDS worker container -bash ./xds-docker-create-container.sh - -# Check that new container is running -docker ps | grep worker-xds -f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 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-HOSTNAME-0-USERNAME -``` - -This container exposes following ports: - -| Port number | Description | -|-------------|---------------------------------------------| -| 8000 | `xds-server`: serve XDS webapp and REST API | -| 69 | TFTP | -| 2222 | ssh | - -This container also creates the following volumes (shared folders between -inside and outside docker): - -| Directory on host | Directory inside docker | Comment | -|-------------------|-------------------------|---------| -| $HOME/xds-workspace | /home/devel/xds-workspace | XDS projects workspace location| -| $HOME/xds-workspace/.xdt_0 | /xdt | location to store SDKs | -| $USER_VOLUME | $USER_VOLUME | user path, see `--volume` option of `xds-docker-create-container.sh` script | - - -**Note:** - -You can add a new shared directory using `--volume` option in order -to use for example with Path-Mapping folder type. - -```bash -# Create new XDS worker container and share extra '$HOME/my-workspace' directory -bash ./xds-docker-create-container.sh --volume /my-workspace:$HOME/my-workspace -``` - -You can change docker used port with `-id` option - -```bash -# Create new XDS worker container with a different port number -bash ./xds-docker-create-container.sh -id ${ID} - -# Check that new container is running -docker ps | grep worker-xds -f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 0.0.0.0:(2222+ID)->22/tcp, 0.0.0.0:(69+ID)->69/udp, 0.0.0.0:(8000+ID)->8000/tcp, 0.0.0.0:(10809+ID)->10809/tcp agl-xds-HOSTNAME-ID-USERNAME -``` - - - -#### Manually setup docker user id - - -**Note:** - -If you used `xds-docker-create-container.sh` script to create XDS -docker container, user uid/gid inside docker has already been changed by this script. - - -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) -export CONTAINER_NAME=agl-xds-seb@laptop-0-seb -docker ps | grep -q ${CONTAINER_NAME} || echo "ERROR: No container name \"${CONTAINER_NAME}\" please set a valid CONTAINER_NAME before you continue" - -# First kill all processes of devel user (including running xds-server) -docker exec ${CONTAINER_NAME} bash -c "/bin/loginctl kill-user devel" - -# Change user and group id inside docker to match your ids -docker exec ${CONTAINER_NAME} bash -c "usermod -u $(id -u) devel" -docker exec ${CONTAINER_NAME} bash -c "groupmod -g $(id -g) devel" - -# Update some files ownership -docker exec ${CONTAINER_NAME} bash -c "chown -R devel:devel /home/devel /tmp/xds*" - -# Restart devel autologin service -docker exec ${CONTAINER_NAME} bash -c "systemctl restart autologin" - -# Restart xds-server as a service (ssh port 2222 may depend on your container ID) -ssh -p 2222 devel@localhost -- "systemctl --user restart xds-server" -``` - -### Check if xds-server is running (open XDS webapp) - -**`xds-server` is automatically started** as a service on container startup. - -If the container is running on your localhost, you can access to a basic web -application: - -```bash -xdg-open http://localhost:8000 -``` - -If needed you can status / stop / start it manually using following commands: - -```bash -# Status XDS server: -ssh -p 2222 devel@localhost systemctl --user status xds-server.service - -# Stop XDS server -ssh -p 2222 devel@localhost systemctl --user stop xds-server.service - -# Start XDS server -ssh -p 2222 devel@localhost systemctl --user start xds-server.service - -# Get XDS server logs -ssh -p 2222 devel@localhost journalctl --user --unit=xds-server.service --output=cat -``` - -`xds-server` is now up and running, you can now install AGL SDKs, please refer -to next chapter named [Installing AGL SDKs](3_install-sdks.html#installing-agl-sdks) - - -Please refer to [part 2 - xds-server](../part-2/1_xds-server.html#sdk-cross-toolchain-management) documentation -for additional info. - - -## Installation based on Virtual Machine appliance - -### Virtual Machine appliance prerequisites - -> VirtualBox is installed on the host machine - -please refer to [VirtualBox documentation](https://www.virtualbox.org/wiki/Downloads) for more details. - -### Get the appliance - -Load the pre-build AGL SDK appliance image including `xds-server`: - -```bash -wget http://iot.bzh/download/public/XDS/appliance/xds-vm-debian9_latest.ova -``` - -### Clean old appliance - -You must have one and one xds appliance only. - -So, first remove the oldest xds appliance if needed. - -```bash -# Get the virtual machine name -VDS_VMNAME=$(VBoxManage list vms | grep xds-vm-debian | cut -d "\"" -f2) -echo ${VDS_VMNAME} - -# Remove old XDS appliance -[ -n ${VDS_VMNAME} ] && VBoxManage controlvm ${VDS_VMNAME} poweroff -[ -n ${VDS_VMNAME} ] && VBoxManage unregistervm ${VDS_VMNAME} --delete -``` - -### Create and start a new appliance - -Used provided script to create a new appliance or you can use VirtualBox GUI: - -```bash -# Import image into VirtualBox -VBoxManage import ./xds-vm-debian9_latest.ova - -# Check import result -VDS_VMNAME=$(VBoxManage list vms | grep xds-vm-debian | cut -d "\"" -f2) -echo ${VDS_VMNAME} - -# Start XDS appliance -[ -n ${VDS_VMNAME} ] && VBoxManage startvm ${VDS_VMNAME} -``` - -**Mandatory**: - -Add share folder to appliance, to allow files sharing using pathmap method: - -```bash -# Create local share folder -mkdir -p $HOME/xds-workspace - -#Add share folder to appliance -vboxmanage sharedfolder add ${VDS_VMNAME} --name XDS-workspace --hostpath $HOME/xds-workspace -``` - -### Appliance settings - -This image exposes following network ports (NAT mode): - -- 8000 : `xds-server` to serve XDS basic web page -- 69 : TFTP -- 2222 : ssh - -## 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 basic web page that gives you some instructions: - -```bash -# if container/appliance is running on your local host -# (else replace localhost by the name or the ip of the machine running the container) -xdg-open http://localhost:8000 -``` - -`xds-server` is now up and running, you can now install AGL SDKs, please refer -to next chapter named [Installing AGL SDKs](3_install-sdks.html#installing-agl-sdks) - -## Native installation - -You can chose to install xds-server 'natively' instead of within a docker -container but note that only Linux host OSes are 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} -export DISTRO="xUbuntu_16.04" - -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 < -**Optional step**: skip this chapter if you plan to use default settings - - -Please refer to [Configuration chapter of xds-server](../part-2/1_xds-server.html#configuration) -documentation for more details about JSON configuration file. - -### Start/Stop xds-server - -`xds-server` can be managed as a systemd service with the following commands: - -```bash -# Status XDS server: -systemctl --user status xds-server.service - -# Stop XDS server -systemctl --user stop xds-server.service - -# Start XDS server -systemctl --user start xds-server.service - -# Get XDS server logs -systemctl --user --unit=xds-server.service --output=cat -``` - -To check if xds-server is correctly install and running, you can access the web -interface, using a web browser : - -```bash -xdg-open http://localhost:8000 -``` - -or get the current version using the following curl command: - -```bash -curl http://localhost:8000/api/v1/version -``` +| Container | Linux or MacOS | [see Installation based on Docker container](./2-1_install-xds-server-docker.html) | +| Virtual Machine | Linux, MacOS or Windows | [see Installation based on VirtualBox appliance](./2-2_install-xds-server-vm.html) | +| Native | Linux | [see Native installation](./2-3_install-xds-server-native.html) | diff --git a/docs/part-1/3_install-sdks.md b/docs/part-1/3_install-sdks.md index 67a6002..8fc0774 100644 --- a/docs/part-1/3_install-sdks.md +++ b/docs/part-1/3_install-sdks.md @@ -93,5 +93,5 @@ Note that you can abort installation by clicking on `CANCEL` button. ## More info -Please refer to [xds-server](../part-2/1_xds-server.html) chapter for more details +Please refer to [xds-server](../part-2/1_xds-server/0_abstract.html) chapter for more details about SDKs management. diff --git a/docs/part-1/4-1_build-first-app-setup.md b/docs/part-1/4-1_build-first-app-setup.md new file mode 100644 index 0000000..f974b9e --- /dev/null +++ b/docs/part-1/4-1_build-first-app-setup.md @@ -0,0 +1,26 @@ +# Setup + +Let's use _helloworld-native-application_ project as example, 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 +``` diff --git a/docs/part-1/4-2_build-first-app-cmd.md b/docs/part-1/4-2_build-first-app-cmd.md new file mode 100644 index 0000000..02de723 --- /dev/null +++ b/docs/part-1/4-2_build-first-app-cmd.md @@ -0,0 +1,117 @@ +# Build using command line tool + +## Declare project + +Use XDS command line tool named [xds-cli](../part-2/3_xds-cli/0_abstract.html) to declare your +project from command line and more precisely the `projects add` command +(short option: `prj add`). + +```bash +xds-cli prj add --label="Project_helloworld-native-application" --type=pm --path=/home/seb/xds-workspace/helloworld-native-application --server-path=/home/devel/xds-workspace/helloworld-native-application +``` + +> **Note:** option `--url=http://localhost:1234` may be added to `xds-cli` in +> order to set url of `xds-agent` in case of agent is not running on default +> port (for example here, 1234) + +## 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 `xds-cli` tool and `projects list` command (short: `prj ls`): + +```bash +xds-cli prj ls +ID Label LocalPath +f9904f70-d441-11e7-8c59-3c970e49ad9b Project_helloworld-service /home/seb/xds-workspace/helloworld-service +4021617e-ced0-11e7-acd2-3c970e49ad9b Project_helloworld-native-application /home/seb/xds-workspace/helloworld-native-application +``` + +XDS tools, including `xds-cli` are installed by default in `/opt/AGL/bin` +directory and this path has been added into your PATH variable. + +If it is not the case, just add it manually using `export PATH=${PATH}:/opt/AGL/bin` command line. + +Now to refer your project, just use --id option or use `XDS_PROJECT_ID` +environment variable. + + +**Note:** + +Short id notation is also supported as soon as given id value is non ambiguous. + +For example, to refer to Project_helloworld-native-application project listed +in above command, you can simply use --id 40 instead of --id 4021617e-ced0-11e7-acd2-3c970e49ad9b + + +You also need to determine the ID of the cross SDK you want to use to cross build +you application. + +To list installed SDK, use the following command: + +```bash +xds-cli sdks ls +List of installed SDKs: + ID NAME + 7aa19224-b769-3463-98b1-4c029d721766 aarch64 (3.99.1+snapshot) + 41a1efc4-8443-3fb0-afe5-8313e0c96efd corei7-64 (3.99.2+snapshot) + c226821b-b5c0-386d-94fe-19f807946d03 aarch64 (3.99.3) +``` + +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 +# Go into your project directory and create a build directory +cd $MY_PROJECT_DIR +mkdir build + +# Generate build system using cmake +xds-cli exec --id=4021617e --sdkid=c226821b -- "cd build && cmake .." + +# Build the project +xds-cli exec --id=4021617e --sdkid=c226821b -- "cd build && make all" +``` + + +**Note:** If you use `&&`, `||` or `;` statement in the executed command line, +you need to double quote the command, for example `"cd build && make`. + + +To avoid to set project id, sdks id, url, ... for each command line, you can +define these settings as environment variables within an env file and just set +`--config` option or source file before executing xds-cli command. + +Note that XDS creates a file named `xds-project.conf` (only if not already exists) +when you declare a new project using XDS Dashboard (or using `xds-cli prj add...`). +Edit this file if needed and then refer it with `--config` option. + +For example, the equivalence of above command is: + +```bash +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cd $MY_PROJECT_DIR + +# Edit and potentially adapt xds-project.conf file that has been created +# automatically on project declaration using XDS Dashboard +cat xds-project.conf + # XDS project settings + export XDS_AGENT_URL=localhost:8800 + export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b + export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 + +# Create build directory and invoke cmake and then build project +xds-cli exec --config=./xds-project.conf -- "mkdir -p build && cd build && cmake .." +cd build && xds-cli exec --config=../xds-project.conf -- "make all" + +# Or equivalent by first sourcing conf file (avoid to set --config option) +source xds-project.conf +xds-cli exec "mkdir -p build && cd build && cmake .." +cd build && xds-cli exec "make all" +``` + + +**Note:** all parameters after a double dash (--) are considered as the command +to execute. + diff --git a/docs/part-1/4-3_build-first-app-dashboard.md b/docs/part-1/4-3_build-first-app-dashboard.md new file mode 100644 index 0000000..4519f54 --- /dev/null +++ b/docs/part-1/4-3_build-first-app-dashboard.md @@ -0,0 +1,47 @@ +# Build using XDS Dashboard + +## Declare project + +Use XDS Dashboard to declare your project. Open a browser and connect to XDS +Dashboard. + +URL depends of your config, for example `http://localhost:8800` + +Open the right sidebar and select `Projects` entry to open project page and then +create/declare a new project by with the plus icon: + +![](./pictures/xds-dashboard-icon-2.png){:: style="margin:auto; display:flex"} + + + +Set `Sharing Type` and paths according to your needs. + +![](./pictures/xds-dashboard-prj-1.png){:: style="width:90%; max-width:560px; margin:auto; display:flex"} + +Note that XDS creates (if not already exists) a file named `xds-project.conf` +when you declare a new project. + +This file may be very useful when you plan to use XDS client tools such as `xds-cli` or `xds-gdb`. + + +**Note:** + +When `Path mapping` type is selected, you must clone your project into +`$HOME/xds-workspace` directory (named **Local Path** in modal window). + +If XDS server is running in the XDS docker container (see [Installation based on Docker container](./2-1_install-xds-server-docker.html) ), +the **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 wherever you want on +your local disk. + + +## Build from XDS dashboard + +Open the build page build entry of left sidebar ![](./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%; max-width:600px; margin:auto; display:flex"} diff --git a/docs/part-1/4-4_build-first-app-ide.md b/docs/part-1/4-4_build-first-app-ide.md new file mode 100644 index 0000000..c3c0cda --- /dev/null +++ b/docs/part-1/4-4_build-first-app-ide.md @@ -0,0 +1,187 @@ +# Build using a source code editor / IDE + +First create an XDS config file or reuse the previous one, 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-project.conf << EOF + export XDS_AGENT_URL=localhost:8800 + export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b + export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +EOF +``` + +## NetBeans + +This chapter will show you how to create 2 configurations, one to compile your +project natively (using native GNU gcc) and one to cross-compile your project +using XDS. + +You can easily switch from one to other configuration using menu +**Run -> Set Project Configuration**. + +__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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Finally click on **OK** button. + +- Now create we first declare project into NetBeans and create first a native + configuration. To do that, open menu **File** -> **New Project** + +- Select **C/C++ Project with Existing Sources** ; + Click on **Next** button + +- Specify your project directory and set **Select Configuration Mode** to + **Custom**. Keep **Tool Collection** to **Default GNU** in order to create a + *native configuration* based on native GNU GCC. Finally click on **Next** button. + + ![Select Model panel](./pictures/nb_new-project-1.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + +- Just update **Run in Folder** field and add `build_native` suffix so that + resulting build files will be located into `build_native` sub-directory. + Keep all others settings to default value and click on **Next** button. + + ![Select Model panel](./pictures/nb_new-project-2.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + +- Click several times on **Next button** (always keep default settings) and + click on **Finish** button to complete creation of native configuration. + +- Now we will create a **cross configuration** based on XDS tools. + 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 Build category](./pictures/nb_new-project-3.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Click on **Set Active** button + + - Select **Pre-Build** sub-category, and set: + - Working Directory: `build_gen3` + - Command Line: `xds-cli exec -c ../xds-project.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-cli exec -c ../xds-project.conf -- make remote-target-populate` + - Clean Command: `xds-cli exec -c ../xds-project.conf -- make clean` + + ![Select Make sub-category](./pictures/nb_new-project-4.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Select **Run** sub-category, and set: + - Run Command: `target/start-on-root@renesas-gen3.sh` + - Run Directory: `build-gen3` + + ![Select Run sub-category](./pictures/nb_new-project-5.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - 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 the 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` +command and you will see a list of task runner templates. + +And define your own tasks, here is an example to build +[helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) +AGL helloworld application based on cmake template. + +```json +{ + "version": "2.0.0", + "type": "shell", + "presentation": { + "reveal": "always" + }, + "tasks": [ + { + "taskName": "clean", + "command": "/bin/rm -rf ${workspaceFolder}/build/* && mkdir -p build && echo Cleanup done.", + "problemMatcher": [] + }, + { + "taskName": "pre-build", + "group": "build", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ../", + "problemMatcher": [ + "$gcc" + ] + }, + { + "taskName": "build", + "group": "build", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget", + "problemMatcher": [ + "$gcc" + ] + }, + { + "taskName": "populate", + "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget-target-install", + "problemMatcher": [] + } + ] +} +``` + +> **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/4_build-first-app.md b/docs/part-1/4_build-first-app.md index f6810d1..34f895b 100644 --- a/docs/part-1/4_build-first-app.md +++ b/docs/part-1/4_build-first-app.md @@ -6,386 +6,16 @@ (see previous chapter: [Installing XDS client tools](./1_install-client.html) ) - `xds-server` is running locally in a docker container or is accessible on your network (see previous chapter: [Installing XDS server](./2_install-xds-server.html)) -- one or more SDK have been installed (see previous chapter: [Installing AGL SDKs](3_install-sdks.html)) +- one or more SDK have been installed (see previous chapter: [Installing AGL SDKs](./3_install-sdks.html)) - XDS configuration is correct: in other words, connection is correctly established between `xds-agent` and `xds-server` and no error message is displayed when you open XDS Dashboard in a web browser. -## Setup +--- -Let's use _helloworld-native-application_ project as example, so you need first to clone -this project into a directory that will be accessible by `xds-server`. +Links to subchapters : -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 using XDS Dashboard - -Use XDS Dashboard to declare your project. Open a browser and connect to XDS -Dashboard. - -URL depends of your config, for example `http://localhost:8800` - -Open the right sidebar and select `Projects` entry to open project page and then -create/declare a new project by with the plus icon: - -![](./pictures/xds-dashboard-icon-2.png){:: style="margin:auto; display:flex"} - - - -Set `Sharing Type` and paths according to your needs. - -![](./pictures/xds-dashboard-prj-1.png){:: style="width:90%; max-width:560px; margin:auto; display:flex"} - -Note that XDS creates (if not already exists) a file named `xds-project.conf` -when you declare a new project. - -This file may be very useful when you plan to use XDS client tools such as `xds-cli` or `xds-gdb`. - - -**Note:** - -When `Path mapping` type is selected, you must clone your project into -`$HOME/xds-workspace` directory (named **Local Path** in modal window). - -If XDS server is running in the XDS docker container (see [Installation based on Docker container](./2_install-xds-server.html#installation-based-on-docker-container) ), -the **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 wherever you want on -your local disk. - - -### Declare project from command line - -Use XDS command line tool named [xds-cli](./part2/3_xds-cli.html) to declare your -project from command line and more precisely the `projects add` command -(short option: `prj add`). - -```bash -xds-cli prj add --label="Project_helloworld-native-application" --type=pm --path=/home/seb/xds-workspace/helloworld-native-application --server-path=/home/devel/xds-workspace/helloworld-native-application -``` - -> **Note:** option `--url=http://localhost:1234` may be added to `xds-cli` in -> order to set url of `xds-agent` in case of agent is not running on default -> port (for example here, 1234) - - - -## Build from XDS dashboard - -Open the build page build entry of left sidebar ![](./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%; max-width:600px; margin:auto; display:flex"} - -## 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 `xds-cli` tool and `projects list` command (short: `prj ls`): - -```bash -xds-cli prj ls -ID Label LocalPath -f9904f70-d441-11e7-8c59-3c970e49ad9b Project_helloworld-service /home/seb/xds-workspace/helloworld-service -4021617e-ced0-11e7-acd2-3c970e49ad9b Project_helloworld-native-application /home/seb/xds-workspace/helloworld-native-application -``` - -XDS tools, including `xds-cli` are installed by default in `/opt/AGL/bin` -directory and this path has been added into your PATH variable. - -If it is not the case, just add it manually using `export PATH=${PATH}:/opt/AGL/bin` command line. - -Now to refer your project, just use --id option or use `XDS_PROJECT_ID` -environment variable. - - -**Note:** - -Short id notation is also supported as soon as given id value is non ambiguous. - -For example, to refer to Project_helloworld-native-application project listed -in above command, you can simply use --id 40 instead of --id 4021617e-ced0-11e7-acd2-3c970e49ad9b - - -You also need to determine the ID of the cross SDK you want to use to cross build -you application. - -To list installed SDK, use the following command: - -```bash -xds-cli sdks ls -List of installed SDKs: - ID NAME - 7aa19224-b769-3463-98b1-4c029d721766 aarch64 (3.99.1+snapshot) - 41a1efc4-8443-3fb0-afe5-8313e0c96efd corei7-64 (3.99.2+snapshot) - c226821b-b5c0-386d-94fe-19f807946d03 aarch64 (3.99.3) -``` - -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 -# Go into your project directory and create a build directory -cd $MY_PROJECT_DIR -mkdir build - -# Generate build system using cmake -xds-cli exec --id=4021617e --sdkid=c226821b -- "cd build && cmake .." - -# Build the project -xds-cli exec --id=4021617e --sdkid=c226821b -- "cd build && make all" -``` - - -**Note:** If you use `&&`, `||` or `;` statement in the executed command line, -you need to double quote the command, for example `"cd build && make`. - - -To avoid to set project id, sdks id, url, ... for each command line, you can -define these settings as environment variables within an env file and just set -`--config` option or source file before executing xds-cli command. - -Note that XDS creates a file named `xds-project.conf` (only if not already exists) -when you declare a new project using XDS Dashboard (or using `xds-cli prj add...`). -Edit this file if needed and then refer it with `--config` option. - -For example, the equivalence of above command is: - -```bash -# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application -cd $MY_PROJECT_DIR - -# Edit and potentially adapt xds-project.conf file that has been created -# automatically on project declaration using XDS Dashboard -cat xds-project.conf - # XDS project settings - export XDS_AGENT_URL=localhost:8800 - export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b - export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 - -# Create build directory and invoke cmake and then build project -xds-cli exec --config=./xds-project.conf -- "mkdir -p build && cd build && cmake .." -cd build && xds-cli exec --config=../xds-project.conf -- "make all" - -# Or equivalent by first sourcing conf file (avoid to set --config option) -source xds-project.conf -xds-cli exec "mkdir -p build && cd build && cmake .." -cd build && xds-cli exec "make all" -``` - - -**Note:** all parameters after a double dash (--) are considered as the command -to execute. - - -## Build from IDE - -First create an XDS config file or reuse the previous one, 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-project.conf << EOF - export XDS_AGENT_URL=localhost:8800 - export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b - export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 -EOF -``` - -### NetBeans - -This chapter will show you how to create 2 configurations, one to compile your -project natively (using native GNU gcc) and one to cross-compile your project -using XDS. - -You can easily switch from one to other configuration using menu -**Run -> Set Project Configuration**. - -__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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: - - ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Finally click on **OK** button. - -- Now create we first declare project into NetBeans and create first a native - configuration. To do that, open menu **File** -> **New Project** - -- Select **C/C++ Project with Existing Sources** ; - Click on **Next** button - -- Specify your project directory and set **Select Configuration Mode** to - **Custom**. Keep **Tool Collection** to **Default GNU** in order to create a - *native configuration* based on native GNU GCC. Finally click on **Next** button. - - ![Select Model panel](./pictures/nb_new-project-1.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - -- Just update **Run in Folder** field and add `build_native` suffix so that - resulting build files will be located into `build_native` sub-directory. - Keep all others settings to default value and click on **Next** button. - - ![Select Model panel](./pictures/nb_new-project-2.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - -- Click several times on **Next button** (always keep default settings) and - click on **Finish** button to complete creation of native configuration. - -- Now we will create a **cross configuration** based on XDS tools. - 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 Build category](./pictures/nb_new-project-3.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Click on **Set Active** button - - - Select **Pre-Build** sub-category, and set: - - Working Directory: `build_gen3` - - Command Line: `xds-cli exec -c ../xds-project.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-cli exec -c ../xds-project.conf -- make remote-target-populate` - - Clean Command: `xds-cli exec -c ../xds-project.conf -- make clean` - - ![Select Make sub-category](./pictures/nb_new-project-4.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Select **Run** sub-category, and set: - - Run Command: `target/start-on-root@renesas-gen3.sh` - - Run Directory: `build-gen3` - - ![Select Run sub-category](./pictures/nb_new-project-5.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - 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 the 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` -command and you will see a list of task runner templates. - -And define your own tasks, here is an example to build -[helloworld-native-application](https://github.com/iotbzh/helloworld-native-application) -AGL helloworld application based on cmake template. - -```json -{ - "version": "2.0.0", - "type": "shell", - "presentation": { - "reveal": "always" - }, - "tasks": [ - { - "taskName": "clean", - "command": "/bin/rm -rf ${workspaceFolder}/build/* && mkdir -p build && echo Cleanup done.", - "problemMatcher": [] - }, - { - "taskName": "pre-build", - "group": "build", - "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- cmake -DRSYNC_TARGET=root@renesas-gen3 -DRSYNC_PREFIX=/opt ../", - "problemMatcher": [ - "$gcc" - ] - }, - { - "taskName": "build", - "group": "build", - "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget", - "problemMatcher": [ - "$gcc" - ] - }, - { - "taskName": "populate", - "command": "/opt/AGL/bin/xds-cli exec --rpath build --config xds-project.conf -- make widget-target-install", - "problemMatcher": [] - } - ] -} -``` - -> **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...* +- [Setup](./4-1_build-first-app-setup.html) +- [Build using command line tool](./4-2_build-first-app-cmd.html) +- [Build using XDS Dashboard](./4-3_build-first-app-dashboard.html) +- [Build using a source code editor / IDE](./4-4_build-first-app-ide.html) diff --git a/docs/part-1/5-1_debug-first-app-config.md b/docs/part-1/5-1_debug-first-app-config.md new file mode 100644 index 0000000..8743bc1 --- /dev/null +++ b/docs/part-1/5-1_debug-first-app-config.md @@ -0,0 +1,76 @@ +# 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 configuration file: + +```bash +# for example: +# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application +cat > $MY_PROJECT_DIR/xds-gen3.conf << EOF +export XDS_AGENT_URL=localhost:8800 +export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b +export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +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 mode. + +`XDS_PROJECT_ID` *(mandatory in XDS mode)* + +Project ID you want to build + +`XDS_RPATH` + +Relative path into project + +`XDS_SDK_ID` *(mandatory in XDS mode)* + +Cross Sdk ID to use to build project + +`XDS_AGENT_URL` + +Local XDS agent url (default `http://localhost:8800`) + +## 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=4021617e-ced0-11e7-acd2-3c970e49ad9b + # :XDS-ENV: XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +``` diff --git a/docs/part-1/5-2_debug-first-app-cmd.md b/docs/part-1/5-2_debug-first-app-cmd.md new file mode 100644 index 0000000..8d0d764 --- /dev/null +++ b/docs/part-1/5-2_debug-first-app-cmd.md @@ -0,0 +1,69 @@ +# Debug 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 using XDS (see [Create your first AGL application](./4_build-first-app.html) for more details). + +So to debug it you need to have the XDS agent - server chain in place and +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-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 +#optional if not default value: XDS_AGENT_URL=http://localhost:8800 +XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject +XDS_SDK_ID=poky-agl_aarch64_4.0.1 +EOF + +# Tell to xds-cli 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-cli exec -- cmake -DRSYNC_TARGET=root@myTarget .. +xds-cli exec -- make +xds-cli 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. diff --git a/docs/part-1/5-3_debug-first-app-ide.md b/docs/part-1/5-3_debug-first-app-ide.md new file mode 100644 index 0000000..0473892 --- /dev/null +++ b/docs/part-1/5-3_debug-first-app-ide.md @@ -0,0 +1,44 @@ +# Debug using xds-gdb within an IDE + +First the project you want to debug must be declared on an xds-server and this +project may also has been built using using XDS (see [Create your first AGL application](./4_build-first-app.html) for more details). + +## 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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: + + ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - 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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} + + - 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/5_debug-first-app.md b/docs/part-1/5_debug-first-app.md index 01a183e..e1bdffd 100644 --- a/docs/part-1/5_debug-first-app.md +++ b/docs/part-1/5_debug-first-app.md @@ -13,191 +13,10 @@ Two debugging models are supported: By default XDS debug model is used and you need to define `XDS_NATIVE_GDB` variable to use native gdb debug mode instead. -## Configuration +--- - `xds-gdb` configuration is defined by variables (see listed below). - These variables may be set using : +Links to subchapters : -- 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 configuration file: - -```bash -# for example: -# MY_PROJECT_DIR=/home/seb/xds-workspace/helloworld-native-application -cat > $MY_PROJECT_DIR/xds-gen3.conf << EOF -export XDS_AGENT_URL=localhost:8800 -export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b -export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 -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 mode. - -`XDS_PROJECT_ID` *(mandatory in XDS mode)* - -Project ID you want to build - -`XDS_RPATH` - -Relative path into project - -`XDS_SDK_ID` *(mandatory in XDS mode)* - -Cross Sdk ID to use to build project - -`XDS_AGENT_URL` - -Local XDS agent url (default `http://localhost:8800`) - -### 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=4021617e-ced0-11e7-acd2-3c970e49ad9b - # :XDS-ENV: XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 -``` - -## 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 using XDS (see [Create your first AGL application](./4_build-first-app.html) for more details). - -So to debug it you need to have the XDS agent - server chain in place and -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-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 -#optional if not default value: XDS_AGENT_URL=http://localhost:8800 -XDS_PROJECT_ID=IW7B4EE-DBY4Z74_myProject -XDS_SDK_ID=poky-agl_aarch64_4.0.1 -EOF - -# Tell to xds-cli 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-cli exec -- cmake -DRSYNC_TARGET=root@myTarget .. -xds-cli exec -- make -xds-cli 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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - Then, you should set **Make Command** and **Debugger Command** to point to xds tools: - - ![Add new tool panel](./pictures/nb_xds_options.png){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - 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){:: style="width:90%; max-width:700px; margin:auto; display:flex"} - - - 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...* +- [Configuration](./5-1_debug-first-app-config.html) +- [xds-gdb from command line](./5-2_debug-first-app-cmd.html) +- [xds-gdb within an IDE](./5-3_debug-first-app-ide.html) diff --git a/docs/part-2/0_Abstract.md b/docs/part-2/0_Abstract.md index aa7ddc4..45f5f40 100644 --- a/docs/part-2/0_Abstract.md +++ b/docs/part-2/0_Abstract.md @@ -4,48 +4,3 @@ This 2nd part is the "technical" documentation of all XDS pieces/tools that allows for example to fine tune XDS configuration or rebuild all XDS tools from scratch. - -## Prerequisites - -To build xds binaries you need to install first [Go](https://golang.org/doc/install) version 1.8.1 or higher and some other tools. To build `xds-server` and `xds-agent` -you also need to install in addition `nodejs`. - -**Ubuntu:** - -```bash -# Install various tools -sudo apt-get install git make npm curl git zip unzip - -# Install Go -source /etc/os-release -wget -O- "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x52B59B1571A79DBC054901C0F6BC817356A3D45E" | sudo apt-key add - -sudo bash -c "cat >> /etc/apt/sources.list.d/golang.list <> /etc/apt/sources.list.d/golang.list < xds-agent <-|-> xds-server -``` - -**SEE ALSO**: [xds-cli](https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-cli.git), -a command-line tool that allows you to send commands to `xds-agent / 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-agent <=> 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) - -### Start xds-server within the container - -See [Installation based on Docker container](../part-1/2_install-xds-server.html#installation-based-on-docker-container) -chapter. - -### 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 - -```bash -/opt/AGL/xds/server/xds-server-start.sh -``` - -If needed you can change default setting by defining specific environment -variables file - -```bash -ssh -t -p 2222 devel@localhost vim /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 -docker exec ${CONTAINER_NAME} bash -c "echo 'LOG_LEVEL=debug' >> /etc/default/xds-server" -ssh -p 2222 devel@localhost -- "systemctl --user restart xds-server" -``` - -### SDK cross-toolchain Management - -#### Setup to add support of a new SDK family - - -**Optional step**: read this chapter only if you plan to add a new SDK family. - - -`xds-server` dynamically detects supported SDKs by scanning sub-directories of -`sdkScriptsDir` directory (see [Configuration chapter](#configuration)). - -Each sub-directory (usually name is the same as the SDK family) of `sdkScriptsDir` -must contain a set of scripts that will be called by `xds-server` to managed SDKs -of a specific family. - -These scripts are: - -- `add`: used to add/install a new SDK -- `db-dump`: returned the list of available and installed SDKs (JSON format) -- `db-update`: update SDKs database -- `get-family-config`: returned SDK family configuration structure (JSON format) -- `get-sdk-info`: extract SDK info (JSON format) from a SDK file/tarball -- `remove`: used to remove an existing SDK - -For example, here 2 SDKs family (`agl` and `zephyr`) are defined: - -```bash -# > tree ./sdks/ -./sdks/ -├── agl -│ ├── add -│ ├── db-dump -│ ├── db-update -│ ├── get-family-config -│ ├── get-sdk-info -│ └── remove -├── README.md -└── zephyr - ├── add -│ ├── db-dump -│ ├── db-update -│ ├── get-family-config -│ ├── get-sdk-info - └── remove -``` - -On startup `xds-server` will call in order: - -- `sdks/*/get-family-config` to get configuration of each SDK family. -- `sdks/*/db-dump` scripts to get the initial list of available and installed SDKs. - -Please refer to `sdks/README.md` for more information about scripts definition -and to understand how to add support of a new SDK family. - -#### Install a new SDK from command line - -Used `sdks` command of `xds-cli` tool to managed SDKs. - -```bash -# List all available SDKs -xds-cli sdks ls -a - -List of available SDKs: -ID NAME STATUS VERSION ARCH -ec15afe0 AGL-release-eel-4.99.4-raspberrypi3 Not Installed 4.99.4 armv7vehf-neon-vfpv4 -944d2d5a AGL-snapshots-master-latest-intel-corei7-64 Not Installed 4.99.3+snapshot corei7-64 -cf3a4365 AGL-release-dab-4.0.2-qemux86-64 Not Installed 4.0.2 corei7-64 -d65fe750 AGL-release-eel-latest-qemux86-64 Not Installed 4.99.3 corei7-64 -a0ae663d poky-agl-corei7-64-3.99.1+snapshot Installed 3.99.1+snapshot corei7-64 -87f0400b AGL-release-dab-3.99.3-m3ulcb-nogfx Installed 3.99.3 aarch64 -8c2f2841 AGL-release-dab-4.0.2-dragonboard-410c Not Installed 4.0.2 aarch64 -... - -# Install a SDK (downloaded + install) -xds-cli sdks install d65fe750 - -Installation of 'AGL-release-eel-latest-qemux86-64' SDK successfully started. -Downloading poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-4.99.5.sh ... ---2018-01-02 11:22:23-- https://download.automotivelinux.org/AGL/release/eel/latest/qemux86-64/deploy/sdk/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-4.99.5.sh -Resolving download.automotivelinux.org (download.automotivelinux.org)... 199.19.213.77 -Connecting to download.automotivelinux.org (download.automotivelinux.org)|199.19.213.77|:443... connected. -HTTP request sent, awaiting response... 200 OK -Length: 665996704 (635M) [application/x-sh] -Saving to: ‘/tmp/tmp.wuQzLdImCS/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-4.99.5.sh’ - - 0K .......... .......... .......... .......... .......... 0% 82,7K 2h11m - 50K .......... .......... .......... .......... .......... 0% 89,1K 2h6m - 100K .......... .......... .......... .......... .......... 0% 82,0K 2h8m -... - 50300K .......... .......... .......... .......... .......... 99% 2,15M 0s - 650350K .......... .......... .......... ....... 100% 4,04M=10m35s - -2018-01-02 12:17:06 (1024 KB/s) - ‘/tmp/tmp.CWyEj3z76Q/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-4.99.5.sh’ saved [665996704/665996704] - -Automotive Grade Linux SDK installer version 5.0.0 -=================================================== -You are about to install the SDK to "/xdt/sdk/poky-agl/5.0.0/corei7-64". Proceed[Y/n]? Y -Extracting SDK....................................................................................................................done -Setting it up...done -SDK has been successfully set up and is ready to be used. -Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. - $ . /xdt/sdk/poky-agl/5.0.0/corei7-64/environment-setup-corei7-64-agl-linux - -SDK ID d65fe750-d3a7-38f5-83d8-3d3806054f8d successfully installed. - - -# Abort an installation that is in progress -xds-cli sdks abort -id d65fe750 - -# Install a SDK (using a local SDK package/file) -xds-cli sdks install --file $HOME/xds-workspace/sdks/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-5.0.0.sh - -``` - - -Installation based on a local SDK package is only supported when SDK file package -is located in `$HOME/xds-workspace/sdks` directory - - -#### Install a new SDK from XDS Dashboard - -Open XDS-Dashboard in web-browser and select `SDKs` entry in left side menu. - -Then switch to `SDKs MANAGEMENT` view : - -![](../part-1/pictures/xds-dashboard-sdks-mgt.png){:: style="margin:auto; display:flex"} - -Use filter boxes to find the SDK you want to install and then click on plus -icon (Actions column) to start installation. - -SDK download and installation process may take several minutes and output of installation script (output of `add` script mentioned in above chapter). - -![](../part-1/pictures/xds-dashboard-sdks-install.png){:: style="margin:auto; display:flex"} - -Note that you can abort installation by clicking on `CANCEL` button. - -#### Un-install a SDK from command line - -Used `sdks` command of `xds-cli` tool to managed SDKs. - -```bash -# List installed SDKs -xds-cli sdks ls -List of installed SDKs: - ID NAME STATUS VERSION ARCH - c39e5998 poky-agl_aarch64_4.0.1 Installed 4.0.1 aarch64 - d610bfbf poky-agl-aarch64.current_on_iotbzh_download-3.99.1+snapshot Installed 3.99.1+snapshot aarch64.current_on_iotbzh_download - a0ae663d poky-agl-corei7-64-3.99.1+snapshot Installed 3.99.1+snapshot corei7-64 - 87f0400b AGL-release-dab-3.99.3-m3ulcb-nogfx Installed 3.99.3 aarch64 - 352c0584 poky-agl-corei7-64-3.99.2+snapshot Installed 3.99.2+snapshot corei7-64 - d65fe750 AGL-release-eel-latest-qemux86-64 Installed 4.99.5 corei7-64 - -# Un-install a SDK -xds-cli sdks uninstall d65fe750 -SDK ID d65fe750-d3a7-38f5-83d8-3d3806054f8d successfully deleted. -``` - -#### Un-install a SDK from XDS Dashboard - -Open XDS-Dashboard in web-browser and select `SDKs` entry in left side menu. - -If needed, switch to `BASIC SDKS VIEW` view and click on trash icon located -in the top-right corner of SDK card. - -### XDS server REST API and Web application - -`xds-server` exposes a REST API and serves a basic web-application. - -REST API based url is `http://localhost:8000/api/v1/` when XDS server is -running on your host (localhost) and basic web-application is available at -[http://localhost:8000](http://localhost:8000). - -Just replace `localhost` by the host name or ip when `xds-server` is running -on another host. - -```bash -# Get version using REST API -curl http://localhost:8000/api/v1/version - -# Open browser and local xds-server web-application -xdg-open http://localhost:8000 -``` - -Then follow instructions provided on this page to install and start `xds-agent` -that must run locally on your machine. - -See also [xds-agent documentation](2_xds-agent.html) for more details. - -## Build xds-server from scratch - -### Dependencies - -Install [Go](https://golang.org/doc/install), [npm](https://www.npmjs.com/), -[nodejs](https://nodejs.org/en/) and some other tools. -Refer to [Prerequisites chapter](./0_Abstract.html#prerequisites) for more details. - -### 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/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: - -```bash -export GOPATH=${GOPATH}:${ROOTDIR} - -mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds -cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds -git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-server -# or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-server -cd xds-server -make all -``` - -And to install `xds-server` (by default in `/opt/AGL/xds/server`): - -```bash -make install -``` - - -**Warning:** - -Makefile install rule and default values in configuration file are set -to fit the docker setup. - -So you may need to adapt some settings when you want to install xds-server natively. - - - -**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 (`server-config.json`). - -Here is the logic to determine which `server-config.json` file will be used: - -1. from command line option: `--config myConfig.json` -1. `$HOME/.xds/server/server-config.json` file -1. `/etc/xds/server/server-config.json` file -1. `/server-config.json` file - -Supported fields in configuration file are: - -- **httpPort** : HTTP port of client webapp/REST API -- **webAppDir** : location of client web application (default: webapp/dist) -- **shareRootDir** : root directory where projects will be copied -- **logsDir** : directory to store logs (eg. syncthing output) -- **sdkScriptsDir** : directory where scripts, used to managed 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 ) -- **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", - "sdkScriptsDir": "${EXEPATH}/scripts/sdks", - "syncthing": { - "binDir": "./bin", - "home": "${HOME}/.xds/server/syncthing-config", - "gui-address": "http://localhost:8385", - "gui-apikey": "123456789", - } -} -``` - ->**Notes:** -> ->Environment variables are supported by using `${MY_VAR}` syntax. -> - -When `xds-server` is started as a systemd service, default environment variables -are set into `/etc/default/xds-server` file. - -`xds-server` configuration is also driven by a JSON config file (`server-config.json`), -and default JSON config is `/etc/xds/server/server-config.json`. - - -**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/server-config.json` - - -#### Disable syncthing - -`CloudSync` synchronization type based on `syncthing` tool can be disabled by -simply removing (or renaming) `"syncthing"` key in configuration file. -Here is a JSON configuration file example where syncthing key as been renamed: - -```json -{ - "httpPort": 8000, - "webAppDir": "webapp/dist", - "shareRootDir": "${HOME}/.xds/server/projects", - "logsDir": "/tmp/logs", - "sdkScriptsDir": "${EXEPATH}/scripts/sdks", - "syncthing_DISABLE": { - "binDir": "./bin", - "home": "${HOME}/.xds/server/syncthing-config", - } -} -``` - -On benefit to do that is to increase XDS-Server startup time. - - -**Note:** - -- `CloudSync` (AKA syncthing) synchronzation type can also be disabled when `"syncthing"` key is not defined in JSON configuration file. - - - -## Debugging - -### XDS server architecture - -The server part is written in *Go* and web app (basic HTML) in *Angular4*. - -```bash -| -+-- bin/ # where xds-server binary file will be built -| -+-- conf.d/ # Linux configuration and startup files (systemd user service) -| -+-- glide.yaml # Go package dependency file -| -+-- lib/ # sources of server part (Go) -| -+-- LICENSE # XDS server license -| -+-- main.go # main entry point of of Web server (Go) -| -+-- Makefile # makefile including -| -+-- README.md # -| -+-- scripts/ # hold various scripts used for installation or startup -| -+-- test/ # XDS test suite -| -+-- tools/ # temporary directory to hold development tools (like glide) -| -+-- vendor/ # temporary directory to hold Go dependencies packages -| -+-- webapp/ # source client basic web application -``` - -Visual Studio Code launcher settings can be found into `.vscode/launch.json`. diff --git a/docs/part-2/1_xds-server/0_abstract.md b/docs/part-2/1_xds-server/0_abstract.md new file mode 100644 index 0000000..07dd057 --- /dev/null +++ b/docs/part-2/1_xds-server/0_abstract.md @@ -0,0 +1,41 @@ +# 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). + - Make it compatible with existing IT policies (e.g. corporate backup or SCM). + - Let user to continue to work as usual. + - Use his favorite editor. + - keep performance while editing/browsing sources. + - Avoids manual operation + +This powerful and portable webserver (written in [Go](https://golang.org)) +exposes a REST interface over HTTP. + +`xds-server` uses [Syncthing](https://syncthing.net/) tool to synchronize +projects files from user machine to build server machine or container. + +`xds-server` is commonly running on a build server (within a container or not) +and [xds-agent](../2_xds-agent/0_abstract.html) must run on the developer/user machine in order +to setup the following connection chain: + +```schema + developer/user machine | build server or container + ---------------------------|----------------------------- + xds-cli <---> xds-agent <-|-> xds-server +``` + +**SEE ALSO**: [xds-cli](https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-cli.git), +a command-line tool that allows you to send commands to `xds-agent / 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-agent <=> xds-server`. + +--- + +Links to subchapters : + +- [Configuration](./1_config.html) +- [How to run](./2_how-to-run.html) +- [Build from scratch](./3_build.html) +- [Debugging](./4_debug.html) diff --git a/docs/part-2/1_xds-server/1_config.md b/docs/part-2/1_xds-server/1_config.md new file mode 100644 index 0000000..594bdf2 --- /dev/null +++ b/docs/part-2/1_xds-server/1_config.md @@ -0,0 +1,86 @@ +# Configuration + +`xds-server` configuration is driven by a JSON config file (`server-config.json`). + +Here is the logic to determine which `server-config.json` file will be used: + +1. from command line option: `--config myConfig.json` +1. `$HOME/.xds/server/server-config.json` file +1. `/etc/xds/server/server-config.json` file +1. `/server-config.json` file + +Supported fields in configuration file are: + +- **httpPort** : HTTP port of client webapp/REST API +- **webAppDir** : location of client web application (default: webapp/dist) +- **shareRootDir** : root directory where projects will be copied +- **logsDir** : directory to store logs (eg. syncthing output) +- **sdkScriptsDir** : directory where scripts, used to managed 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 ) +- **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", + "sdkScriptsDir": "${EXEPATH}/scripts/sdks", + "syncthing": { + "binDir": "./bin", + "home": "${HOME}/.xds/server/syncthing-config", + "gui-address": "http://localhost:8385", + "gui-apikey": "123456789", + } +} +``` + +>**Notes:** +> +>Environment variables are supported by using `${MY_VAR}` syntax. +> + +When `xds-server` is started as a systemd service, default environment variables +are set into `/etc/default/xds-server` file. + +`xds-server` configuration is also driven by a JSON config file (`server-config.json`), +and default JSON config is `/etc/xds/server/server-config.json`. + + +**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/server-config.json` + + +## Disable syncthing + +`CloudSync` synchronization type based on `syncthing` tool can be disabled by +simply removing (or renaming) `"syncthing"` key in configuration file. +Here is a JSON configuration file example where syncthing key as been renamed: + +```json +{ + "httpPort": 8000, + "webAppDir": "webapp/dist", + "shareRootDir": "${HOME}/.xds/server/projects", + "logsDir": "/tmp/logs", + "sdkScriptsDir": "${EXEPATH}/scripts/sdks", + "syncthing_DISABLE": { + "binDir": "./bin", + "home": "${HOME}/.xds/server/syncthing-config", + } +} +``` + +On benefit to do that is to increase XDS-Server startup time. + + +**Note:** + +- `CloudSync` (AKA syncthing) synchronization type can also be disabled when `"syncthing"` key is not defined in JSON configuration file. + + diff --git a/docs/part-2/1_xds-server/2_how-to-run.md b/docs/part-2/1_xds-server/2_how-to-run.md new file mode 100644 index 0000000..36bc9a6 --- /dev/null +++ b/docs/part-2/1_xds-server/2_how-to-run.md @@ -0,0 +1,238 @@ +# 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) + +## Start xds-server within the container + +See [Installation based on Docker container](../../part-1/2-1_install-xds-server-docker.html) +chapter. + +## 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 + +```bash +/opt/AGL/xds/server/xds-server-start.sh +``` + +If needed you can change default setting by defining specific environment +variables file + +```bash +ssh -t -p 2222 devel@localhost vim /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 +docker exec ${CONTAINER_NAME} bash -c "echo 'LOG_LEVEL=debug' >> /etc/default/xds-server" +ssh -p 2222 devel@localhost -- "systemctl --user restart xds-server" +``` + +## SDK cross-toolchain Management + +### Setup to add support of a new SDK family + + +**Optional step**: read this chapter only if you plan to add a new SDK family. + + +`xds-server` dynamically detects supported SDKs by scanning sub-directories of +`sdkScriptsDir` directory (see [Configuration chapter](1_config.html)). + +Each sub-directory (usually name is the same as the SDK family) of `sdkScriptsDir` +must contain a set of scripts that will be called by `xds-server` to managed SDKs +of a specific family. + +These scripts are: + +- `add`: used to add/install a new SDK +- `db-dump`: returned the list of available and installed SDKs (JSON format) +- `db-update`: update SDKs database +- `get-family-config`: returned SDK family configuration structure (JSON format) +- `get-sdk-info`: extract SDK info (JSON format) from a SDK file/tarball +- `remove`: used to remove an existing SDK + +For example, here 2 SDKs family (`agl` and `zephyr`) are defined: + +```bash +# > tree ./sdks/ +./sdks/ +├── agl +│ ├── add +│ ├── db-dump +│ ├── db-update +│ ├── get-family-config +│ ├── get-sdk-info +│ └── remove +├── README.md +└── zephyr + ├── add +│ ├── db-dump +│ ├── db-update +│ ├── get-family-config +│ ├── get-sdk-info + └── remove +``` + +On startup `xds-server` will call in order: + +- `sdks/*/get-family-config` to get configuration of each SDK family. +- `sdks/*/db-dump` scripts to get the initial list of available and installed SDKs. + +Please refer to `sdks/README.md` for more information about scripts definition +and to understand how to add support of a new SDK family. + +### Install a new SDK from command line + +Used `sdks` command of `xds-cli` tool to managed SDKs. + +```bash +# List all available SDKs +xds-cli sdks ls -a + +List of available SDKs: +ID NAME STATUS VERSION ARCH +ec15afe0 AGL-release-eel-4.99.4-raspberrypi3 Not Installed 4.99.4 armv7vehf-neon-vfpv4 +944d2d5a AGL-snapshots-master-latest-intel-corei7-64 Not Installed 4.99.3+snapshot corei7-64 +cf3a4365 AGL-release-dab-4.0.2-qemux86-64 Not Installed 4.0.2 corei7-64 +d65fe750 AGL-release-eel-latest-qemux86-64 Not Installed 4.99.3 corei7-64 +a0ae663d poky-agl-corei7-64-3.99.1+snapshot Installed 3.99.1+snapshot corei7-64 +87f0400b AGL-release-dab-3.99.3-m3ulcb-nogfx Installed 3.99.3 aarch64 +8c2f2841 AGL-release-dab-4.0.2-dragonboard-410c Not Installed 4.0.2 aarch64 +... + +# Install a SDK (downloaded + install) +xds-cli sdks install d65fe750 + +Installation of 'AGL-release-eel-latest-qemux86-64' SDK successfully started. +Downloading poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-4.99.5.sh ... +--2018-01-02 11:22:23-- https://download.automotivelinux.org/AGL/release/eel/latest/qemux86-64/deploy/sdk/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-4.99.5.sh +Resolving download.automotivelinux.org (download.automotivelinux.org)... 199.19.213.77 +Connecting to download.automotivelinux.org (download.automotivelinux.org)|199.19.213.77|:443... connected. +HTTP request sent, awaiting response... 200 OK +Length: 665996704 (635M) [application/x-sh] +Saving to: ‘/tmp/tmp.wuQzLdImCS/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-4.99.5.sh’ + + 0K .......... .......... .......... .......... .......... 0% 82,7K 2h11m + 50K .......... .......... .......... .......... .......... 0% 89,1K 2h6m + 100K .......... .......... .......... .......... .......... 0% 82,0K 2h8m +... + 50300K .......... .......... .......... .......... .......... 99% 2,15M 0s + 650350K .......... .......... .......... ....... 100% 4,04M=10m35s + +2018-01-02 12:17:06 (1024 KB/s) - ‘/tmp/tmp.CWyEj3z76Q/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-4.99.5.sh’ saved [665996704/665996704] + +Automotive Grade Linux SDK installer version 5.0.0 +=================================================== +You are about to install the SDK to "/xdt/sdk/poky-agl/5.0.0/corei7-64". Proceed[Y/n]? Y +Extracting SDK....................................................................................................................done +Setting it up...done +SDK has been successfully set up and is ready to be used. +Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. + $ . /xdt/sdk/poky-agl/5.0.0/corei7-64/environment-setup-corei7-64-agl-linux + +SDK ID d65fe750-d3a7-38f5-83d8-3d3806054f8d successfully installed. + + +# Abort an installation that is in progress +xds-cli sdks abort -id d65fe750 + +# Install a SDK (using a local SDK package/file) +xds-cli sdks install --file $HOME/xds-workspace/sdks/poky-agl-glibc-x86_64-agl-demo-platform-crosssdk-corei7-64-toolchain-5.0.0.sh + +``` + + +Installation based on a local SDK package is only supported when SDK file package +is located in `$HOME/xds-workspace/sdks` directory + + +### Install a new SDK from XDS Dashboard + +Open XDS-Dashboard in web-browser and select `SDKs` entry in left side menu. + +Then switch to `SDKs MANAGEMENT` view : + +![](../part-1/pictures/xds-dashboard-sdks-mgt.png){:: style="margin:auto; display:flex"} + +Use filter boxes to find the SDK you want to install and then click on plus +icon (Actions column) to start installation. + +SDK download and installation process may take several minutes and output of installation script (output of `add` script mentioned in above chapter). + +![](../part-1/pictures/xds-dashboard-sdks-install.png){:: style="margin:auto; display:flex"} + +Note that you can abort installation by clicking on `CANCEL` button. + +### Un-install a SDK from command line + +Used `sdks` command of `xds-cli` tool to managed SDKs. + +```bash +# List installed SDKs +xds-cli sdks ls +List of installed SDKs: + ID NAME STATUS VERSION ARCH + c39e5998 poky-agl_aarch64_4.0.1 Installed 4.0.1 aarch64 + d610bfbf poky-agl-aarch64.current_on_iotbzh_download-3.99.1+snapshot Installed 3.99.1+snapshot aarch64.current_on_iotbzh_download + a0ae663d poky-agl-corei7-64-3.99.1+snapshot Installed 3.99.1+snapshot corei7-64 + 87f0400b AGL-release-dab-3.99.3-m3ulcb-nogfx Installed 3.99.3 aarch64 + 352c0584 poky-agl-corei7-64-3.99.2+snapshot Installed 3.99.2+snapshot corei7-64 + d65fe750 AGL-release-eel-latest-qemux86-64 Installed 4.99.5 corei7-64 + +# Un-install a SDK +xds-cli sdks uninstall d65fe750 +SDK ID d65fe750-d3a7-38f5-83d8-3d3806054f8d successfully deleted. +``` + +### Un-install a SDK from XDS Dashboard + +Open XDS-Dashboard in web-browser and select `SDKs` entry in left side menu. + +If needed, switch to `BASIC SDKS VIEW` view and click on trash icon located +in the top-right corner of SDK card. + +## XDS server REST API and Web application + +`xds-server` exposes a REST API and serves a basic web-application. + +REST API based url is `http://localhost:8000/api/v1/` when XDS server is +running on your host (localhost) and basic web-application is available at +[http://localhost:8000](http://localhost:8000). + +Just replace `localhost` by the host name or ip when `xds-server` is running +on another host. + +```bash +# Get version using REST API +curl http://localhost:8000/api/v1/version + +# Open browser and local xds-server web-application +xdg-open http://localhost:8000 +``` + +Then follow instructions provided on this page to install and start `xds-agent` +that must run locally on your machine. + +See also [xds-agent documentation](../2_xds-agent/0_abstract.html) for more details. diff --git a/docs/part-2/1_xds-server/3_build.md b/docs/part-2/1_xds-server/3_build.md new file mode 100644 index 0000000..8be3b33 --- /dev/null +++ b/docs/part-2/1_xds-server/3_build.md @@ -0,0 +1,73 @@ +# Build xds-server from scratch + +## Dependencies + +Install [Go](https://golang.org/doc/install), [npm](https://www.npmjs.com/), +[nodejs](https://nodejs.org/en/) and some other tools. + +Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details. + +## 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/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: + +```bash +export GOPATH=${GOPATH}:${ROOTDIR} + +mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds +cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds +git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-server +# or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-server +cd xds-server +make all +``` + +And to install `xds-server` (by default in `/opt/AGL/xds/server`): + +```bash +make install +``` + + +**Warning:** + +Makefile install rule and default values in configuration file are set +to fit the docker setup. + +So you may need to adapt some settings when you want to install xds-server natively. + + + +**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 +``` diff --git a/docs/part-2/1_xds-server/4_debug.md b/docs/part-2/1_xds-server/4_debug.md new file mode 100644 index 0000000..2b36697 --- /dev/null +++ b/docs/part-2/1_xds-server/4_debug.md @@ -0,0 +1,36 @@ +# Debugging + +## XDS server architecture + +The server part is written in *Go* and web app (basic HTML) in *Angular4*. + +```bash +| ++-- bin/ # where xds-server binary file will be built +| ++-- conf.d/ # Linux configuration and startup files (systemd user service) +| ++-- glide.yaml # Go package dependency file +| ++-- lib/ # sources of server part (Go) +| ++-- LICENSE # XDS server license +| ++-- main.go # main entry point of of Web server (Go) +| ++-- Makefile # makefile including +| ++-- README.md # +| ++-- scripts/ # hold various scripts used for installation or startup +| ++-- test/ # XDS test suite +| ++-- tools/ # temporary directory to hold development tools (like glide) +| ++-- vendor/ # temporary directory to hold Go dependencies packages +| ++-- webapp/ # source client basic web application +``` + +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 deleted file mode 100644 index 1429715..0000000 --- a/docs/part-2/2_xds-agent.md +++ /dev/null @@ -1,201 +0,0 @@ -# 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://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git), a web server -used to remotely cross build applications. - -## Configuration - -xds-agent configuration is driven by a JSON config file. - -The tarball mentioned in previous section includes this file with default settings. - -Here is the logic to determine which conf file will be used: - -1. from command line option: `--config myConfig.json` -1. `$HOME/.xds/agent/agent-config.json` file -1. `/etc/xds/agent/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 -- **webAppDir** : location of client webapp / dashboard (default: webapp/dist) -- **logsDir** : directory to store logs (eg. syncthing output) -- **xdsServers** : an array of xds-server object - - **xdsServers.url**: url of xds-server to connect to -- **syncthing**: a object defining syncthing settings - - **syncthing.binDir** : syncthing binaries directory (default: executable directory) - - **syncthing.home"** : syncthing home directory (usually .../syncthing-config) - - **syncthing.gui-address** : syncthing gui url (default ) - - **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated) - -```json -{ - "httpPort": "8800", - "webAppDir": "./www", - "logsDir": "${HOME}/.xds/agent/logs", - "xdsServers": [ - { - "url": "http://localhost:8000" - } - ], - "syncthing": { - "home": "${HOME}/.xds/agent/syncthing-config", - "gui-address": "http://localhost:8386", - "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. - -## Build xds-agent from scratch - -### Dependencies - -Install [Go](https://golang.org/doc/install), [npm](https://www.npmjs.com/), -[nodejs](https://nodejs.org/en/) and some other tools. -Refer to [Prerequisites chapter](./0_Abstract.html#prerequisites) for more details. - -### Building - -Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: - -```bash - mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-agent - # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-agent - 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 follow these steps. - -The first time you need to install all the windows-amd64 standard packages on -your system with - -```bash -# List all supported OS / ARCH -go tool dist list - -# Install all standard packages for another OS/ARCH (eg. windows amd64) -GOOS=windows GOARCH=amd64 go install -v -a std -``` - -Then compile and package xds-agent using provided makefile - -```bash -export GOOS=windows -export GOARCH=amd64 -make all -make package -``` - -## Debugging - -### XDS agent architecture - -The agent part is written in *Go* and the webapp / dashboard is in *typescript + Angular4*. - -```bash -| -+-- bin/ where xds-server binary file will be built -| -+-- conf.d Linux configuration and startup files (systemd user service) -| -+-- 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 basic webapp / dashboard -``` - -### Debug - -Visual Studio Code launcher settings can be found into `.vscode/launch.json`. - ->**Tricks:** -> ->To debug both `xds-agent` and `xds-server` or common code ->`xds-common`, it may be useful use the same local sources. -> ->So you should replace `xds-server` + `xds-common` in `vendor` directory by a symlink. -> ->So clone first `xds-server` + `xds-common` sources next to `xds-agent` directory. - -You should have the following tree: - -```bash -tree -L 5 --charset=ascii src/ -src/ -`-- gerrit.automotivelinux.org - `-- gerrit - `-- src - `-- xds - |-- backup.sh - |-- xds-agent - |-- xds-cli - |-- xds-common - |-- xds-docs - |-- xds-gdb - `-- xds-server -``` - -Then invoke `vendor/debug` Makefile rule to create a symlink inside vendor -directory : - -```bash -cd src/gerrit.automotivelinux.org/gerrit/src/xds/xds-agent -make vendor/debug -``` diff --git a/docs/part-2/2_xds-agent/0_abstract.md b/docs/part-2/2_xds-agent/0_abstract.md new file mode 100644 index 0000000..d73bdb9 --- /dev/null +++ b/docs/part-2/2_xds-agent/0_abstract.md @@ -0,0 +1,19 @@ +# 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://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git), a web server +used to remotely cross build applications. + +--- + +Links to subchapters : + +- [Configuration](./1_config.html) +- [Start-up](./2_start.html) +- [Build from scratch](./3_build.html) +- [Debugging](./4_debug.html) diff --git a/docs/part-2/2_xds-agent/1_config.md b/docs/part-2/2_xds-agent/1_config.md new file mode 100644 index 0000000..9e912cb --- /dev/null +++ b/docs/part-2/2_xds-agent/1_config.md @@ -0,0 +1,47 @@ +# Configuration + +xds-agent configuration is driven by a JSON config file. + +The tarball mentioned in previous section includes this file with default settings. + +Here is the logic to determine which conf file will be used: + +1. from command line option: `--config myConfig.json` +1. `$HOME/.xds/agent/agent-config.json` file +1. `/etc/xds/agent/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 +- **webAppDir** : location of client webapp / dashboard (default: webapp/dist) +- **logsDir** : directory to store logs (eg. syncthing output) +- **xdsServers** : an array of xds-server object + - **xdsServers.url**: url of xds-server to connect to +- **syncthing**: a object defining syncthing settings + - **syncthing.binDir** : syncthing binaries directory (default: executable directory) + - **syncthing.home"** : syncthing home directory (usually .../syncthing-config) + - **syncthing.gui-address** : syncthing gui url (default ) + - **syncthing.gui-apikey** : syncthing api-key to use (default auto-generated) + +```json +{ + "httpPort": "8800", + "webAppDir": "./www", + "logsDir": "${HOME}/.xds/agent/logs", + "xdsServers": [ + { + "url": "http://localhost:8000" + } + ], + "syncthing": { + "home": "${HOME}/.xds/agent/syncthing-config", + "gui-address": "http://localhost:8386", + "gui-apikey": "1234abcezam" + } +} +``` + +>**Note:** +> +>environment variables are supported by using `${MY_VAR}` syntax. diff --git a/docs/part-2/2_xds-agent/2_start.md b/docs/part-2/2_xds-agent/2_start.md new file mode 100644 index 0000000..8ff0b1d --- /dev/null +++ b/docs/part-2/2_xds-agent/2_start.md @@ -0,0 +1,14 @@ +# 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. diff --git a/docs/part-2/2_xds-agent/3_build.md b/docs/part-2/2_xds-agent/3_build.md new file mode 100644 index 0000000..ce1407d --- /dev/null +++ b/docs/part-2/2_xds-agent/3_build.md @@ -0,0 +1,58 @@ +# Build xds-agent from scratch + +## Dependencies + +Install [Go](https://golang.org/doc/install), [npm](https://www.npmjs.com/), +[nodejs](https://nodejs.org/en/) and some other tools. + +Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details. + +## Building + +Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: + +```bash + mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds + cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds + git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-agent + # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-agent + 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 follow these steps. + +The first time you need to install all the windows-amd64 standard packages on +your system with + +```bash +# List all supported OS / ARCH +go tool dist list + +# Install all standard packages for another OS/ARCH (eg. windows amd64) +GOOS=windows GOARCH=amd64 go install -v -a std +``` + +Then compile and package xds-agent using provided makefile + +```bash +export GOOS=windows +export GOARCH=amd64 +make all +make package +``` diff --git a/docs/part-2/2_xds-agent/4_debug.md b/docs/part-2/2_xds-agent/4_debug.md new file mode 100644 index 0000000..9490c4b --- /dev/null +++ b/docs/part-2/2_xds-agent/4_debug.md @@ -0,0 +1,69 @@ +# Debugging + +## XDS agent architecture + +The agent part is written in *Go* and the webapp / dashboard is in *typescript + Angular4*. + +```bash +| ++-- bin/ where xds-server binary file will be built +| ++-- conf.d Linux configuration and startup files (systemd user service) +| ++-- 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 basic webapp / dashboard +``` + +## Debug + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. + +>**Tricks:** +> +>To debug both `xds-agent` and `xds-server` or common code +>`xds-common`, it may be useful use the same local sources. +> +>So you should replace `xds-server` + `xds-common` in `vendor` directory by a symlink. +> +>So clone first `xds-server` + `xds-common` sources next to `xds-agent` directory. + +You should have the following tree: + +```bash +tree -L 5 --charset=ascii src/ +src/ +`-- gerrit.automotivelinux.org + `-- gerrit + `-- src + `-- xds + |-- backup.sh + |-- xds-agent + |-- xds-cli + |-- xds-common + |-- xds-docs + |-- xds-gdb + `-- xds-server +``` + +Then invoke `vendor/debug` Makefile rule to create a symlink inside vendor +directory : + +```bash +cd src/gerrit.automotivelinux.org/gerrit/src/xds/xds-agent +make vendor/debug +``` diff --git a/docs/part-2/3_xds-cli.md b/docs/part-2/3_xds-cli.md deleted file mode 100644 index ade25f8..0000000 --- a/docs/part-2/3_xds-cli.md +++ /dev/null @@ -1,233 +0,0 @@ -# xds-cli: command-line tool for XDS - -`xds-cli` is a command-line tool for X(cross) Development System. - -## Configuration - -`xds-cli` configuration is defined either by environment variables or by -setting command line options. - -Configuration through environment variables may also be defined in a file that -will be sourced by `xds-cli` on start-up. - -Use `--config|-c` option or set `XDS_CONFIG` environment variable to specify the config file to use. - -So configuration is driven either by environment variables or by command line -options or using a config file knowing that the following priority order is used: - -1. use option value (for example use project ID set by `--id` option), -1. else use variable `XDS_xxx` (for example `XDS_PROJECT_ID` variable) when a - config file is specified with `--config|-c` option, -1. else use `XDS_xxx` (for example `XDS_PROJECT_ID`) environment variable - - -**Note:** - -All parameters after a double dash (--) are considered as the command -to execute on xds-server. - - -### Global Options / Configuration variables - -Following is the list of global options across all sub-commands. - -__`--config|-c` option or `XDS_CONFIG` env variable__ - -Env config file to source on startup - -__`--log|-l` option or `XDS_LOGLEVEL` env variable__ - -Logging level, supported levels are: - -- panic -- fatal -- error -- warn -- info -- debug - -Default level is "error". - -**`--rpath` option or `XDS_PATH` env variable** - -Relative path into project - -**`timestamp|-ts` option or `XDS_TIMESTAMP` env variable** - -Prefix output with timestamp - -**`url` option or `XDS_AGENT_URL` env variable** - -Local XDS agent url (default: "localhost:8800") - -## Commands - -### projects - -`projects` (short `prj`) command should be used to managed XDS projects. - -This command supports following sub-commands: - -```bash -add, a Add a new project -get Get a property of a project -list, ls List existing projects -remove, rm Remove an existing project -sync Force synchronization of project sources -``` - -Here are some usage examples: - -```bash -# Create/declare a new project -xds-cli prj add --label "ABeautifulName" --type pm -p /home/seb/xds-workspace/myProject -sp /home/devel/xds-workspace/myProject - -# List projects -xds-cli prj ls - -# Delete an existing project -xds-cli prj rm 8e49 -``` - -### sdks - -`sdks` (alias `sdk`) command should be used to managed cross SDKs. - -This command supports following sub-commands: - -```bash -add, a Add a new SDK -get Get a property of a SDK -list, ls List installed SDKs -remove, rm Remove an existing SDK -``` - -Here are some usage examples: - -```bash -# List existing SDKs -xds-cli sdks ls - -# Get SDK info -xds-cli sdks get c64d -``` - -### exec - -`exec` command should be used to exec command through XDS system. - -For example you can use this command to build your project in XDS system. - -This command supports following sub-commands: - -`exec` command options are: - -**`--id` option or `XDS_PROJECT_ID` env variable (**mandatory option**)** - -project ID you want to build - -**`--rpath` (short `-p`) or `XDS_RPATH` env variable** - -relative path into project - -**`--sdkid` (alias `--sdk`) or `XDS_SDK_ID` env variable (**mandatory option**)** - -Cross Sdk ID to use to build project. - -Here are some usage examples: - -```bash -cd $MY_PROJECT_DIR -mkdir build - -# Generate build system using cmake -xds-cli exec --id=4021 --sdkid=c226 -- "cd build && cmake .." - -# Build the project -xds-cli exec --id=4021 --sdkid=c226 -- "cd build && make all" -``` - -In case of `xds-agent` is not running on default url:port (that is `localhost:8800`) - -You can specify the url using `--url` option : - -```bash -xds-cli --url=http://localhost:8800 exec --id=4021 --sdkid=c226 -- "cd build && make all" -``` - -### misc - -`misc` command allows to execute miscellaneous sub-commands such as: - -```bash -version, v Get version of XDS agent and XDS server -status, sts Get XDS configuration status (including XDS server connection) -``` - -Here are some usage examples: - -```bash -xds-cli misc version --verbose - -xds-cli misc sts -``` - -## How to build - -### Dependencies - -Install [Go](https://golang.org/doc/install) and some other tools. -Refer to [Prerequisites chapter](./0_Abstract.html#prerequisites) for more details. - -### Building - -Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: - -```bash - export GOPATH=$(realpath ~/workspace_go) - mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-cli - # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-cli - cd xds-cli - make -``` - -## Debug - -Visual Studio Code launcher settings can be found into `.vscode/launch.json`. - ->**Tricks:** -> ->To debug both `xds-cli` and `xds-agent` (REST API part) or common -code `xds-common`, it may be useful use the same local sources. -> ->So you should replace `xds-agent` + `xds-common` in `vendor` directory by a symlink. -> ->So clone first `xds-agent` + `xds-common` sources next to `xds-cli` directory. - -You should have the following tree: - -```bash -tree -L 5 --charset=ascii src/ -src/ -`-- gerrit.automotivelinux.org - `-- gerrit - `-- src - `-- xds - |-- backup.sh - |-- xds-agent - |-- xds-cli - |-- xds-common - |-- xds-docs - |-- xds-gdb - `-- xds-server -``` - -Then invoke `vendor/debug` Makefile rule to create a symlink inside vendor -directory : - -```bash -cd src/gerrit.automotivelinux.org/gerrit/src/xds/xds-cli -make vendor/debug -``` diff --git a/docs/part-2/3_xds-cli/0_abstract.md b/docs/part-2/3_xds-cli/0_abstract.md new file mode 100644 index 0000000..df7db6c --- /dev/null +++ b/docs/part-2/3_xds-cli/0_abstract.md @@ -0,0 +1,15 @@ +# xds-cli: command-line tool for XDS + +`xds-cli` is a command-line tool for X(cross) Development System. + +This tool can be used in addition to `XDS Dashboard` to control XDS from command +line. + +--- + +Links to subchapters : + +- [Configuration](./1_config.html) +- [Start-up](./2_commands.html) +- [Build from scratch](./3_build.html) +- [Debugging](./4_debug.html) diff --git a/docs/part-2/3_xds-cli/1_config.md b/docs/part-2/3_xds-cli/1_config.md new file mode 100644 index 0000000..6dc7993 --- /dev/null +++ b/docs/part-2/3_xds-cli/1_config.md @@ -0,0 +1,57 @@ +# Configuration + +`xds-cli` configuration is defined either by environment variables or by +setting command line options. + +Configuration through environment variables may also be defined in a file that +will be sourced by `xds-cli` on start-up. + +Use `--config|-c` option or set `XDS_CONFIG` environment variable to specify the config file to use. + +So configuration is driven either by environment variables or by command line +options or using a config file knowing that the following priority order is used: + +1. use option value (for example use project ID set by `--id` option), +1. else use variable `XDS_xxx` (for example `XDS_PROJECT_ID` variable) when a + config file is specified with `--config|-c` option, +1. else use `XDS_xxx` (for example `XDS_PROJECT_ID`) environment variable + + +**Note:** + +All parameters after a double dash (--) are considered as the command +to execute on xds-server. + + +## Global Options / Configuration variables + +Following is the list of global options across all sub-commands. + +__`--config|-c` option or `XDS_CONFIG` env variable__ + +Env config file to source on startup + +__`--log|-l` option or `XDS_LOGLEVEL` env variable__ + +Logging level, supported levels are: + +- panic +- fatal +- error +- warn +- info +- debug + +Default level is "error". + +**`--rpath` option or `XDS_PATH` env variable** + +Relative path into project + +**`timestamp|-ts` option or `XDS_TIMESTAMP` env variable** + +Prefix output with timestamp + +**`url` option or `XDS_AGENT_URL` env variable** + +Local XDS agent url (default: "localhost:8800") diff --git a/docs/part-2/3_xds-cli/2_commands.md b/docs/part-2/3_xds-cli/2_commands.md new file mode 100644 index 0000000..b5e0c0a --- /dev/null +++ b/docs/part-2/3_xds-cli/2_commands.md @@ -0,0 +1,119 @@ +# Commands + +## projects + +`projects` (short `prj`) command should be used to managed XDS projects. + +This command supports following sub-commands: + +```bash +add, a Add a new project +get Get a property of a project +list, ls List existing projects +remove, rm Remove an existing project +sync Force synchronization of project sources +``` + +Here are some usage examples: + +```bash +# Create/declare a new project +xds-cli prj add --label "myProjectName" --type pm -p /home/seb/xds-workspace/myProject -sp /home/devel/xds-workspace/myProject + +# List projects +xds-cli prj ls + +# Delete an existing project +xds-cli prj rm 8e49 +``` + +## sdks + +`sdks` (alias `sdk`) command should be used to managed cross SDKs. + +This command supports following sub-commands: + +```bash +get Get a property of a SDK +list, ls List installed SDKs +install, i Install a SDK +uninstall, rm UnInstall an existing SDK +abort, a Abort an install action +``` + +Here are some usage examples: + +```bash +# List existing SDKs +xds-cli sdks ls + +# Get SDK info +xds-cli sdks get c64d +``` + + +**Note:** + +Please also refer to [Installing AGL SDKs](../../part-1/3_install-sdks.html) chapter for more details about sdks installation. + + + +## exec + +`exec` command should be used to exec command through XDS system. + +For example you can use this command to build your project in XDS system. + +This command supports following sub-commands: + +`exec` command options are: + +**`--id` option or `XDS_PROJECT_ID` env variable (**mandatory option**)** + +project ID you want to build + +**`--rpath` (short `-p`) or `XDS_RPATH` env variable** + +relative path into project + +**`--sdkid` (alias `--sdk`) or `XDS_SDK_ID` env variable (**mandatory option**)** + +Cross Sdk ID to use to build project. + +Here are some usage examples: + +```bash +cd $MY_PROJECT_DIR +mkdir build + +# Generate build system using cmake +xds-cli exec --id=4021 --sdkid=c226 -- "cd build && cmake .." + +# Build the project +xds-cli exec --id=4021 --sdkid=c226 -- "cd build && make all" +``` + +In case of `xds-agent` is not running on default url:port (that is `localhost:8800`) + +You can specify the url using `--url` option : + +```bash +xds-cli --url=http://localhost:8800 exec --id=4021 --sdkid=c226 -- "cd build && make all" +``` + +## misc + +`misc` command allows to execute miscellaneous sub-commands such as: + +```bash +version, v Get version of XDS agent and XDS server +status, sts Get XDS configuration status (including XDS server connection) +``` + +Here are some usage examples: + +```bash +xds-cli misc version --verbose + +xds-cli misc sts +``` diff --git a/docs/part-2/3_xds-cli/3_build.md b/docs/part-2/3_xds-cli/3_build.md new file mode 100644 index 0000000..ba2d83b --- /dev/null +++ b/docs/part-2/3_xds-cli/3_build.md @@ -0,0 +1,21 @@ +# How to build + +## Dependencies + +Install [Go](https://golang.org/doc/install) and some other tools. + +Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details. + +## Building + +Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: + +```bash + export GOPATH=$(realpath ~/workspace_go) + mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds + cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds + git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-cli + # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-cli + cd xds-cli + make +``` diff --git a/docs/part-2/3_xds-cli/4_debug.md b/docs/part-2/3_xds-cli/4_debug.md new file mode 100644 index 0000000..38628db --- /dev/null +++ b/docs/part-2/3_xds-cli/4_debug.md @@ -0,0 +1,38 @@ +# Debug + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. + +>**Tricks:** +> +>To debug both `xds-cli` and `xds-agent` (REST API part) or common +code `xds-common`, it may be useful use the same local sources. +> +>So you should replace `xds-agent` + `xds-common` in `vendor` directory by a symlink. +> +>So clone first `xds-agent` + `xds-common` sources next to `xds-cli` directory. + +You should have the following tree: + +```bash +tree -L 5 --charset=ascii src/ +src/ +`-- gerrit.automotivelinux.org + `-- gerrit + `-- src + `-- xds + |-- backup.sh + |-- xds-agent + |-- xds-cli + |-- xds-common + |-- xds-docs + |-- xds-gdb + `-- xds-server +``` + +Then invoke `vendor/debug` Makefile rule to create a symlink inside vendor +directory : + +```bash +cd src/gerrit.automotivelinux.org/gerrit/src/xds/xds-cli +make vendor/debug +``` diff --git a/docs/part-2/4_xds-gdb.md b/docs/part-2/4_xds-gdb.md deleted file mode 100644 index 96f5498..0000000 --- a/docs/part-2/4_xds-gdb.md +++ /dev/null @@ -1,133 +0,0 @@ -# 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 agent/server setup. That allows you to easily cross debug your application. - - By default XDS debug model is used and you need to define `XDS_NATIVE_GDB` -variable to use native gdb debug mode instead. - -> **SEE ALSO**: [xds-agent](https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-agent.git), a local agent -used to interface xds-server. -> **SEE ALSO**: [xds-server](https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git), a REST API server -used to remotely cross build applications. -> **SEE ALSO**: [xds-cli](https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-cli.git), XDS command line tool. - -## 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 config file: - -```bash -cat $HOME/myProject/xds-gdb.env - -export XDS_AGENT_URL=http://localhost:8800 -export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b -export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 -``` - -`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 XDS mode. - -`XDS_PROJECT_ID` *(mandatory in XDS mode)* - -Project ID you want to build - -`XDS_RPATH` - -Relative path into project - -`XDS_SDK_ID` *(mandatory in XDS mode)* - -Cross Sdk ID to use to build project - -`XDS_AGENT_URL` - -Local XDS agent url (default `http://localhost:8800`) - -### 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=4021617e-ced0-11e7-acd2-3c970e49ad9b - # :XDS-ENV: XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 -``` - -## How to build xds-gdb from scratch - -### Dependencies - -Install [Go](https://golang.org/doc/install) and some other tools. -Refer to [Prerequisites chapter](./0_Abstract.html#prerequisites) for more details. - -### Building - -Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: - -```bash - export GOPATH=$(realpath ~/workspace_go) - mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-gdb - # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-gdb - cd xds-gdb - make -``` - -## Debug - -Visual Studio Code launcher settings can be found into `.vscode/launch.json`. diff --git a/docs/part-2/4_xds-gdb/0_abstract.md b/docs/part-2/4_xds-gdb/0_abstract.md new file mode 100644 index 0000000..d282efa --- /dev/null +++ b/docs/part-2/4_xds-gdb/0_abstract.md @@ -0,0 +1,24 @@ +# 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 agent/server setup. That allows you to + easily cross debug your application. + + By default XDS debug model is used and you need to define `XDS_NATIVE_GDB` +variable to use native gdb debug mode instead. + +--- + +Links to subchapters : + +- [Configuration](./1_config.html) +- [Build from scratch](./2_build.html) +- [Debugging](./3_debug.html) diff --git a/docs/part-2/4_xds-gdb/1_config.md b/docs/part-2/4_xds-gdb/1_config.md new file mode 100644 index 0000000..8568f18 --- /dev/null +++ b/docs/part-2/4_xds-gdb/1_config.md @@ -0,0 +1,86 @@ +# 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 config file: + +```bash +cat $HOME/myProject/xds-gdb.env + +export XDS_AGENT_URL=http://localhost:8800 +export XDS_PROJECT_ID=4021617e-ced0-11e7-acd2-3c970e49ad9b +export XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +``` + +`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 XDS mode. + +`XDS_PROJECT_ID` *(mandatory in XDS mode)* + +Project ID you want to build + +`XDS_RPATH` + +Relative path into project + +`XDS_SDK_ID` *(mandatory in XDS mode)* + +Cross Sdk ID to use to build project + +`XDS_AGENT_URL` + +Local XDS agent url (default `http://localhost:8800`) + +## 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=4021617e-ced0-11e7-acd2-3c970e49ad9b + # :XDS-ENV: XDS_SDK_ID=c226821b-b5c0-386d-94fe-19f807946d03 +``` diff --git a/docs/part-2/4_xds-gdb/2_build.md b/docs/part-2/4_xds-gdb/2_build.md new file mode 100644 index 0000000..5cc0ca8 --- /dev/null +++ b/docs/part-2/4_xds-gdb/2_build.md @@ -0,0 +1,21 @@ +# How to build xds-gdb from scratch + +## Dependencies + +Install [Go](https://golang.org/doc/install) and some other tools. + +Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details. + +## Building + +Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: + +```bash + export GOPATH=$(realpath ~/workspace_go) + mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds + cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds + git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-gdb + # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-gdb + cd xds-gdb + make +``` diff --git a/docs/part-2/4_xds-gdb/3_debug.md b/docs/part-2/4_xds-gdb/3_debug.md new file mode 100644 index 0000000..80554ec --- /dev/null +++ b/docs/part-2/4_xds-gdb/3_debug.md @@ -0,0 +1,3 @@ +# Debug + +Visual Studio Code launcher settings can be found into `.vscode/launch.json`. diff --git a/docs/part-2/5_xds-exec.md b/docs/part-2/5_xds-exec.md deleted file mode 100644 index 4a36f87..0000000 --- a/docs/part-2/5_xds-exec.md +++ /dev/null @@ -1,5 +0,0 @@ -# xds-exec: wrapper on exec for XDS - -`xds-exec` is now deprecated and has been replaced `exec` command of `xds-cli`. - -Please refer to [xds-cli documentation](3_xds-cli.html) for more details. -- cgit 1.2.3-korg