Skip to content

Commit 82e19f3

Browse files
nicklasfrahmfrezbo
authored andcommitted
docs: add high-level overlay development guide
This provides rough step-by-step instructions on developing an overlay and using the imager. It also provides some basic information about different file types and their purpose. Signed-off-by: Nicklas Frahm <nicklas.frahm@gmail.com> Signed-off-by: Noel Georgi <git@frezbo.dev>
1 parent 872599c commit 82e19f3

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

website/content/v1.8/advanced/overlays.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,71 @@ An Overlay is a container image with the [specific folder structure](https://git
4343
Overlays can be built and managed using any tool that produces container images, e.g. `docker build`.
4444

4545
Sidero Labs maintains a [repository of overlays](https://github.com/siderolabs/overlays).
46+
47+
### Developing An Overlay
48+
49+
Let's assume that you would like to contribute an overlay for a specific board, e.g. by contributing to the [`sbc-rockchip` repository](https://github.com/siderolabs/sbc-rockchip).
50+
Clone the repositry and insepct the existing overlays to understand the structure.
51+
52+
Usually an overlay consist of a few key components:
53+
54+
- `firmware`: contains the firmware files required for the board
55+
- `bootloader`: contains the bootloader, e.g. `u-boot` for the board
56+
- `dtb`: contains the device tree blobs for the board
57+
- `installer`: contains the installer that will be used to install this overlay on the node
58+
- `profile`: contains information
59+
60+
1. For the new overlay, create any needed folders and `pkg.yaml` files.
61+
2. If your board introduces a new chipset that is not supported yet, make sure to add the firmware build for it.
62+
3. Add the necessary `u-boot` and `dtb` build steps to the `pkg.yaml` files.
63+
4. Proceed to add an installer, which is a small go binary that will be used to install the overlay on the node.
64+
Here you need to add the go `src/` as well as the `pkg.yaml` file.
65+
5. Lastly, add the profile information in the `profiles` folder.
66+
67+
You are now ready to attempt building the overlay.
68+
It's recommend to push the build to a container registry to test the overlay with the Talos installer.
69+
70+
The default settings are:
71+
72+
- `REGISTRY` is set to `ghcr.io`
73+
- `USERNAME` is set to the `siderolabs` (or value of environment variable `USERNAME` if it is set)
74+
75+
```bash
76+
make sbc-rockchip PUSH=true
77+
```
78+
79+
If using a custom registry, the `REGISTRY` and `USERNAME` variables can be set:
80+
81+
```bash
82+
make sbc-rockchip PUSH=true REGISTRY=<registry> USERNAME=<username>
83+
```
84+
85+
After building the overlay, take note of the pushed image tag, e.g. `664638a`, because you will need it for the next step.
86+
You can now build a flashable image using the command below.
87+
88+
```bash
89+
export TALOS_VERSION=v1.7.6
90+
export USERNAME=octocat
91+
export BOARD=nanopi-r5s
92+
export TAG=664638a
93+
94+
docker run --rm -t -v ./_out:/out -v /dev:/dev --privileged ghcr.io/siderolabs/imager:${TALOS_VERSION} \
95+
metal --arch arm64 \
96+
--base-installer-image="ghcr.io/siderolabs/installer:${TALOS_VERSION}" \
97+
--overlay-name="${BOARD}" \
98+
--overlay-image="ghcr.io/${USERNAME}/sbc-rockchip:${TAG}" \
99+
```
100+
101+
> **--overlay-option**
102+
103+
`--overlay-option` can be used to pass additional options to the overlay installer if they are implemented by the overlay.
104+
An example can be seen in the [sbc-raspberrypi](https://github.com/siderolabs/sbc-raspberrypi/) overlay repository.
105+
It supports passing multiple options by repeating the flag or can be read from a yaml document by passing `--overlay-option=@<path to file>`.
106+
107+
> **Note:** In some cases you need to build a custom imager.
108+
> In this case, refer to [this guide on how to build a custom images]({{< relref "./building-images" >}}) using an imager.
109+
110+
#### Troubleshooting
111+
112+
> **IMPORTANT:** If this does not succeed, have a look at the documentation of the external dependecies you are pulling in and make sure that the `pkg.yaml` files are correctly configured.
113+
> In some cases it may be required to update the dependencies to an appropriate version via the `Pkgfile`.

0 commit comments

Comments
 (0)