Skip to content

Commit 63ff83f

Browse files
authored
Merge pull request #95 from arduino/benjamindannegard/x8-foundations-tutorial
[PC-879] Benjamindannegard/x8 foundations tutorial
2 parents 1eb93e1 + be6e5a5 commit 63ff83f

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: Portenta X8 Foundations
3+
difficulty: easy
4+
tags: [Linux, containers, factories, foundries]
5+
description: This article contains information about the fundamental concepts of the Portenta X8
6+
author: Benjamin Dannegård
7+
hardware:
8+
- hardware/04.pro/board/portenta-x8
9+
software:
10+
- fioctl
11+
12+
---
13+
14+
## Overview
15+
16+
The Portenta X8 is one of the more advanced boards available from Arduino. And with that comes some new concepts that are not standard for Arduino boards. In this article we will go through some of the foundations of the Portenta X8 and help you understand how the board works and how you can benefit from the advanced features of this board. You will learn about factories and how containers on the Portenta X8 work.
17+
18+
## Goals
19+
20+
- Get in-depth information about how the Portenta X8 works
21+
- Learn how containers work
22+
23+
### Required Hardware and Software
24+
25+
- [Portenta X8](https://store.arduino.cc/portenta-x8)
26+
- [fioctl](https://docs.foundries.io/latest/getting-started/install-fioctl/index.html)
27+
28+
## Instructions
29+
30+
If you need help with setting up your board then please have a look at the "Getting Started" tutorial. That tutorial will show you how to set up your board with a factory and install containers on it.
31+
32+
## Embedded Linux
33+
34+
To work in an embedded Linux environment there a few things to consider. When approaching linux-based embedded devices software solutions, you need to provide a base distribution, a mechanism to update it and some applications that can run on the board. The X8 uses a Yocto Linux distribution as the base platform and applications are installed packaged as confined containers.
35+
36+
A ready-made Linux distribution that packages everything seems most attractive for end users but you need to find a distribution that implements the function that you need. If you need to tweak them you may end up in a mess of patches on the top of someone else's build system. On the other hand, a generic distribution has some problems since installing software over it may pollute the original system and cause issues when updating the base platform. For example you install a new application and the older one no longer works. In addition to that you have to implement a lot of things like cybersecurity functions and system updates. Finally, your solution may rely on a too "generic" distribution, with tons of software you don't need. So you may end up removing a lot of software on the target and also turning features on and off. Until you mess up things or you need to update the system and you restart with a new fresh image and restart everything from the beginning.
37+
38+
### Benefits of Foundries.io
39+
40+
Foundries.io basically created their generic-but-not-too-generic distribution based on Yocto with minimal software installed, by default implementing top level cybersecurity features like OP-TEE and OSTREE that makes their solution ideal for professional applications. A custom OTA system update mechanism which is based on a client running on target and a robust cloud server. And they married Docker-compose as a way to deploy a software solution to a target. This is like having an app store for a particular device with the difference that we're not installing an app but a container which may contain a whole distribution or a minimal distribution running only our app or our set of apps.
41+
42+
In addition to that they developed the cloud side as well. In a nutshell you can have what's called a Factory with a unique id and then you have automatic builds that are building the base system and the containers for this system in one place. When you flash a device (i.e. Portenta X8 board) with their image and connect it to the Internet it automatically register its self generated random rsa key to the factory. Let's now take a look at the Foundries.io Factory page.
43+
44+
### Foundries.io Factory
45+
46+
With the help of the Arduino Cloud integration with Foundries you can easily create your own factory right from the Arduino Cloud page. You can set your factory's platform and name. The platform here will be the Portenta X8.
47+
48+
![Factory page](assets/factory-page.png)
49+
50+
Your factory page allows you to add members, so that you can easily keep track of the members of your team that should have access to the Portenta X8's that are linked to your factory. You can also set up teams for better management. On the page you can also find a list of all devices linked to the factory, along with their name and version of container that is currently uploaded to the board. On the containers page you can find all the different versions of containers uploaded to the factory.
51+
52+
On the "source" page of your factory, you can find the four repositories that are used to customize the images. These are:
53+
54+
- **ci-scripts.git**: CI scripts to build images for all the machines that need to be built.
55+
- **lmp-manifest.git**: Index of the repositories to be downloaded by repository to create the source work tree.
56+
- **meta-subscriber-overrides.git**: Yocto layer containing Arduino specific customizations (machine definition, device drivers, etc).
57+
- **containers.git**: Container recipes
58+
59+
While the "targets" page contains the images built by the Continuous integration system each time something is committed in the repositories. Committing to a repository will trigger building a target which can then be inspected in the "targets" page. Each target will compile for multiple platforms (as specified in the ci-scripts.git) and will generate all the required files to program the target.
60+
61+
## Containers
62+
63+
Containers allow for easy deployment of Linux based processes, uploaded through git, which can then be tracked on your factory page. A Linux container are processes that are isolated from the rest of the system. A container is an image file that contains all the files that are necessary to run it. This makes the Linux containers portable and consistent throughout development, testing and production. Making them much quicker to use than development pipelines that rely on replicating traditional testing environments.
64+
65+
Foundries provides a service that allows building images based on yocto and specifically built around the Linux Micro Platform distribution they maintain. LMP distribution contains an extensive set of software components needed for IoT applications.
66+
67+
Using [fioctl](https://docs.foundries.io/82/getting-started/install-fioctl/index.html) allows you to manage your boards through CLI. This will make it possible for you to easily upload containers to a board that is linked to your factory. When the board is online and connected to the factory you can easily push new apps to the board. Using fioctl command lines you only need to state the factory, board and app.
68+
69+
### Benefits of Containers
70+
71+
For example if you are developing an application on a laptop and your environment has a specific configuration. Other developers may have slightly different configurations. The application will rely on your configuration and is dependent on specific files, libraries and dependencies. While your business has development and production environments with their own configurations and supporting files. You would want to emulate that environment as much as possible locally.
72+
73+
With containers you can make your app work across environments, pass quality assurance and get it deployed as fast and easy as possible.
74+
75+
The contents of a container image can be compared to a an installation of a Linux distribution complete with RPM packages, configuration files, etc. However, a container image distribution is easier to install rather than a new copy of the operating system.
76+
77+
A Linux container is a good solution for solutions that require portability, configurability and isolation. The idea behind Linux containers is to be able to develop solutions faster to meet business needs as they arise. In certain scenarios, like when real-time data streaming is implemented, containers are the only way to provide the scalability that the application needs. Regardless of the infrastructure on site, in the cloud, or a mix of both.
78+
79+
## Conclusion
80+
81+
Now you should have a better understanding of how the Portenta X8 works with factories and containers. This article also gives a better picture of how to utilize the Portenta X8 to its full potential. Be sure to check out our other tutorials with the Portenta X8 to see how to practically use factories and containers.

0 commit comments

Comments
 (0)