You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/firmware/_build-env-notes.mdx
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,4 +12,12 @@ import WslNote from './_wsl-note.mdx';
12
12
<WslNote/>
13
13
14
14
15
-
**The method recommended by Onion is to use Ubuntu 22.04 Linux in a Docker container.** Using Docker provides isolation, which helps prevent dependency conflicts with existing software on the host system and ensures a clean, reproducible development environment.
15
+
**The method recommended by Onion is to use Linux in a Docker container.** Using Docker provides isolation, which helps prevent dependency conflicts with existing software on the host system and ensures a clean, reproducible development environment.
16
+
17
+
**Onion recommends using the `onion/openwrt-builder` Docker image.** This Docker image is based on Ubuntu 22.04 and has all of the [software packages required to use the OpenWRT build tools](https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem#debianubuntumint) already installed.
18
+
19
+
:::tip
20
+
21
+
For those new to Docker, see [Docker's installation guide](https://docs.docker.com/desktop/) and the manual on [running a Docker container](https://docs.docker.com/engine/reference/run).
To download the `onion/openwrt-builder` Docker image, make sure Docker is installed and running, and run the following command:
2
+
3
+
```
4
+
docker pull onion/openwrt-builder
5
+
```
6
+
7
+
:::note Only needs to be done once
8
+
9
+
It might take a few minutes to download the Docker image depending on your internet connection. After the image downloads, you won't need to download it again and this step can be skipped next time.
For those new to Docker, see [Docker's installation guide](https://docs.docker.com/desktop/) and the manual on [running a Docker container](https://docs.docker.com/engine/reference/run).
4
-
5
-
:::
6
-
7
-
To start a Docker container running Ubuntu 22.04, make sure Docker is installed and running, and then run the following command:
1
+
To start a Docker container based on the `onion/openwrt-builder` image run the following command:
8
2
9
3
```
10
-
docker run -it ubuntu:22.04 /bin/bash
4
+
docker run -it onion/openwrt-builder /bin/bash
11
5
```
12
6
13
7
:::info Macs with Apple Silicon
@@ -16,4 +10,13 @@ The OpenWRT build system, SDK, and Image Builder expect an x86_64 processor arch
16
10
17
11
Some users have reported successful compilation if Rosetta for x86/amd64 emulation on Apple Silicon is enabled in Docker.
The firmware image specifications are defined in the `profile` configuration file.
@@ -174,25 +180,29 @@ After completing this step, the OpenWRT Image Builder will download and is set u
174
180
175
181
The following steps show you how to build a firmware image.
176
182
177
-
#### 1. Run the build script
183
+
#### Step 1: Run the build script
178
184
179
185
To build the firmware image(s), run the following command:
180
186
181
187
```Shell
182
188
bash onion_buildenv build_all_firmware
183
189
```
184
190
185
-
The build should take less than 5 minutes.
191
+
The build should take **about 2 minutes.** It might be more or less depending on the CPU performance of your development computer.
186
192
187
-
#### 2. Locate the compiled firmware image
193
+
#### Step 2: Locate the compiled firmware image
188
194
189
195
Compiled firmware images are in the `output` directory.
190
196
191
197
The firmware images are named based on the device model name, the OpenWRT version number specified in the `profile` file, and the date of the build: `<BUILD_MODEL>-<OPENWRT_VERSION>-<BUILD_DATE>.bin` .
192
198
193
-
For example:
199
+
##### For example
200
+
201
+
For an Omega2+ device, with:
202
+
-`OPENWRT_VERSION="23.05.3"` set in the `profile` config file
203
+
- built on May 31, 2024
194
204
195
-
For an Omega2+ device, with OPENWRT_VERSION="23.05.3" set in the `profile` config file and built on May 31, 2024. The firmware image name will be `onion_omega2p-23.05.3-20240531.bin`.
205
+
The firmware image name will be `onion_omega2p-23.05.3-20240531.bin`.
196
206
197
207
<!-- NOTE: Ok to keep OpenWRT release numbers hard-coded in this section -->
Copy file name to clipboardExpand all lines: docs/packages/compile-package.md
+68-46Lines changed: 68 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,51 +37,59 @@ Onion's OpenWRT SDK wrapper is the recommended method to build packages for Omeg
37
37
38
38
The system set up instructions are the same for compiling packages in **development** and in **production**. The configuration and compilation steps differ between the two environments.
39
39
40
-
**Step 1: Set up local environment**
40
+
#### A Note on the Build Environment
41
41
42
42
import BuildEnvNotes from '../firmware/_build-env-notes.mdx';
43
43
44
44
<BuildEnvNotestool="OpenWRT SDK" />
45
45
46
-
**Step 2: Start your Docker Container**
46
+
#### Step 1: Pull the Docker Image
47
47
48
-
import DockerInstructions from '../firmware/_docker-instructions.mdx';
48
+
import DockerPullInstructions from '../firmware/_docker-pull-instructions.mdx';
49
49
50
-
<DockerInstructions/>
50
+
<DockerPullInstructions/>
51
51
52
-
**Step 3: Install software dependancies**
52
+
#### Step 2: Start your Docker Container
53
53
54
-
import InstallDeps from '../firmware/_install-deps.mdx';
54
+
import DockerStartInstructions from '../firmware/_docker-start-instructions.mdx';
55
55
56
-
<InstallDeps/>
56
+
<DockerStartInstructions/>
57
57
58
-
**Step 4: Clone the repository**
58
+
#### Step 3: Clone the OnionIoT/penwrt-sdk-wrapper repository
59
59
60
-
To clone the **openwrt-sdk-wrapper** repository in the development environment, open the terminal and run the following command:
60
+
To clone the **openwrt-sdk-wrapper** repository in the Docker container, run the following command:
The following sections cover configuration changes and compiling packages for a development environment.
69
75
76
+
To compile packages for production, see the [relevant section below](#compiling-packages-for-production).
77
+
70
78
### Config changes
71
79
72
80
After setting up the `openwrt-sdk-wrapper`, it is necessary to configure the required changes for system updates, package installations, or environment customization.
73
81
74
82
#### Step 1: Update package feed variable
75
83
76
-
Locate the `PACKAGE_FEEDS` variable in the profile file and modify it to reference the local source. This is necessary during development if there is a need to retrieve package makefiles from a local repository.
84
+
Locate the `PACKAGE_FEEDS` variable in the `profile` file and modify it to reference the local source. This is necessary during development if there is a need to retrieve package makefiles from a local repository.
77
85
78
-
**Example:** Assuming the custom package source is in the `/home/ubuntu/OpenWRT-Packages` directory, the updated `PACKAGE_FEEDS` variable should be:
79
-
80
-
```shell
81
-
PACKAGE_FEEDS="
82
-
src-link custom /home/ubuntu/OpenWRT-Packages
83
-
"
84
-
```
86
+
> **For example:** Assuming the custom package source is in the `/home/ubuntu/OpenWRT-Packages` directory, the updated `PACKAGE_FEEDS` variable should be:
87
+
>
88
+
>```shell
89
+
>PACKAGE_FEEDS="
90
+
>src-link custom /home/ubuntu/OpenWRT-Packages
91
+
>"
92
+
>```
85
93
86
94
#### Step 2: Run build environment setup script
87
95
@@ -97,14 +105,16 @@ After completing this step, the OpenWRT SDK will be downloaded and set up for us
97
105
98
106
#### Step 1: Run the build script
99
107
100
-
To compile and build the desired packages, run the following commands in the development environment:
108
+
To compile and build the desired packages, run the following command:
101
109
102
110
```bash
103
111
bash onion_buildenv build_packages <PACKAGE_NAME>
104
112
```
105
113
106
114
Replace `<PACKAGE_NAME>` with the actual package name.
107
115
116
+
This will compile the selected pacakge and its dependencies.
117
+
108
118
#### Step 2: Compiled package location
109
119
110
120
All compiled packages can be found in the following directory:
These packages have the extension `.ipk` and are compiled specifically for the `mipsel_24kc` architecture. The compiled packages can be used for testing on a device to confirm proper operation.
117
127
128
+
---
129
+
118
130
## Compiling packages for production
119
131
120
132
The following sections cover configuration changes and compiling package feeds for a production environment.
@@ -123,21 +135,24 @@ The following sections cover configuration changes and compiling package feeds f
123
135
124
136
#### Step 1: Point to the package feed
125
137
126
-
Navigate to the cloned **openwrt-sdk-wrapper** repo to update the `PACKAGE_FEEDS` variable.
138
+
In you local copy of the **openwrt-sdk-wrapper**, update the `PACKAGE_FEEDS` variable in the `profile` configuration file.
127
139
128
-
Follow these steps:
140
+
Use the following syntax:
129
141
130
-
1. Modify the profile configuration file.
131
-
2. Update the `PACKAGE_FEEDS` variable using the following syntax: `src-git <feed-name> <package-feed-url>[;<package-feed-branch>]`
132
-
-`<feed-name>`: Choose an arbitrary name for SDK usage.
133
-
-`<package-feed-url>`: Provide the Git repository URL.
134
-
-`<package-feed-branch>`: Optionally, specify a branch of the package feed repository.
For example, say the `openwrt-23.05` branch of the `https://github.com/OnionIoT/OpenWRT-Packages` repo is the package feed, the addition to the `PACKAGE_FEEDS` variable should be: <!-- TODO: update this 23.05 with OPENWRT_VERSION variable -->
146
+
Replace the placeholder parameters with:
147
+
- `<feed-name>` - choose a name for the package feed
148
+
- `<package-feed-url>` - provide the Git repository URL
149
+
- `<package-feed-branch>` - optionally, specify a branch of the package feed repository
> **For example:** say the `openwrt-23.05` branch of the `https://github.com/OnionIoT/OpenWRT-Packages` repo is the package feed, the addition to the `PACKAGE_FEEDS` variable should be: <!-- TODO: update this 23.05 with OPENWRT_VERSION variable -->
<!-- TODO: update this 23.05 with OPENWRT_VERSION variable -->
142
157
143
158
#### Step 2: Select packages from the package feed
@@ -148,17 +163,17 @@ To select specific packages from the package feed to compile, follow these steps
148
163
2. Locate the `SDK_PACKAGES` variable.
149
164
3. Modify the `SDK_PACKAGES` variable to include the packages from the package feed that you want to compile. Ensure that the list is new-line delimited.
150
165
151
-
For example:
152
-
153
-
```shell
154
-
SDK_PACKAGES="
155
-
custom-lib
156
-
custom-package1
157
-
new-software
158
-
"
159
-
```
160
-
161
-
In this example, `custom-lib`, `custom-package1`, and `new-software` packages, along with any dependencies they require, will be compiled and built.
166
+
>For example:
167
+
>
168
+
>```shell
169
+
>SDK_PACKAGES="
170
+
> custom-lib
171
+
> custom-package1
172
+
> new-software
173
+
> "
174
+
> ```
175
+
>
176
+
>In this example, `custom-lib`, `custom-package1`, and `new-software` packages, along with any dependencies they require, will be compiled and built.
162
177
163
178
#### Step 3: Set up the SDK and environment
164
179
@@ -172,28 +187,35 @@ First, download and setup the OpenWRT SDK with the following command:
172
187
173
188
#### Step 1: Build packages
174
189
175
-
Build and compile all desired packages listed in the `SDK_PACKAGES` variable in the profile, and run the following command:
190
+
Build and compile all the packages listed in the `SDK_PACKAGES` variable in the profile, along with their dependencies, by running the following command:
176
191
177
192
```bash
178
193
bash onion_buildenv build_all_packages
179
194
```
180
195
181
-
#### Step 2: Compiled packages location
196
+
Compilation time depends on the packages that are being compiled. Packages that are complex and/or have many dependencies take longer to compile. For reference, it takes about 30 minutes to compile the packages from the [OnionIoT/OpenWRT-Packages repo](https://github.com/OnionIoT/openwrt-packages/tree/openwrt-23.05).
197
+
198
+
#### Step 2: Compiled package location
182
199
183
200
All compiled packages can be found in the following directory:
184
201
185
202
```shell
186
203
openwrt-sdk/bin/packages/mipsel_24kc/<feed-name>/
187
204
```
188
205
189
-
Where `<feed-name>` is the name of the feed that was added to the `profile` configuration file in Step 1 above.
206
+
Where `<feed-name>` is the name of the feed that was added to the `profile` configuration file in [Step 1 in the Config Changes section above](#config-changes-1).
207
+
208
+
The packages have the extension `.ipk` and are compiled specifically for the Omega2 `mipsel_24kc` architecture. Also included are **package index files** that are required by OPKG on the device to recognize and install the packages from the repository.
190
209
191
-
The packages have the extension `.ipk` and are compiled specifically for the `mipsel_24kc` architecture. Also included are package index files that will be used by the package manager on the device to install the packages.
192
210
193
-
:::note Important note
211
+
:::info Package Indexing and Signing
194
212
195
-
The last step of compiling a package feed is creating an index of the packages and signing the packages. This step is required so the compiled packages can be used as an opkg package repository by the device.
213
+
The last step of compiling a package feed is creating an index of the packages and signing the packages. This step is required so the compiled packages can be used as a package repository by the device.
214
+
215
+
When the `bash onion_buildenv build_all_packages` command is run, the Onion OpenWRT SDK Wrapper will automatically perform indexing and signing as the last step.
196
216
197
217
:::
198
218
219
+
The compiled packages can now be deployed as a package repo. See the [Deploy a Package Repo article](./deploy-package-repo) for more details.
0 commit comments