Skip to content

Commit ca8b7ba

Browse files
committed
Add support for firmware 2.x/3.x
This change adds support for the new 2.x and 3.x firmwares which remove UbiOS.
1 parent 02ccbc2 commit ca8b7ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+243
-103249
lines changed

MAINTENANCE.md

-39
Original file line numberDiff line numberDiff line change
@@ -30,45 +30,6 @@ debuild -uc -us -aarm64 --lintian-opts --profile debian
3030
This will generate in the parent directory the Debian package which you can
3131
install on your device.
3232

33-
## Adding firmware support
34-
For every new firmware release for the UDM/P, the tools need to be updated to
35-
support the new release. This is necessary, since the kernel modules used by
36-
this project need to be compiled for every firmware release in order to work.
37-
38-
Usually, this process is straightforward:
39-
1. Create a directory for the new firmware version:
40-
```bash
41-
mkdir debian/config/vX.X.X
42-
```
43-
You can check the firmware version on your device as follows:
44-
```bash
45-
cat /etc/os-release
46-
```
47-
2. Obtain the kernel configuration of the kernel of the new firmware release. If
48-
you have installed the new firmware release already, you can obtain the config
49-
as follows:
50-
```bash
51-
scp root@IP-ADDRESS-UDM:/proc/config.gz debian/config/vX.X.X/config.udm.gz
52-
gunzip debian/config/vX.X.X/config.udm.gz
53-
```
54-
3. Create a configuration file for this firmware release at `debian/config/vX.X.X/config.mk`:
55-
```makefile
56-
UDM_VERSION = X.X.X
57-
# Commit on https://github.com/fabianishere/udm-kernel to build the kernel
58-
# modules against. Usually, taking the commit of the previous firmware version works.
59-
UDM_COMMIT = cbc07337f9f10c2330e7e1e1c5a4c7019967286f
60-
```
61-
4. Add support for the new firmware version when building the package in `debian/rules`:
62-
```makefile
63-
UDM_VERSIONS ?= 1.8.6 1.9.0 1.9.1 1.9.2 1.9.3 X.X.X
64-
```
65-
66-
**What issues can occur?**
67-
In some cases, a new firmware version ships kernel changes that are needed
68-
by the UniFi controller. In that case, using older kernels without these changes
69-
are unable to function correctly. Make sure the custom kernels still work on
70-
the new firmware version before publishing.
71-
7233
## Publishing a release
7334
To publish a release, tag the commit associated with the release:
7435
```bash

README.md

+16-72
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,18 @@ Machine (Pro).
44

55
## Introduction
66
The Ubiquiti [UniFi Dream Machine](https://unifi-network.ui.com/dreammachine)
7-
(UDM) and UDM Pro are a class of all-in-one network appliances built by Ubiquiti.
8-
These devices are powered by UbiOS, which uses Linux kernel under the hood.
7+
(UDM) and UDM Pro are a class of all-in-one network appliances built by Ubiquiti,
8+
which use the Linux kernel under the hood.
99

10-
However, the stock kernel on these devices lacks some important functionality
11-
needed for common use-cases (such as WireGuard as VPN or multicast routing support for IPTV).
12-
In many cases, this functionality can be enabled with a custom Linux kernel.
10+
The stock kernel on these devices lacks some important functionality needed for
11+
common use-cases (multipath routing, eBPF, containers). In many cases, this
12+
functionality can be enabled with a custom Linux kernel.
1313

1414
This repository provides tools to bootstrap a custom Linux kernel on the UDM/P.
1515
To prevent bricking your device, this tool does not overwrite the firmware of
16-
the device.
17-
Instead, it boots directly into the custom kernel from the stock kernel
18-
using [kexec](https://en.wikipedia.org/wiki/Kexec) (see [How it works](#how-it-works)).
19-
20-
## Use-cases
21-
There are currently several use-cases for using a custom kernel on the
22-
UniFi Dream Machine (Pro). These use-cases include:
23-
24-
1. **In-kernel [WireGuard](https://wireguard.com) support**
25-
Although you can already run a WireGuard server on your UDM/P using `wireguard-go` (see
26-
[udm-utilities](https://github.com/boostchicken/udm-utilities)), its performance
27-
will be reduced due to it running in user-space. A custom kernel enables your
28-
WireGuard VPN server to utilize the kernel implementation and run at full speed.
29-
2. **Multicast routing support**
30-
The stock kernel of the UDM/P does not support multicast routing which is
31-
needed for running `igmpproxy`. In turn, `igmpproxy` is needed to route
32-
multicast traffic between WAN and LAN, which is necessary for IPTV.
33-
See the [following guide](https://github.com/fabianishere/udm-iptv) for more information.
34-
3. [**Early boot modifications**](#overriding-files-on-root-pre-boot)
35-
Since changes to root filesystem on the UDM/P are non-persistent. It is not
36-
possible with the stock kernel to perform modification to the early boot
37-
process (since the [on-boot-script](https://github.com/boostchicken/udm-utilities/blob/master/on-boot-script/README.md) only runs after UniFi OS is started).
38-
This project enables you to modify the root filesystem before UbiOS is started.
39-
See [Overriding files on root pre-boot](#overriding-files-on-root-pre-boot) for more information.
16+
the device. Instead, it boots directly into the custom kernel from the stock
17+
kernel using [kexec](https://en.wikipedia.org/wiki/Kexec) (see [How it works](#how-it-works)).
18+
4019

4120
## Getting Started
4221
### Disclaimer
@@ -46,21 +25,14 @@ Make sure you know what you are doing and ensure you have a **backup**!
4625
I take no responsibility for any damage that might occur as result of using this
4726
project.
4827

49-
### Entering UniFi OS
50-
To start, SSH into your UniFi Dream Machine (Pro) and enter the UniFi OS shell
51-
as follows:
52-
```bash
53-
unifi-os shell
54-
```
55-
5628
### Installing udm-kernel-tools
5729
Select from the [Releases](https://github.com/fabianishere/udm-kernel-tools/releases) page
5830
the package version you want to install and download the selected Debian package,
5931
for instance:
6032

6133
```bash
62-
wget https://github.com/fabianishere/udm-kernel-tools/releases/download/v1.1.7/udm-kernel-tools_1.1.7_arm64.deb
63-
apt install ./udm-kernel-tools_1.1.7_arm64.deb
34+
wget https://github.com/fabianishere/udm-kernel-tools/releases/download/v2.0.0/udm-kernel-tools_2.0.0_arm64.deb
35+
apt install ./udm-kernel-tools_2.0.0_arm64.deb
6436
```
6537

6638
### Installing a custom kernel
@@ -110,18 +82,6 @@ To disable this functionality again, run the following command:
11082
systemctl disable udm-autoboot.service
11183
```
11284

