You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/04.pro/boards/portenta-x8/tutorials/image-building/content.md
+75-50
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
beta: true
3
3
title: 'How To Build a Custom Image for Your Portenta X8'
4
-
description: 'This tutorial teaches you how to compile a custom image for your Portenta X8'
4
+
description: 'This tutorial teaches you how to compile a custom image for your Portenta X8.'
5
5
difficulty: advanced
6
6
tags:
7
7
- Embedded Linux
@@ -14,24 +14,24 @@ hardware:
14
14
15
15
## Overview
16
16
17
-
In this tutorial you will learn how to build an image for the Portenta X8 with the source code provided at our [GitHub repository for lmp-manifest](https://github.com/arduino/lmp-manifest).
18
-
Building your image locally can help debug certain aspects of the system, such as the bootloader or kernel support.
17
+
In this tutorial, you will learn how to build an image for the Portenta X8 with the source code provided at our [GitHub repository for lmp-manifest](https://github.com/arduino/lmp-manifest). Building your image locally can help debug several aspects of the system, such as the bootloader or kernel support.
19
18
20
-
***Keep in mind that images built locally cannot register with FoundriesFactory and will not be OTA compatible, but this is a good alternative for those who do not have a FoundriesFactory subscription.
21
-
This tutorial targets customers that are not FoundriesFactory subscribers, but still want to extend the functionality of the Arduino pre-built sources by building their own images. For FoundriesFactory subscribers, we strongly suggest making use of your Factory's continuous integration system for creating images.***
19
+
***Images built locally cannot register with FoundriesFactory and will not be OTA compatible, but this is a good alternative for those who do not have a FoundriesFactory subscription.***
20
+
21
+
This tutorial targets customers that are not FoundriesFactory subscribers, but still want to extend the functionality of the Arduino pre-built sources by building their images. For FoundriesFactory subscribers, we strongly suggest making use of your Factory's continuous integration system for image creation.
@@ -40,108 +40,124 @@ This tutorial targets customers that are not FoundriesFactory subscribers, but s
40
40
41
41
#### Build the Docker Image
42
42
43
-
You will create a Docker image that has the dependencies needed to build your device image.
43
+
You will create a Docker image that has the dependencies needed to build your device image. To do so, you will need to clone our [lmp-manifest repository](https://github.com/arduino/lmp-manifest). The following steps will guide you through the process:
44
44
45
-
To do so you will need to clone our [lmp-manifest repository](https://github.com/arduino/lmp-manifest), follow these steps to do so:
45
+
First, clone the lmp-manifest repository with the following command:
46
46
47
-
First, clone the lmp-manifest repository with this command:
After cloning the lmp-manifest repository successfully, we will proceed to build the Docker Image using following command sequence:
54
+
55
+
```
56
+
cd lmp-manifest
57
+
docker build -t yocto-build ./lmp-manifest
58
+
```
59
+
60
+

61
+
62
+
You will be able to see similar result if everything went successfully.
59
63
60
64
#### Run The Docker Image (Builder)
61
65
62
-
Run the image with the `-v` argument to mount a volume. This allows you to use a host directory inside the Docker image, so you can store all the data and build artifacts safely.
66
+
Once the *Docker Image* is ready, we will run the image with the `-v` argument to mount a volume. This allows you to use a host directory inside the Docker image, so you can store all the data and build artifacts safely.
63
67
64
68
***If you do not use a volume while running the image, you will lose the data when the image stops***
65
69
66
-
Run the `yocto-build` builder image with:
70
+
Run the `yocto-build` builder image with following command:
71
+
67
72
```
68
73
docker run -v <source>:/dockerVolume -it yocto-build bash
69
74
```
70
75
71
-
Switch to the `builder` user with the following command, the password is **builder**:
76
+
We need to switch to the `builder` user with the following command after the previous process, and the password is **builder**:
77
+
72
78
```
73
79
su builder
74
80
```
75
81
76
-
### Setup and Build
82
+
### Image Setup and Build
77
83
78
84
***You can download a [bash script](assets/portenta-x8_build.sh) that wraps all the upcoming steps.***
79
85
80
86
#### Setup the Environment
81
87
82
88
Now that you are running inside the Docker Image, you can use tools like **git-repo**, which is already installed.
83
89
84
-
First configure git with your credentials. They don't need to be the real ones, but are required by `git-repo` to pull.
85
-
Copy and paste the following:
90
+
First, configure git with your credentials. They don't need to be the real ones but are required by `git-repo` to pull. The following commands can be used for this example:
91
+
86
92
```
87
93
git config --global user.email "you@example.com"
88
94
git config --global user.name "Your Name"
89
95
```
96
+
90
97

91
98
92
99
Change to the home directory, and initialize the repository using **repo**:
***NOTE: If you are a FoundriesFactory subscriber and want to build your Factory sources locally, please use the manifest link for your Factory as below. This is not recommended as images built locally cannot register to the Factory and receive OTAs.***
110
121
111
-
#### Set Up The Portenta X8 Distribution
122
+
#### Set Up the Portenta X8 Distribution
112
123
113
-
You can set `DISTRO` to:
114
-
-`lmp-base`: insecure image without ostree, developer friendly, not OTA compatible
124
+
It is recommendable to set `DISTRO` to either:
125
+
126
+
-`lmp-base`: insecure image without ostree, developer-friendly, not OTA compatible
115
127
-`lmp`: secure image without xwayland
116
128
-`lmp-xwayland`: secure image with xwayland support
117
129
118
-
***`lmp-partner-arduino-image` will be better supported in the near future.***
130
+
It will help to classify the image if it follows any of the previous characteristics and with the following command:
To start building the image, following command is used:
135
151
136
152
```
137
153
bitbake lmp-partner-arduino-image
138
154
```
139
-
***This process takes ~7h depending on the build host***
155
+
156
+
***This process may take ~7 hours depending on the build host***
140
157
141
158

142
159
143
-
In case you want to use your computer while it builds, (which is going to take time and resources) you should lower the threads used.
144
-
Do so by opening `conf/local.conf` and lower the values of the following variables:
160
+
If you want to use your computer while it builds, it is recommendable to lower the threads used since it takes a lot of resources and time. Do so by opening `conf/local.conf` and lowering the values of the following variables:
145
161
146
162
-`BB_NUMBER_PARSE_THREADS = "4"`
147
163
-`BB_NUMBER_THREADS = "4"`
@@ -150,36 +166,44 @@ And add:
150
166
151
167
-`PARALLEL_MAKE = "-j 4"`
152
168
153
-
Once it finishes you will see something similar to:
169
+
If possible, it is a good practice to understand the available threads of your computer used for this process, to optimize the resources accordingly for optimal balance between build performance and side tasks while waiting for the build. Once it finishes you will see something similar to:
To flash your board you will need to compile **lmp-mfgtool distro** to get additional tools. First go into your home folder and change `DISTRO`:
175
+
To flash your board, you will need to compile **lmp-mfgtool distro** to get additional tools. First, go into your home folder and change `DISTRO` following the command sequence:
***This process takes ~2h depending on your build host***
202
+
***This process may take ~2 hours depending on your build host***
179
203
180
204
#### Save Your Image For Flashing
181
205
182
-
After a successful build, save the needed files to the host volume you mounted with `docker run`. Use the following commands to copy the files to your storage unit:
206
+
After a successful build, save the needed files to the host volume you mounted with `docker run`. Use the following commands to copy the files to your storage unit:
183
207
184
208
```
185
209
cd ..
@@ -199,15 +223,16 @@ tar xvf mfgtool-files-portenta-x8.tar.gz
199
223

200
224
201
225
You will be able to see the copied files in your OS file explorer.
202
-

203
226
227
+

204
228
205
229
## Conclusion
206
230
207
-
Now you have all the required files to flash the image you built onto the device.
231
+
In this tutorial, you have learned how to build a "builder" Docker image, get its required files, configure the build settings, build the image,a and to save the needed files for flashing. Now you have all the required files to flash the image you built onto the device.
232
+
233
+
## Next Steps
208
234
209
-
Please follow the [Flashing tutorial](image-flashing) to flash your device with your custom image.
210
-
Keep in mind you will need to use the files provided from this build, not the ones mentioned in the Flashing tutorial.
235
+
Please follow the [Flashing tutorial](image-flashing) to flash your device with your custom image. You can use the files provided from this build to flash the Portenta X8 following the tutorial's steps.
0 commit comments