Skip to content

Commit 1a973b6

Browse files
committed
Switch to OpenWrt.
This switches the ChirpStack Gateway OS from Yocto to OpenWrt. If you still want to use the Yocto recipes, then please switch to the v4_yocto branch. This splits the ChirpStack Gateway OS into the following repositories: * chirpstack-gateway-os: scripts for setting up build environment * chirpstack-openwrt-config: OpenWrt configuration files for the GW OS * chirpstack-openwrt-feed: ChirpStack packages for OpenWrt
1 parent ec41230 commit 1a973b6

File tree

202 files changed

+153
-19346
lines changed

Some content is hidden

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

202 files changed

+153
-19346
lines changed

.gitignore

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# hidden files
2-
.*
3-
4-
# logfiles
5-
*.log
6-
7-
# VSCode
8-
/vscode-bitbake-build
9-
10-
# builds
11-
/build
12-
/deploy
13-
/docs/public/
14-
/*.img
15-
/*.mender
16-
1+
# OpenWrt
2+
/openwrt
3+
/dist

.gitmodules

Lines changed: 0 additions & 24 deletions
This file was deleted.

.templateconf

Whitespace-only changes.

Dockerfile

Lines changed: 0 additions & 40 deletions
This file was deleted.

Dockerfile-devel

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Source:
2+
# https://openwrt.org/docs/guide-user/virtualization/obtain.firmware.docker
3+
4+
FROM docker.io/debian:stable-slim
5+
6+
ENV GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
7+
WORKDIR /workdir
8+
9+
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests --yes \
10+
'build-essential' \
11+
'ca-certificates' \
12+
'clang' \
13+
'flex' \
14+
'bison' \
15+
'g++' \
16+
'gawk' \
17+
'gcc-multilib' \
18+
'g++-multilib' \
19+
'gettext' \
20+
'git' \
21+
'libncurses5-dev' \
22+
'libssl-dev' \
23+
'python3-distutils' \
24+
'rsync' \
25+
'unzip' \
26+
'zlib1g-dev' \
27+
'file' \
28+
'wget' \
29+
'curl' \
30+
'quilt' \
31+
'nano' \
32+
&& \
33+
rm -f -r '/var/lib/apt/' && \
34+
rm -f -r '/var/cache/apt/' && \
35+
useradd -m -s '/bin/bash' -U 'buildbot'
36+
37+
USER buildbot

Makefile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
.PHONY: submodules permissions
1+
.PHONY: clean init update devshell
22

3-
submodules:
4-
git submodule init
5-
git submodule update
3+
clean:
4+
rm -rf openwrt
65

7-
permissions:
8-
mkdir -p deploy
9-
chmod 777 deploy
6+
init:
7+
git clone --branch openwrt-23.05 https://github.com/openwrt/openwrt.git
8+
git clone https://github.com/chirpstack/chirpstack-openwrt-config.git openwrt/env
9+
cp feeds.conf.default openwrt/feeds.conf.default
10+
docker-compose run --rm chirpstack-gateway-os scripts/feeds update -a
11+
docker-compose run --rm chirpstack-gateway-os scripts/feeds install -a
1012

13+
14+
update:
15+
cd openwrt && git pull
16+
docker-compose run --rm chirpstack-gateway-os scripts/feeds update -a
17+
docker-compose run --rm chirpstack-gateway-os scripts/feeds install -a
18+
19+
devshell:
20+
docker-compose run --rm chirpstack-gateway-os bash

README.md

Lines changed: 67 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,116 @@
11
# ChirpStack Gateway OS
22

3-
The ChirpStack Gateway OS is an embedded OS for LoRa gateways. It is part of the
4-
[ChirpStack](https://www.chirpstack.io/) open-source LoRaWAN Network Server stack.
3+
ChirpStack Gateway OS is an open-source [OpenWrt](https://openwrt.org/) based
4+
embedded OS for LoRa<sup>&reg;</sup> gateways. It provides a web-interface for
5+
configuration and contains pre-defined configuration options for common
6+
LoRa hardware to make it easy to setup a LoRa gateway and optionally a
7+
ChirpStack-based LoRaWAN<sup>&reg;</sup> Network Server.
58

6-
The goal of the ChirpStack Gateway OS is to provide firmware images that are easy
7-
to setup, maintain and customize.
9+
**Note:** If you are looking for the [Yocto](https://www.yoctoproject.org/)
10+
recipes of the previously Yocto based ChirpStack Gateway OS, please switch to
11+
the [v4_yocto](https://github.com/chirpstack/chirpstack-gateway-os/tree/v4_yocto)
12+
branch.
813

9-
## Images
14+
## Documentation and binaries
1015

11-
### chirpstack-gateway-os-base
16+
Please refer to the [ChirpStack Gateway OS documentation](https://www.chirpstack.io/docs/chirpstack-gateway-os/)
17+
for documentation and pre-compiled images.
1218

13-
An image providing the Semtech Packet Forwarder and ChirpStack Gateway Bridge.
19+
## Building from source
1420

15-
Provides the following features:
21+
### Requirements
1622

17-
* [Monit](https://mmonit.com/monit/) based service monitoring
18-
* [ChirpStack Concentratord](https://github.com/brocaar/chirpstack-concentratord/)
19-
* [ChirpStack Gateway Bridge](https://www.chirpstack.io/gateway-bridge/)
23+
Building ChirpStack Gateway OS requires:
2024

21-
### chirpstack-gateway-os-full
25+
* [Docker](https://www.docker.com/)
2226

23-
An image providing a complete LoRaWAN network-server running on the
24-
gateway.
27+
### Initialize
2528

26-
Provides the following features:
29+
To initialize the [OpenWrt](https://openwrt.org/) build environment, run the
30+
following command:
2731

28-
* [Monit](https://mmonit.com/monit/) based service monitoring
29-
* [ChirpStack Concentratord](https://github.com/brocaar/chirpstack-concentratord/)
30-
* [ChirpStack Gateway Bridge](https://www.chirpstack.io/gateway-bridge/)
31-
* [ChirpStack Network Server](https://www.chirpstack.io/network-server/)
32-
* [ChirpStack Application Server](https://www.chirpstack.io/application-server/)
33-
* [Mosquitto MQTT broker](http://mosquitto.org/)
34-
* [Redis](https://redis.io/)
35-
* [PostgreSQL](https://www.postgresql.org/)
36-
37-
## Targets
38-
39-
### Raspberry Pi
40-
41-
* Raspberry Pi Zero W
42-
* Raspberry Pi 1
43-
* Raspberry Pi 3
44-
* Raspberry Pi 4
45-
46-
#### Shields / kits
47-
48-
* [IMST - iC880A](https://wireless-solutions.de/products/long-range-radio/ic880a.html)
49-
* [IMST - iC980A](http://www.imst.com/)
50-
* [IMST - Lite Gateway](https://wireless-solutions.de/products/long-range-radio/lora-lite-gateway.html)
51-
* [Pi Supply - LoRa Gateway Hat](https://uk.pi-supply.com/products/iot-lora-gateway-hat-for-raspberry-pi)
52-
* [RAK - RAK2245](https://store.rakwireless.com/products/rak2245-pi-hat)
53-
* [RAK - RAK2246 / RAK2246G](https://store.rakwireless.com/products/rak7246-lpwan-developer-gateway)
54-
* [RAK - RAK2287](https://store.rakwireless.com/products/rak2287-lpwan-gateway-concentrator-module)
55-
* [RAK - RAK831 Gateway Developer Kit](https://store.rakwireless.com/products/rak831-gateway-module?variant=22375114801252)
56-
* [RisingHF - RHF0M301 LoRaWAN IoT Discovery Kit](http://risinghf.com/#/product-details?product_id=9&lang=en)
57-
* [Sandbox Electronics - LoRaGo PORT](https://sandboxelectronics.com/?product=lorago-port-multi-channel-lorawan-gateway)
58-
* [Semtech - SX1302 CoreCell](https://www.semtech.com/products/wireless-rf/lora-gateways/sx1302cxxxgw1)
59-
* [Semtech - SX1280 2.4GHz gateway](https://www.semtech.com/products/wireless-rf/lora-gateways/sx1280zxxxxgw1)
60-
61-
## Using
32+
```bash
33+
make init
34+
```
6235

63-
### Login
36+
This will:
6437

65-
The default username is `admin` with password `admin`.
38+
* Clone the OpenWrt code
39+
* Clone the [ChirpStack OpenWrt configuration](https://github.com/chirpstack/chirpstack-openwrt-config/)
40+
* Fetch all the OpenWrt feeds, including the [ChirpStack OpenWrt Feed](https://github.com/chirpstack/chirpstack-openwrt-feed)
6641

67-
### Gateway configuration
42+
### Update
6843

69-
Execute the following command as `admin` user:
44+
This step is not required after running `make init`, but allows you to update
45+
the OpenWrt source and feeds at a later point:
7046

7147
```bash
72-
sudo gateway-config
48+
make update
7349
```
7450

75-
## Building images
76-
77-
A [Docker Compose](https://docs.docker.com/compose/) based build environment is provided for compiling the images.
51+
### Build
7852

79-
**Note:** Compiling these images require a fair amount of CPU power, RAM and disk space.
80-
As a reference, the pre-compiled images are built using a 8 x Core i7 machine with 16GB RAM
81-
running Manjaro Linux with 200GB reserved for the build environment.
53+
For building the ChirpStack Gateway OS, you must enter the Docker-based
54+
development environment first:
8255

83-
### Initial setup
84-
85-
Run the following command to fetch the git submodules and setup directory
86-
permissions (to write back from the Docker container):
56+
```
57+
make devshell
58+
```
8759

88-
```bash
89-
# update the submodules
90-
make submodules
60+
#### Switch configuration
9161

92-
# setup permissions
93-
make permissions
94-
```
62+
Each target and image has its own configuration. To switch between
63+
configurations, you can use the `./scripts/env switch` command.
9564

96-
Run the following command to set the `/build` folder permissions:
65+
Example to switch to the `base_raspberrypi_bcm27xx_bcm2709` configuration,
66+
you must run the following command:
9767

9868
```bash
99-
# on the host
100-
docker-compose run --rm busybox
101-
102-
# within the container
103-
chown 999:999 /build
69+
./scripts/env switch base_raspberrypi_bcm27xx_bcm2709
10470
```
10571

106-
### Building
72+
Under the hood, this will switch the [chirpstack-openwrt-config](https://github.com/chirpstack/chirpstack-openwrt-config/branches)
73+
repository which has been cloned in the `env` directory branch and will setup
74+
all the symlinks.
10775

108-
Run the following command to setup the build environment:
76+
To make sure there are no uncommitted changes, you can execute:
10977

11078
```bash
111-
# on the host
112-
docker-compose run --rm yocto bash
113-
114-
# within the container
115-
116-
# initialize the yocto / openembedded build environment
117-
source oe-init-build-env /build/ /chirpstack-gateway-os/bitbake/
79+
./scripts/env revert
80+
```
11881

11982

120-
# build the chirpstack-gateway-os-base image
121-
bitbake chirpstack-gateway-os-base
122-
```
83+
#### Configuration
12384

124-
In case of error:
85+
To make configuration changes (e.g. add additional packages), you can execute:
12586

12687
```bash
127-
docker.credentials.errors.InitializationError: docker-credential-secretservice not installed or not available in PATH
88+
make menuconfig
12889
```
12990

130-
Make sure that the `golang-docker-credential-helpers` is installed. On `Ubuntu`
131-
you can install it with:
91+
As updates to OpenWrt packages can introduce new configuration options over
92+
time, you can run the following command to update the configuration:
13293

13394
```bash
134-
sudo apt install golang-docker-credential-helpers
95+
make defconfig
13596
```
13697

137-
#### Configuration
138-
139-
By default, Raspberry Pi3 is configured as the target platform. You need to
140-
update the following configuration files to configure a different target:
98+
Please refer also to the [OpenWrt build system usage documentation](https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem).
14199

142-
* `/build/config/local.conf`
143-
* `/build/config/bblayers.conf`
100+
#### Building image
144101

145-
## Good to know
102+
Once the configuration has been set, run the following command to build the
103+
ChirpStack Gateway OS image:
146104

147-
### SD Card wearout
105+
```bash
106+
make
107+
```
148108

149-
Although ChirpStack Network Server and ChirpStack Application Server try to minimize
150-
the number of database writes, there will be regular writes to the SD Card
151-
(PostgreSQL and Redis snapshots).
152-
According to [Is it true that a SD/MMC Card does wear levelling with its own controller?](https://electronics.stackexchange.com/questions/27619/is-it-true-that-a-sd-mmc-card-does-wear-levelling-with-its-own-controller)
153-
it might make a difference which SD Card brand you use.
109+
Note that this can take a couple of hours depending on the selected
110+
configuration and will require a significant amount of disk-space.
154111

155-
### Versioning
112+
## Links
156113

157-
The major version (major.minor.patch) of this project represents the major
158-
version of the provided ChirpStack Network Server stack.
114+
* [ChirpStack documentation](https://www.chirpstack.io/)
115+
* [chirpstack-openwrt-config](https://github.com/chirpstack/chirpstack-openwrt-config/) repository
116+
* [chirpstack-openwrt-feed](https://github.com/chirpstack/chirpstack-openwrt-feed) repository

bitbake

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)