Skip to content

Portenta X8: Foundries.io review #454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 10, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TEST_CMD="python3 --help"
```

### Docker-compose.yml
This file defines the app name through the factory, permissions and settings for the involved containers. The argument in the image tag will make it so our image file builds locally.
This file defines the app name through the Factory, permissions and settings for the involved containers. The argument in the image tag will make it so our image file builds locally.

```python
version: '3.6'
Expand Down Expand Up @@ -122,9 +122,9 @@ if __name__ == '__main__':

## Uploading the Container Folder

First, you have to have set up your board to a factory, as shown in the [Portenta X8 Out of the Box tutorial](https://docs.arduino.cc/tutorials/portenta-x8/out-of-the-box).
First, you have to have set up your board to a Factory, as shown in the [Portenta X8 Out of the Box tutorial](https://docs.arduino.cc/tutorials/portenta-x8/out-of-the-box).

Once this is done, we will push our folder to a repository within the factory. Lets place our folder "x8-custom-test" inside the "containers.git" repository. You can find this repository inside your factory page, if you click on "Source". And then on "container.git", the url of this page will be used in the next command.
Once this is done, we will push our folder to a repository within the Factory. Lets place our folder "x8-custom-test" inside the "containers.git" repository. You can find this repository inside your Factory page, if you click on "Source". And then on "container.git", the url of this page will be used in the next command.

![Source on Foundries.io Factory page](assets/custom-factory-page.png)

Expand All @@ -138,19 +138,17 @@ In order to pull or push repositories you have to generate an API key. This can

![Token section in user settings](assets/token-page.png)

Use the following command in a Linux shell, like ADB which the previously mentioned tutorial showed how to set up. To get the repository on your board, replace the "YOUR_FACTORY" with the name of your factory. The "-m" tag selects the manifest file within the repository. If no manifest name is selected, the default is "default.xml". And the "-b" tag specifies a revision. Running this command will get the container repository, where we will put our folder.
Use the following command in a Linux shell, like ADB which the previously mentioned tutorial showed how to set up. To get the repository on your board, replace "YOUR_FACTORY" with the name of your Factory. The "-b" parameter specifies a branch to checkout after cloning the repository. Running this command will get the container repository, where we will put our folder.

```python
repo init -u https://source.foundries.io/factories/YOUR_FACTORY/containers.git -m arduino.xml -b devel
```
git clone https://source.foundries.io/factories/YOUR_FACTORY/containers.git -b devel
```

We can also run ```repo sync``` to get the latest version of the repository. Put the "x8-custom-test" folder in the repository. If you push the commit to "container.git" a new target will automatically build on your Foundries.io Factory page.

***NOTE: The "repo sync" will at some point pause. This is because it is waiting for a username and password but the prompt will be hidden. Enter the username and password to move on.***
Put the "x8-custom-test" folder in the repository. If you push the commit to "containers.git" a new target will automatically build on your FoundriesFactory, you can inspect it in the "Targets" page.

### Building and Running the Container

After uploading the folder to the repository. Navigate into the "x8-custom-test" folder, that should be located on your board now. This allows us to build our container with a simple command. Using ```docker build``` with a ```--tag``` will let us give the container a tag so we can easily keep track of what version of the build this is.
After the build is finished, it can take up to 10 minutes for your device to OTA update to this new version. You can inspect it via the "Devices" tab of your FoundriesFactory. After your device takes the update, navigate into the "x8-custom-test" folder, that should be located on your board now. This allows us to build our container with a simple command. Using ```docker build``` with a ```--tag``` will let us give the container a tag so we can easily keep track of what version of the build this is.

```python
docker build --tag "x8-custom-test:latest" .
Expand Down Expand Up @@ -184,7 +182,7 @@ docker-compose stop

## Conclusion

This tutorial went through what goes into a container, how the folder should be built and what files it should contain. It then explained what each files purpose is and what they should contain for this example. Then we went through how this relates back to the factory, and how Foundries.io makes the whole process easier for us. We then showed how to build the container and run it on the Portenta X8. Lastly, we showed a useful testing feature with docker-compose. Which lets us test our container with a faster process.
This tutorial went through what goes into a container, how the folder should be built and what files it should contain. It then explained what each files purpose is and what they should contain for this example. Then we went through how this relates back to the Factory, and how Foundries.io makes the whole process easier for us. We then showed how to build the container and run it on the Portenta X8. Lastly, we showed a useful testing feature with docker-compose. Which lets us test our container with a faster process.

### Next Steps

Expand All @@ -196,4 +194,4 @@ To get a better understanding of how to manage containers with Docker, take a lo
Here are some errors that might occur in the process of this tutorial:

- Make sure you have followed our other tutorials that shows how to set up the [Portenta X8 out of the box](https://docs.arduino.cc/tutorials/portenta-x8/out-of-the-box)
- If you are having issues with the adb shell, don't forget to try and use `sudo` and `su`
- If you are having issues with the adb shell, don't forget to try and use `sudo` and `su`
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The Arduino Portenta X8's processor **NXP® i.MX 8M Mini Processor** can be used

There are two ways to get the container, either through `foundriesFactories` or downloading the container from [portenta-containers repository](https://github.com/arduino/portenta-containers)

**With Foundries:**
**With Foundries.io:**

If you use [Foundries.io](https://www.foundries.io) you can switch the current `target` of your device to `x-kiosk-imx8-webgl` by switching the app from a terminal on your computer:

Expand Down Expand Up @@ -176,7 +176,7 @@ To save the changes press the **ESC** key and type `:wq` this will write and qui

## Conclusion

In this tutorial we went through how to connect the board and display something on a screen. Using a container from foundriesFactories or by downloading it and uploading it to your Portenta X8. Lastly, we showed how to edit the video output by editing the container.
In this tutorial we went through how to connect the board and display something on a screen. Using a container from FoundriesFactories or by downloading it and uploading it to your Portenta X8. Lastly, we showed how to edit the video output by editing the container.

### Next Steps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ Required files following this structure:

```
Root folder
├── imx-boot
├── imx-boot-portenta-x8
├── lmp-partner-arduino-image-portenta-x8.wic.gz **(Unzipped)**
├── mfgtool-files-portenta-x8.tar **(Unzipped)**
├── lmp-partner-arduino-image-portenta-x8.wic.gz **(Compressed)**
├── mfgtool-files-portenta-x8.tar.gz **(Compressed)**
├── sit-portenta-x8.bin
└── u-boot-portenta-x8.itb
```
Expand All @@ -58,7 +57,7 @@ To get those files:

Go to the `lmp-manifest` [GitHub repository](https://github.com/arduino/lmp-manifest) and open the [releases](https://github.com/arduino/lmp-manifest/releases) section, there you will find a compressed `.tar.gz` with all the required files.

#### Through Foundries
#### Through Foundries.io

Open your FoundriesFactory®.

Expand All @@ -76,7 +75,7 @@ On the "Runs" section open those collapsed labels, and download the files listed

![Foundries.io target runs section](assets/foundries-factories-target-runs.png)

After downloading them, make sure you put them in a folder following the structure shown.
After downloading them, make sure you put them in a folder following the structure shown and extract the compressed files.

### Set the Portenta X8 to Flashing Mode

Expand All @@ -102,7 +101,7 @@ Switch back the DIP switches to OFF position.

Unplug and then plug in the Portenta X8 to your computer.

***After flashing you will need to wait 10 secs, until the Portenta X8 blue LED starts blinking, this means the boot was successful***
***After booting you will need to wait 10 secs, until the Portenta X8 blue LED starts blinking, this means the boot was successful***

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ software:

## Connecting to the Board

Once the Portenta X8 is plugged in via USB, you can open your browser and go to http://192.168.7.1 if you use Windows and Linux or http://192.168.8.1 on MacOS. This web page is hosted on the Portenta X8, from this dashboard you will be able to:
Once the Portenta X8 is plugged in via USB, you can open your browser and go to http://192.168.7.1 if you use Windows and Linux or http://192.168.8.1 on MacOS. It can take up to 15 seconds for the board to boot up and make the page available. This web page is hosted on the Portenta X8, from this dashboard you will be able to:

![Board set up page](assets/x8-oob-main.png)

* [Configure Wi-Fi](#connecting-to-your-wi-fi)
* [Add your device to a factory (OTA)](#add-a-new-device-to-your-factory)
* [Add your device to a FoundriesFactory (OTA)](#add-a-new-device-to-your-factory)
* Board details
* Shell (alpine python)

Expand All @@ -59,36 +59,36 @@ Once it is connected, you should see the Wi-Fi status bullet in the bottom left

***You can change your network by clicking on the button again and repeat the above steps***

## Connect to a Factory
## Connect to a FoundriesFactory

### Register the Factory on Foundries.io
### Register the FoundriesFactory on Foundries.io

***The integration with Foundries.io requires the Arduino Pro Cloud Subscription, contact us at [Arduino Pro Inquiries](https://www.arduino.cc/pro/contact-us), or learn more on the [Arduino Pro Page](https://www.arduino.cc/pro/hardware/product/portenta-x8#pro-cloud)***
Go to [https://create.arduino.cc](https://create.arduino.cc) and click on portenta-X8 board manager, you will get prompted to set a new `Factory` name if you didn't have one before. You will not be able to be change the name later, so use one that you can remember and write easily.
Go to [https://create.arduino.cc](https://create.arduino.cc) and click on Portenta X8 Board Manager, you will get prompted to set a new `Factory` name if you didn't have one before. You will not be able to be change the name later, so use one that you can remember and write easily.

![Arduino Cloud integration](assets/cloud-main.png)

It will redirect you to the Foundries.io factory registration page.
It will redirect you to the FoundriesFactory registration page.

![Foundries Factory creation](assets/foundries-create-factory.png)

Then you can go to [https://app.foundries.io/factories](https://app.foundries.io/factories) and it will show the factory you just created.
Then you can go to [https://app.foundries.io/factories](https://app.foundries.io/factories) and it will show the Factory you just created.

![Foundries Factories](assets/foundries-factories.png)

After you have created your Foundries.io factory you need to go back to the Portenta-X8 web dashboard to add a new device into your new factory.
After you have created your FoundriesFactory you need to go back to the Portenta-X8 web dashboard to add a new device into your new Factory.

### Add A New Device To Your Factory

Click the "Register Factory name" button.

![Register factory button](assets/x8-oob-main-factory.png)
![Register Factory button](assets/x8-oob-main-factory.png)

![Factory connection](assets/x8-oob-factory-name.png)

The next panel gives you a code that you need to copy.

![Device factory token](assets/x8-oob-factory-register.png)
![Device Factory token](assets/x8-oob-factory-register.png)

Click on the "Complete registration" button on the Portenta X8 dashboard

Expand All @@ -100,29 +100,29 @@ Confirm the addition of the new device by pressing "Connect"

![Foundries device confirmation](assets/foundries-activation-prompt.png)

Finally you will see a confirmation which means that your device now is attached to the new factory.
Finally you will see a confirmation which means that your device now is attached to the new Factory.

![Dashboard with a factory attached](assets/foundries-activation-success.png)
![Dashboard with a Factory attached](assets/foundries-activation-success.png)

Once it is completed, the factory button on the Portenta X8 dashboard will turn green.
Once it is completed, the Factory button on the Portenta X8 dashboard will turn green.

![Successful connection](assets/x8-oob-factory-success.png)

#### Check Your Factory
#### Check Your FoundriesFactory

Have a look to your factories by going to [Foundries.io factories page](https://app.foundries.io/factories)

![Foundries.io factories page](assets/foundries-factories.png)

Select the factory that you want to check and it will open its dashboard.
Select the Factory that you want to check and it will open its dashboard.

![Foundries.io Factory dashboard](assets/foundries-factory-dashboard.png)

#### Check Your Device

You can check if your device is fully connected to your factory by going to the "devices" tab.
You can check if your device is fully connected to your Factory by going to the "devices" tab.

![Foundries.io factory devices page](assets/foundries-factory-devices.png)
![Foundries.io Factory devices page](assets/foundries-factory-devices.png)

Then choose the device you want to check by clicking on its box and it will open its page.

Expand Down Expand Up @@ -170,18 +170,21 @@ To check your manager connection status, use this command:

`nmcli de`

### Register Device to the Factory
### Register Device to the FoundriesFactory

Make sure the name is not already being used in your Factory.

`lmp-device-register -n <newDeviceName>`

**Not recommended:** In case you cannot register the new device, you can erase the current device info by removing `/var/sota/sql.db`
**Not recommended:** In case you cannot register the new device, you can erase the current device info by stopping the OTA services and removing `/var/sota/sql.db`. After these commands, you can register the device again.

`sudo systemctl stop aktualizr-lite`
`sudo systemctl stop fioconfig.path`
`sudo systemctl stop fioconfig.service`
`sudo rm /var/sota/sql.db`

### Inspecting Real Time Tasks

Run: `journalctl -f` to see what's going on on the device

![Real time tasks on CLI](assets/command-journalctl.png)
![Real time tasks on CLI](assets/command-journalctl.png)
Loading