Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 44 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Available containers:

All containers are mirrored to the follwing three registries under `openwrt` account:

* docker.io ([sdk](https://hub.docker.com/r/openwrt/sdk) | [imagebuilder](https://hub.docker.com/r/openwrt/imagebuilder) | [rootfs](https://hub.docker.com/r/openwrt/rootfs)) `*`
* docker.io ([sdk](https://hub.docker.com/r/openwrt/sdk) | [imagebuilder](https://hub.docker.com/r/openwrt/imagebuilder) | [rootfs](https://hub.docker.com/r/openwrt/rootfs)) `*`
* ghcr.io ([sdk](https://github.com/openwrt/docker-openwrt/pkgs/container/sdk) | [imagebuilder](https://github.com/openwrt/docker-openwrt/pkgs/container/imagebuilder) | [rootfs](https://github.com/openwrt/docker-openwrt/pkgs/container/rootfs))
* quay.io ([sdk](https://quay.io/repository/openwrt/sdk) | [imagebuilder](https://quay.io/repository/openwrt/imagebuilder) | [rootfs](https://quay.io/repository/openwrt/rootfs))

Expand Down Expand Up @@ -73,14 +73,52 @@ via CI.

### ImageBuilder Example

Built images will be stored in `bin`, and cached packages, that can be reused
for other builds - in `dl`. Packages from differenet platforms/versions might
have the same package names, but different checksums, which will cause
errors during build, so working directories shouldn't be shared between
different image builders.

> If you're running on a SELinux-enabled system (e.g. RHEL), volumes must be
> mounted with a `:z` flag:
>
> ```
> --volume "$(pwd)"/bin/:/builder/bin:z
> ```

Using Docker:

```shell
docker run --rm -v "$(pwd)"/bin/:/builder/bin -it openwrt/imagebuilder
# inside the Docker container
make image PROFILE=generic PACKAGES=tmate
# NB: Replace these variables, according to your needs
PLATFORM=ath79-generic
VERSION=24.10.0
PROFILE=tplink_archer-c7-v2
PACKAGES="ath10k-firmware-qca988x kmod-ath10k kmod-usb-ledtrig-usbport kmod-usb-net-cdc-ether kmod-usb2 luci luci-ssl luci-app-sqm luci-app-attendedsysupgrade owut -ppp -ppp-mod-pppoe -luci-proto-ppp -ath10k-firmware-qca988x-ct -kmod-ath10k-ct"

mkdir openwrt-${PLATFORM}-${VERSION}/{bin,dl}
cd openwrt-${PLATFORM}-${VERSION}

docker run --rm \
--volume "$(pwd)"/bin/:/builder/bin \
--volume "$(pwd)"/dl:/builder/dl \
openwrt/imagebuilder:${PLATFORM}-${VERSION} \
make image PROFILE="${PROFILE}" PACKAGES="${PACKAGES}"
```

Using Podman we need to map user account to same UID within container using `--userns=keep-id`:

```shell
# Same variables as above

podman run --rm \
--userns=keep-id \
--volume "$(pwd)"/bin/:/builder/bin \
--volume "$(pwd)"/dl:/builder/dl \
openwrt/imagebuilder:${PLATFORM}-${VERSION} \
make image PROFILE="${PROFILE}" PACKAGES="${PACKAGES}"
```

Enjoy a local OpenWrt ImageBuilder container building an image for x86/64 and
store the binary in hosts `./bin` folder.
Variables can be inlined to make these into one-liners.

### ImageBuilder Tags

Expand Down