Skip to content

Commit d9e5859

Browse files
pfeerickclaude
andauthored
chore: update Ubuntu 22.04 build environment script and docs (#7209)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5dfb435 commit d9e5859

2 files changed

Lines changed: 121 additions & 106 deletions

File tree

Lines changed: 62 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Build Instructions under Ubuntu 22.04
22

3+
Last tested with Ubuntu 22.04.5 LTS in March 2026.
4+
35
The document here is meant to help you develop or test changes to EdgeTX on your PC, not to build flight/radio safe version of binaries.
46

57
- [Setting up the build environment for EdgeTX](#setting-up-the-build-environment-for-edgetx)
@@ -8,7 +10,7 @@ The document here is meant to help you develop or test changes to EdgeTX on your
810

911
## Setting up the build environment for EdgeTX
1012

11-
You can setup Ubuntu 22.04 on bare-metal, inside a virtual machine environment, or using WSL2 under Windows 10. For WSL2 installation, please see a dedicated page about it: [Setting up Ubuntu 20.04 in a Windows Subsystem for Linux](linux-wsl.md).
13+
You can setup Ubuntu 22.04 on bare-metal, inside a virtual machine environment, or using WSL2 under Windows 10/11. For WSL2 installation, please see a dedicated page about it: [Setting up Ubuntu in a Windows Subsystem for Linux](linux-wsl.md).
1214

1315
* Download [Ubuntu 22.04](https://ubuntu.com/download/desktop) and install it (using Minimal installation type is sufficient. Allow _Download updates while installing Ubuntu_. 3rd party software is not required, unless you need this for graphics or WiFi adapter on your PC).
1416
* When the installer has finished and the obligatory reboot is done, log in. Install updates using Software Updater (click _Activities_ in top left corner, type in _Software Updater_ and press _Enter_). **Restart** the PC and log in again after reboot.
@@ -17,12 +19,12 @@ You can setup Ubuntu 22.04 on bare-metal, inside a virtual machine environment,
1719
wget https://raw.githubusercontent.com/EdgeTX/edgetx/main/tools/setup_buildenv_ubuntu22.04.sh
1820
```
1921
```
20-
chmod a+x setup_buildenv_ubuntu22.04.sh
22+
chmod +x setup_buildenv_ubuntu22.04.sh
2123
```
2224
```
2325
./setup_buildenv_ubuntu22.04.sh
2426
```
25-
* If all went smoothly, you should not have seen any errors.
27+
* If all went smoothly, you should not have seen any errors, and should have been informed that setup was finished.
2628

2729
If you are interested to see what the script does or which functions it calls, you can open it in a text editor and have look at it - it's pretty self-explanatory (_gedit_ for example in Ubuntu is a text editor with syntax highlighting). You can alternatively start the script with _--pause_ argument to stop the script execution after each step to better inspect the output. To achieve this, issue `./setup_buildenv_ubuntu22.04.sh --pause` as the last command in the above list instead.
2830

@@ -43,43 +45,45 @@ We will next fetch the EdgeTX source files from the GitHub main development bran
4345
git clone --recursive -b main https://github.com/EdgeTX/edgetx.git edgetx_main
4446
```
4547
```
46-
cd edgetx_main && mkdir build-output && cd build-output
48+
cd edgetx_main && mkdir build-output
4749
```
4850

4951
To build EdgeTX, we need to minimally specify the radio target, but can further select or de-select a number of build-time options. The following command will create a text-file list of all options for you to look at and saves it in current user home directory:
5052
```
51-
cmake -LAH ../ > ~/edgetx_main-cmake-options.txt
53+
cmake -LAH -S . > ~/edgetx_main-cmake-options.txt
5254
```
5355

5456
You can use, e.g. _gedit_ under Ubuntu to view the file.
5557

56-
As an example, we will build next for RadioMaster TX16S (PCB=X10, PCBREV=TX16S), mode 2 default stick (DEFAULT_MODE=2), global variables enabled (GVARS=YES), servo output unit as microseconds (PPM_UNIT=US), include Lua mixer script support (LUA_MIXER=YES) and selected the type as a Debug build with debug symbols included (CMAKE_BUILD_TYPE=Debug). The CMake command for this is (issue the following without line breaks and be sure to include at the end the two dots and a slash exactly as here listed):
58+
As an example, we will build next for RadioMaster TX16S (PCB=X10, PCBREV=TX16S), mode 2 default stick (DEFAULT_MODE=2, will otherwise default to mode 1) and selected the type as a Debug build with debug symbols included (CMAKE_BUILD_TYPE=Debug). The CMake command for this is:
5759
```
58-
cmake -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DLUA_MIXER=YES -DCMAKE_BUILD_TYPE=Debug ../
60+
cmake --fresh -S . -B build-output -Wno-dev -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DCMAKE_BUILD_TYPE=Debug
5961
```
6062
If you do not want to include the debug symbols, use `-DCMAKE_BUILD_TYPE=Release` instead.
6163

62-
To build for other radios, you just need to select another build target by specifying appropriate values for `PCB` and `PCBREV` for your radio. If you are are wanting to build for multiple different targets, it is best to use a different build folder for each. Otherwise, delete the `CMakeCache.txt` file from the build directory before before running `cmake` to configure a different transmitter build, otherwise cached configuration values from your previous build target will cause weird compile results. As a tip, which values to use, have a look at a Python script according to your radio manufacturer in a file named `build-<radio-manufacturer>.py` under [https://github.com/EdgeTX/edgetx/tree/main/tools](https://github.com/EdgeTX/edgetx/tree/main/tools)
64+
To build for other radios, you just need to select another build target by specifying appropriate values for `PCB` and `PCBREV` for your radio. It is best to use a different build folder for each target. As a tip for which values to use, have a look at a Python script according to your radio manufacturer in a file named `build-<radio-manufacturer>.py` under [https://github.com/EdgeTX/edgetx/tree/main/tools](https://github.com/EdgeTX/edgetx/tree/main/tools)
6365

64-
Starting with 2.8, an additional step is required. Issue:
66+
It is recommended to set the `CMAKE_BUILD_PARALLEL_LEVEL` environment variable to the number of CPU cores on your system, to speed up all subsequent builds:
6567
```
66-
make configure
68+
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
6769
```
68-
Alternatively, you can issue `make arm-none-eabi-configure` if you only want to build radio firmware or `make native-configure` if you only want to build targets meant to be run on computer (running `make configure` activates both architecture targets).
6970

70-
Only a few seconds later, you should be greeted with "-- Generating done" message.
71+
To configure, issue:
72+
```
73+
cmake --build build-output --target arm-none-eabi-configure
74+
```
7175

72-
The configure process generates the _makefile_ that is required in the next step to build the firmware. For this, issue:
76+
To build the firmware, issue:
7377
```
74-
make -j`nproc` firmware
78+
cmake --build build-output --target firmware --parallel
7579
```
76-
This process can take some minutes to complete (the parameter -j'nproc' instructs the make to use as many parallel threads as the current system has CPU cores. This speeds up the build quite significantly).
77-
If successful, you should find a firmware binary _firmware.bin_ in the current folder, that you can flash into your radio.
7880

79-
It's a good idea to rename the binary, so that it is easier later to see the target radio and which options were baked into it. For this, issue in the build folder, e.g.:
81+
This process can take some minutes to complete.
82+
If successful, you should find a firmware binary _firmware.bin_ in the `build-output/arm-none-eabi` folder, that you can flash onto your radio.
83+
84+
It's a good idea to rename the binary, so that it is easier later to see the target radio and which options were baked into it. For this, issue e.g.:
8085
```
81-
cd arm-none-eabi
82-
mv firmware.bin edgetx_main_tx16s_lua-ppmus-mode2_debug.bin
86+
mv build-output/arm-none-eabi/firmware.bin edgetx_main_tx16s_mode2_debug.bin
8387
```
8488

8589
You will need to prepare a clean microSD card and fill it with the content according to your radio type from [https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest](https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest)
@@ -91,31 +95,57 @@ You can use [EdgeTX Buddy](https://buddy.edgetx.org/), [EdgeTX Companion](https:
9195

9296
## Building Companion, Simulator and radio simulator libraries
9397

94-
To build radio simulator library, issue in the same terminal as opened previously:
98+
### After EdgeTX 2.12
99+
100+
You can build firmware, the radio simulator module, Companion and Simulator all in one step:
95101
```
96-
make -j`nproc` libsimulator
102+
cmake --build build-output --parallel --target firmware --target wasi-module --target companion --target simulator
97103
```
98104

99-
From EdgeTX 2.10 onwards, Companion and Simulator only incorporate hardware definitions for radio simulated libraries built before they themselves are built.
105+
This will configure and download extra dependencies as needed. Alternately, if you only want to build the simulator module at this point, you can run
100106

101-
In order to build for other radio target, you need to re-run the `cmake` line above, with other `PCB` and `PCBREV` tags.
107+
```
108+
cmake --build build-output --parallel --target wasi-module
109+
```
110+
111+
The wasm simulator module is built into `build-output/wasm/wasm-build/` but Companion looks for it in `build-output/native/`. Copy it across before launching Companion or Simulator:
112+
```
113+
cp build-output/wasm/wasm-build/*.wasm build-output/native/
114+
```
102115

103-
After building all required radio simulator libraries, build the EdgeTX Companion binary, issue in the same terminal as opened previously:
116+
If you want to build simulator modules for multiple radio targets (so they are all available in Companion), the helper script `tools/build-wasm-modules.sh` can build all supported targets in one go:
104117
```
105-
make -j`nproc` companion
118+
tools/build-wasm-modules.sh . ./wasm-modules/
106119
```
107-
To launch Companion, change into `native` directory and issue: `./companion<ver>`
108-
where `<ver>` is EdgeTX version string in format of two digits. For example, for EdgeTX 2.9 use 29, thus `companion29`, for 2.10 `companion210` and so on.
120+
The `.wasm` files are output to `./wasm-modules/`. Copy them to `build-output/native/` before building Companion.
109121

110-
To build EdgeTX Simulator binary, issue:
122+
Change into the `native` directory, where `<ver>` is the EdgeTX version as digits (e.g. `212` for 2.12):
111123
```
112-
make -j`nproc` simulator
124+
cd build-output/native
113125
```
114126

115-
Before you run the simulator, copy the SD card content according to your radio target from [https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest](https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest) to your system and extract it e.g. to `~/edgetx/simu_sdcard/horus`
127+
To launch Companion:
128+
```
129+
./companion<ver>
130+
```
116131

117-
Also, you should create a radio profile first with `./companion<ver>`, before you can successfully run the full simulator.
132+
Before running the simulator, copy the SD card content for your radio target from [https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest](https://github.com/EdgeTX/edgetx-sdcard/releases/tag/latest) and extract it e.g. to `~/edgetx/simu_sdcard/horus`. You should also create a radio profile first in Companion before running the simulator.
118133

119-
To launch the simulator, change into `native` directory and issue: `./simulator<ver>`. In the dialog that pops up, select _SD Path_ as data source and under _SD Image Path:_ browse to `~/edgetx/simu_sdcard/horus`
134+
To launch the simulator:
135+
```
136+
./simulator<ver>
137+
```
138+
In the dialog that pops up, select _SD Path_ as data source and under _SD Image Path:_ browse to `~/edgetx/simu_sdcard/horus`
120139

121140
[![EdgeTX simulator on Linux](../assets/images/build/linux/EdgeTX_simulator_Linux.png)](../assets/images/build/linux/EdgeTX_simulator_Linux.png)
141+
142+
### Legacy: EdgeTX 2.10 to 2.12
143+
144+
From 2.10 onwards, Companion and Simulator only incorporate hardware definitions for radio simulator libraries built before they themselves are built. You need to build a `libsimulator` for each radio target you want to include.
145+
146+
To include additional radio targets, re-run the `cmake --fresh` configure command from above with different `PCB` and `PCBREV` values, then build `libsimulator` again for each **before** building Companion.
147+
148+
Build the radio simulator library for your target, then Companion and Simulator:
149+
```
150+
cmake --build build-output --parallel --target libsimulator --target companion --target simulator
151+
```

tools/setup_buildenv_ubuntu22.04.sh

Lines changed: 59 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ set -e
55
## Bash script to setup EdgeTX development environment on Ubuntu 22.04 running on bare-metal or in a virtual machine.
66
## Let it run as normal user and when asked, give sudo credentials
77

8+
QT_VERSION="6.9.3"
9+
GCC_ARM_VERSION="14.2.rel1"
10+
811
PAUSEAFTEREACHLINE="false"
912
STEP=1
1013
# Parse argument(s)
@@ -21,14 +24,23 @@ if [[ $(lsb_release -rs) != "22.04" ]]; then
2124
exit 1
2225
fi
2326

24-
echo "=== Step $((STEP++)): Checking if i386 requirement is satisfied ==="
25-
OUTPUT=x$(dpkg --print-foreign-architectures 2> /dev/null | grep i386) || :
26-
if [ "$OUTPUT" != "xi386" ]; then
27-
echo "Need to install i386 architecture first."
28-
sudo dpkg --add-architecture i386
29-
else
30-
echo "i386 requirement satisfied!"
31-
fi
27+
echo "=== Step $((STEP++)): Setting up package repositories ==="
28+
sudo apt-get -y install --no-install-recommends software-properties-common gpg gpg-agent wget ca-certificates
29+
sudo mkdir -p /etc/apt/keyrings
30+
# Set up Kitware repository for newer cmake
31+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
32+
gpg --dearmor - | sudo tee /etc/apt/keyrings/kitware-archive-keyring.gpg >/dev/null
33+
echo "deb [signed-by=/etc/apt/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main" | \
34+
sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
35+
# Set up NodeSource repository for Node.js 20.x
36+
wget -O - https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key 2>/dev/null | \
37+
gpg --dearmor - | sudo tee /etc/apt/keyrings/nodesource.gpg >/dev/null
38+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | \
39+
sudo tee /etc/apt/sources.list.d/nodesource.list >/dev/null
40+
# Set up Git PPA for newer git
41+
sudo add-apt-repository ppa:git-core/ppa --yes
42+
# Set up Rob Savoury's PPA for newer SDL2
43+
sudo add-apt-repository ppa:savoury1/multimedia --yes
3244
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
3345
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
3446
read
@@ -42,95 +54,100 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
4254
fi
4355

4456
echo "=== Step $((STEP++)): Installing packages ==="
45-
sudo apt-get -y install \
57+
sudo apt-get -y install --no-install-recommends \
4658
build-essential \
4759
cmake \
48-
gcc \
60+
kitware-archive-keyring \
4961
git \
50-
lib32ncurses-dev \
51-
lib32z1 \
52-
libsdl2-dev \
53-
software-properties-common \
54-
wget \
5562
zip \
56-
python3-pip-whl \
57-
python3-pil \
58-
libgtest-dev \
63+
unzip \
64+
file \
65+
gawk \
66+
libsdl2-dev \
67+
python3-dev \
5968
python3-pip \
60-
python3-tk \
6169
python3-setuptools \
70+
python3-tk \
71+
libcups2 \
72+
libssl-dev \
73+
libgtest-dev \
6274
clang \
63-
python3-clang \
64-
libusb-1.0-0-dev \
65-
stlink-tools \
66-
openocd \
67-
npm \
68-
pv \
69-
libncurses5:i386 \
70-
libpython2.7:i386 \
7175
libclang-dev \
7276
python-is-python3 \
73-
openssl
77+
dfu-util \
78+
nodejs \
79+
stlink-tools \
80+
openocd \
81+
pv
82+
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
83+
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
84+
read
85+
fi
86+
87+
echo "=== Step $((STEP++)): Installing lv_font_conv ==="
88+
sudo npm i lv_font_conv -g
7489
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
7590
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
7691
read
7792
fi
7893

7994
echo "=== Step $((STEP++)): Installing Python packages ==="
8095
sudo python3 -m pip install \
81-
filelock \
8296
asciitree \
8397
jinja2 \
84-
pillow==7.2.0 \
85-
clang==14.0.0 \
86-
future \
87-
lxml \
98+
pillow \
99+
clang \
88100
lz4 \
89101
aqtinstall \
90-
pyelftools
102+
pyelftools \
103+
pydantic
91104
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
92105
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
93106
read
94107
fi
95108

96109
echo "=== Step $((STEP++)): Installing Qt ==="
97-
./aqt install-qt --outputdir qt linux desktop 6.9.0 linux_gcc_64 -m qtmultimedia qtserialport
110+
sudo mkdir -p /opt/qt
111+
sudo chown "${USER}:${USER}" /opt/qt
112+
aqt install-qt --outputdir /opt/qt linux desktop ${QT_VERSION} linux_gcc_64 -m qtmultimedia qtserialport
98113
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
99114
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
100115
read
101116
fi
102117

103118
echo "=== Step $((STEP++)): Fetching GNU Arm Embedded Toolchains ==="
104-
# EdgeTX uses GNU Arm Embedded Toolchain version 14.2.rel1
105-
wget -q --show-progress --progress=bar:force:noscroll https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz
119+
wget -q --show-progress --progress=bar:force:noscroll https://developer.arm.com/-/media/Files/downloads/gnu/${GCC_ARM_VERSION}/binrel/arm-gnu-toolchain-${GCC_ARM_VERSION}-x86_64-arm-none-eabi.tar.xz
106120
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
107121
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
108122
read
109123
fi
110124

111125
echo "=== Step $((STEP++)): Unpacking GNU Arm Embedded Toolchains ==="
112-
pv arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz | tar xJf -
126+
pv arm-gnu-toolchain-${GCC_ARM_VERSION}-x86_64-arm-none-eabi.tar.xz | tar xJf -
113127
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
114128
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
115129
read
116130
fi
117131

118132
echo "=== Step $((STEP++)): Removing the downloaded archives ==="
119-
rm arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz
133+
rm arm-gnu-toolchain-${GCC_ARM_VERSION}-x86_64-arm-none-eabi.tar.xz
120134
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
121135
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
122136
read
123137
fi
124138

125139
echo "=== Step $((STEP++)): Moving GNU Arm Embedded Toolchains to /opt ==="
126-
sudo mv arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi /opt/gcc-arm-none-eabi
140+
sudo mv arm-gnu-toolchain-${GCC_ARM_VERSION}-x86_64-arm-none-eabi /opt/gcc-arm-none-eabi
127141
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
128142
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
129143
read
130144
fi
131145

132-
echo "=== Step $((STEP++)): Adding GNU Arm Embedded Toolchain to PATH of current user ==="
133-
echo 'export PATH="/opt/gcc-arm-none-eabi/bin:$PATH"' >> ~/.bashrc
146+
echo "=== Step $((STEP++)): Adding GNU Arm Embedded Toolchain and Qt to PATH of current user ==="
147+
cat >> ~/.bashrc << EOF
148+
export PATH="/opt/gcc-arm-none-eabi/bin:\$PATH"
149+
export PATH="/opt/qt/${QT_VERSION}/gcc_64/bin:\$PATH"
150+
EOF
134151
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
135152
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
136153
read
@@ -143,37 +160,5 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
143160
read
144161
fi
145162

146-
echo "=== Step $((STEP++)): Fetching USB DFU host utility ==="
147-
wget -q --show-progress --progress=bar:force:noscroll http://dfu-util.sourceforge.net/releases/dfu-util-0.11.tar.gz
148-
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
149-
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
150-
read
151-
fi
152-
153-
echo "=== Step $((STEP++)): Unpacking USB DFU host utility ==="
154-
pv dfu-util-0.11.tar.gz | tar xzf -
155-
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
156-
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
157-
read
158-
fi
159-
160-
echo "=== Step $((STEP++)): Building and Installing USB DFU host utility ==="
161-
cd dfu-util-0.11/
162-
./configure
163-
make
164-
sudo make install
165-
cd ..
166-
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
167-
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
168-
read
169-
fi
170-
171-
echo "=== Step $((STEP++)): Removing the downloaded archive and build folder of USB DFU host utility ==="
172-
rm dfu-util-0.11.tar.gz
173-
rm -rf dfu-util-0.11
174-
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
175-
echo "Step finished."
176-
fi
177-
178163
echo "Finished setting up EdgeTX development environment."
179164
echo "Please execute: source ~/.bashrc"

0 commit comments

Comments
 (0)