113-
### Overriding files on root pre-boot
114-
Some users may wish to modify files on the root filesystem before UniFi OS boots
115-
(e.g., to hook into the early boot process).
116-
In order to facilitate this, `udm-kernel-tools` allows users to override files
117-
from the root filesystem using an overlay located at `/mnt/data/udm-kernel-tools/root`,
118-
119-
The overlay filesystem will be mounted *only* after running
120-
`mkdir -p /overlay/root_ro/mnt/data/udm-kernel-tools/root` from within the *UniFi OS* shell
121-
or when running `mkdir -p /data/udm-kernel-tools/root` from outside UniFi OS.
122-
123-
Note that changes to this directory only appear on the root filesystem after
124-
reboot.
12585

12686
### Restoring the stock kernel
12787
If you are running a custom kernel and wish to return the stock kernel, simply
@@ -141,19 +101,9 @@ apt remove 'udm-kernel*'
141101
This will remove the artifacts on your device related to this project.
142102

143103
## Compatibility
144-
Since the project requires firmware-specific binaries (e.g., kernel modules), you
145-
possibly need to upgrade the tools after you have upgraded to a new firmware version.
146-
Currently, the releases of this project support the following firmware versions:
147-
148-
- 1.8.6
149-
- 1.9.3
150-
- 1.10.0
151-
- 1.10.4
152-
- 1.11.0
153-
- 1.11.4
154-
- 1.12.22
155-
- 1.12.30
156-
- 1.12.33
104+
From version 2 onwards, only UniFi Dream Machine (Pro) firmware versions 2 and
105+
above are supported by this project. If you need support for older firmware,
106+
please install any of the versions below 2.
157107

158108
To build the project for custom firmware versions, please refer to the [Maintenance Guide](MAINTENANCE.md).
159109

@@ -185,7 +135,7 @@ be able to log back in to your device after a minute.
185135
Questions, suggestions and contributions are welcome and appreciated!
186136
You can contribute in various meaningful ways:
187137

188-
* Report a bug through [Github issues](https://github.com/fabianishere/udm-kernel-tools/issues).
138+
* Report a bug through [GitHub issues](https://github.com/fabianishere/udm-kernel-tools/issues).
189139
* Propose and document use-cases for using this project.
190140
* Contribute improvements to the documentation.
191141
* Provide feedback about how we can improve the project.
@@ -202,8 +152,8 @@ Although [udm-unlock](https://github.com/fabianishere/udm-unlock) can be used
202152
to overwrite the kernel boot image or root filesystem, such an approach is fragile
203153
and might lead to a bricked device.
204154

205-
To prevent touching the UDM/P firmware for booting a custom Linu kernel, we can
206-
employ Linux' [kexec](https://en.wikipedia.org/wiki/Kexec) functionality, which
155+
To prevent touching the UDM/P firmware for booting a custom Linux kernel, we can
156+
employ Linux's [kexec](https://en.wikipedia.org/wiki/Kexec) functionality, which
207157
enables Linux to act as a second stage bootloader for a custom kernel.
208158

209159
Since _kexec_ is not supported natively by the stock kernel running on the
@@ -213,11 +163,5 @@ These tools use the _kexec_ backport to load a custom kernel into memory and boo
213163
directly into the custom kernel. With this, we do not need to modify the device
214164
firmware and in case of issues, we can simply power-cycle the device.
215165

216-
While we can now boot into a custom Linux kernel, we will find that UbiOS requires
217-
several proprietary kernel modules to properly function. To address this issue,
218-
during the [initramfs phase](https://en.wikipedia.org/wiki/Initial_ramdisk), we
219-
prepare a workaround that force-inserts the proprietary modules into the kernel,
220-
even when the versions do not match (see [here](https://github.com/fabianishere/udm-kernel-tools/blob/32f0816089c5187f4ff13e3c68f9ea2f6325c591/udm-init#L45) for the implementation).
221-
222166
## License
223167
The code is released under the GPLv2 license. See [COPYING.txt](/COPYING.txt).

debian/changelog

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
udm-kernel-tools (2.0.0) stable; urgency=medium
2+
3+
* Add support for firmware version 2.x/3.x.
4+
5+
-- Fabian Mastenbroek <[email protected]> Sun, 26 Feb 2023 18:00:00 +0000
6+
17
udm-kernel-tools (1.1.7) stable; urgency=medium
28

39
* Add support for firmware version 1.12.33.

debian/config/v1.10.0-11/config.mk

-11
This file was deleted.

0 commit comments

Comments
 (0)