Skip to content

Commit 8f7f7a4

Browse files
committed
Include target config + disable console on UART.
This migrates the chirpstack-openwrt-config repository content into this repository and updates the Makefile for switching configuration environments. The reason for this is that ./scripts/env does handle .config + files per environment, but it does not make it possible to apply patches. To make sure that we are not sending console output to a GNSS module connected to the UART interface, we need to patch the cmdline.txt. The updated Makefile handles the config switching in the same way as the ./scripts/env would do, but also handles the rollback and apply of patches on switching the configuration environment.
1 parent 1a973b6 commit 8f7f7a4

Some content is hidden

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

50 files changed

+27559
-37
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
# OpenWrt
22
/openwrt
33
/dist
4+
5+
# Hidden files
6+
/.*
7+
8+
# Symlinks
9+
/conf/.config
10+
/conf/files
11+
/conf/patches

Makefile

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,46 @@
1-
.PHONY: clean init update devshell
1+
.PHONY: build clean init update devshell show-envs switch-env
22

3-
clean:
4-
rm -rf openwrt
3+
# Build the OpenWrt image.
4+
# Note: execute this within the devshell.
5+
build:
6+
cd openwrt && make
57

8+
# Initialize the OpenWrt environment.
69
init:
710
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
911
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
12-
12+
ln -s env/.config openwrt/.config
13+
ln -s env/files openwrt/files
14+
docker-compose run --rm chirpstack-gateway-os openwrt/scripts/feeds update -a
15+
docker-compose run --rm chirpstack-gateway-os openwrt/scripts/feeds install -a
16+
docker-compose run --rm chirpstack-gateway-os quilt init
1317

18+
# Update OpenWrt + package feeds.
1419
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
20+
cd openwrt && \
21+
git pull && \
22+
./scripts/feeds update -a && \
23+
./scripts/feeds install -a
1824

25+
# Activate the devshell.
1926
devshell:
2027
docker-compose run --rm chirpstack-gateway-os bash
28+
29+
# Switch configuration environment.,
30+
# Note: execute this within the devshell.
31+
switch-env:
32+
@echo "Rollback previously applied patches"
33+
-cd openwrt && quilt pop -a
34+
35+
@echo "Switching configuration"
36+
rm -f conf/files conf/patches conf/.config
37+
ln -s ${ENV}/files conf/files
38+
ln -s ${ENV}/patches conf/patches
39+
ln -s ${ENV}/.config conf/.config
40+
41+
@echo "Applying patches"
42+
cd openwrt && quilt push -a
43+
44+
# Clean the OpenWrt environment.
45+
clean:
46+
rm -rf openwrt

README.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ make init
3636
This will:
3737

3838
* Clone the OpenWrt code
39-
* Clone the [ChirpStack OpenWrt configuration](https://github.com/chirpstack/chirpstack-openwrt-config/)
4039
* Fetch all the OpenWrt feeds, including the [ChirpStack OpenWrt Feed](https://github.com/chirpstack/chirpstack-openwrt-feed)
40+
* Symlink configuration and files
4141

4242
### Update
4343

@@ -59,28 +59,44 @@ make devshell
5959

6060
#### Switch configuration
6161

62-
Each target and image has its own configuration. To switch between
63-
configurations, you can use the `./scripts/env switch` command.
62+
Each target and image has its own OpenWrt configuration file, files and
63+
patches. These can be found under the `conf` directory of this repository.
6464

65-
Example to switch to the `base_raspberrypi_bcm27xx_bcm2709` configuration,
66-
you must run the following command:
65+
To switch to one of these configuration environments, you must execute:
6766

68-
```bash
69-
./scripts/env switch base_raspberrypi_bcm27xx_bcm2709
7067
```
68+
make switch-env ENV=name-of-env
69+
```
70+
71+
Fo example if you would like to switch to `base_raspberrypi_bcm27xx_bcm2709`,
72+
you execute:
73+
74+
```
75+
make switch-env ENV=base_raspberrypi_bcm27xx_bcm2709
76+
```
77+
78+
This will:
7179

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.
80+
* Undo all previously applied patches.
81+
* Update the symlinks for OpenWrt configuration and files.
82+
* Apply all patches.
7583

76-
To make sure there are no uncommitted changes, you can execute:
84+
#### Building image
85+
86+
Once the configuration has been set, run the following command to build the
87+
ChirpStack Gateway OS image:
7788

7889
```bash
79-
./scripts/env revert
90+
make
8091
```
8192

93+
Note that this can take a couple of hours depending on the selected
94+
configuration and will require a significant amount of disk-space.
95+
96+
#### Making configuration changes
8297

83-
#### Configuration
98+
**Note:** The commands listed below must be executed within the `openwrt`
99+
directory.
84100

85101
To make configuration changes (e.g. add additional packages), you can execute:
86102

@@ -97,20 +113,7 @@ make defconfig
97113

98114
Please refer also to the [OpenWrt build system usage documentation](https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem).
99115

100-
#### Building image
101-
102-
Once the configuration has been set, run the following command to build the
103-
ChirpStack Gateway OS image:
104-
105-
```bash
106-
make
107-
```
108-
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.
111-
112116
## Links
113117

114118
* [ChirpStack documentation](https://www.chirpstack.io/)
115-
* [chirpstack-openwrt-config](https://github.com/chirpstack/chirpstack-openwrt-config/) repository
116119
* [chirpstack-openwrt-feed](https://github.com/chirpstack/chirpstack-openwrt-feed) repository

0 commit comments

Comments
 (0)