|
1 | 1 | # ChirpStack Gateway OS |
2 | 2 |
|
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>®</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>®</sup> Network Server. |
5 | 8 |
|
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. |
8 | 13 |
|
9 | | -## Images |
| 14 | +## Documentation and binaries |
10 | 15 |
|
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. |
12 | 18 |
|
13 | | -An image providing the Semtech Packet Forwarder and ChirpStack Gateway Bridge. |
| 19 | +## Building from source |
14 | 20 |
|
15 | | -Provides the following features: |
| 21 | +### Requirements |
16 | 22 |
|
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: |
20 | 24 |
|
21 | | -### chirpstack-gateway-os-full |
| 25 | +* [Docker](https://www.docker.com/) |
22 | 26 |
|
23 | | -An image providing a complete LoRaWAN network-server running on the |
24 | | -gateway. |
| 27 | +### Initialize |
25 | 28 |
|
26 | | -Provides the following features: |
| 29 | +To initialize the [OpenWrt](https://openwrt.org/) build environment, run the |
| 30 | +following command: |
27 | 31 |
|
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 | +``` |
62 | 35 |
|
63 | | -### Login |
| 36 | +This will: |
64 | 37 |
|
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) |
66 | 41 |
|
67 | | -### Gateway configuration |
| 42 | +### Update |
68 | 43 |
|
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: |
70 | 46 |
|
71 | 47 | ```bash |
72 | | -sudo gateway-config |
| 48 | +make update |
73 | 49 | ``` |
74 | 50 |
|
75 | | -## Building images |
76 | | - |
77 | | -A [Docker Compose](https://docs.docker.com/compose/) based build environment is provided for compiling the images. |
| 51 | +### Build |
78 | 52 |
|
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: |
82 | 55 |
|
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 | +``` |
87 | 59 |
|
88 | | -```bash |
89 | | -# update the submodules |
90 | | -make submodules |
| 60 | +#### Switch configuration |
91 | 61 |
|
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. |
95 | 64 |
|
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: |
97 | 67 |
|
98 | 68 | ```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 |
104 | 70 | ``` |
105 | 71 |
|
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. |
107 | 75 |
|
108 | | -Run the following command to setup the build environment: |
| 76 | +To make sure there are no uncommitted changes, you can execute: |
109 | 77 |
|
110 | 78 | ```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 | +``` |
118 | 81 |
|
119 | 82 |
|
120 | | -# build the chirpstack-gateway-os-base image |
121 | | -bitbake chirpstack-gateway-os-base |
122 | | -``` |
| 83 | +#### Configuration |
123 | 84 |
|
124 | | -In case of error: |
| 85 | +To make configuration changes (e.g. add additional packages), you can execute: |
125 | 86 |
|
126 | 87 | ```bash |
127 | | -docker.credentials.errors.InitializationError: docker-credential-secretservice not installed or not available in PATH |
| 88 | +make menuconfig |
128 | 89 | ``` |
129 | 90 |
|
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: |
132 | 93 |
|
133 | 94 | ```bash |
134 | | -sudo apt install golang-docker-credential-helpers |
| 95 | +make defconfig |
135 | 96 | ``` |
136 | 97 |
|
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). |
141 | 99 |
|
142 | | -* `/build/config/local.conf` |
143 | | -* `/build/config/bblayers.conf` |
| 100 | +#### Building image |
144 | 101 |
|
145 | | -## Good to know |
| 102 | +Once the configuration has been set, run the following command to build the |
| 103 | +ChirpStack Gateway OS image: |
146 | 104 |
|
147 | | -### SD Card wearout |
| 105 | +```bash |
| 106 | +make |
| 107 | +``` |
148 | 108 |
|
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. |
154 | 111 |
|
155 | | -### Versioning |
| 112 | +## Links |
156 | 113 |
|
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 |
0 commit comments