Build and release the modern u-boot bootloader
Primarily:
- Setup the u-boot tree (at a specific commit)
- Build u-boot for the Omega2. Output is an image that can be flashed to the device
Additionally, this repo:
- Can be used to create (and publish) a Docker Image to build the u-boot bootloader. This Docker image can be multi-architecture
See below for more details on using this repo
This repo is configured to automatically run a GitHub actions workflow when a new release is created.
The workflow will:
- Build u-boot for the Omega2
- Publish the u-boot image to: http://repo.onioniot.com/omega2/bootloader/[UBOOT_RELEASE]/ (where
UBOOT_RELEASE
is defined in theprofile
configuration file)- Currently, images will be published to: http://repo.onioniot.com/omega2/bootloader/v2025.04/
- Publish a Docker Image with the u-boot tree and all pre-requisites for compiling u-boot to Docker Hub. Images are available for x86 and ARM architectures. See https://hub.docker.com/r/onion/u-boot-builder
Specifies all configuration data: which repo (and commit of that repo) to build, the target device, architecture, and cross compiler
Note this section assumes the host computer has all of the pre-requisites needed to compile u-boot. If not, see the "Using Docker" section below.
An overview of what the build.sh script does
To:
- clone the REPO specified in
profile
- checkout the COMMIT specified in
profile
- apply patches (if any exist in the
patches
directory)
Run:
bash build.sh setup_tree
The u-boot tree will be available at ./u-boot
To then use the u-boot tree to build u-boot for the Omega2, run:
bash build.sh build_uboot
The compiled image can be found in u-boot/output
U-boot can be built using Docker in two ways:
- Using this repo to build your own Docker Image
- Using the Docker Image published by Onion
Method 1 allows you to customize your image, in case you have any changes you want to make to the u-boot tree.
Method 2 is quicker since it uses a ready-to-go container that just needs to be pulled from Docker Hub. This is the better option if you don't need customization.
This repo contains a Dockerfile that can be used to create a Docker image that has all of the software packages, utilities, and cross compilers required to compile u-boot for the Omega2.
Follow these instructions to compile with Docker:
To:
- clone the REPO specified in
profile
- checkout the COMMIT specified in
profile
- apply patches (if any exist in the
patches
directory)
Run:
bash build.sh setup_tree
The u-boot tree will be available at ./u-boot
Next, build a Docker image that:
- contains the u-boot tree setup in the previous step
- has all of the prerequisites for building u-boot installed
Note this Docker image is based on Tom Rini's Docker image and on the u-boot docker documentation
To build the Docker Image:
docker build -t u-boot-builder .
Where u-boot-builder
is the name of the image.
Then, start a Docker container based on the Image:
docker run --rm -it u-boot-builder bash
Once inside the Docker container, build u-boot by running:
bash /u-boot-wrapper/build.sh build_uboot
The compiled image can be found in the Docker container at /u-boot-wrapper/u-boot/output/
To copy the compiled image out to your host computer, see the Docker documentation on the copy command or on mounting volumes.
Pull Onion's Docker Image from Dockerhub:
docker pull onion/u-boot-builder:latest
Then, start a Docker container based on the Image:
docker run --rm -it onion/u-boot-builder:latest bash
Once inside the Docker container, build u-boot by running:
bash /u-boot-wrapper/build.sh build_uboot
The compiled image can be found in the Docker container at /u-boot-wrapper/u-boot/output/
To copy the compiled image out to your host computer, see the Docker documentation on the copy command or on mounting volumes.
Onion uses this repo to create Docker Images for multiple architectures.
This section is for reference, users of this repo can follow the "Using Docker" section above for their own building needs - their host computer will automatically build a Docker Image for the host computer architecture.
Instructions assume a Ubuntu system:
sudo apt update
sudo apt install -y docker.io docker-buildx git
sudo groupadd -f docker
sudo usermod -aG docker "$USER"
Log out and in, then continue
sudo systemctl enable --now docker
Register QEMU user-mode emulators (needed for multi-arch builds):
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Create & bootstrap a Buildx builder (runs BuildKit in a container:
docker buildx create --name uboot-builder --driver docker-container --use
docker buildx inspect --bootstrap
To build images for x86 and ARM:
docker buildx build \
--platform linux/amd64,linux/arm64/v8 \
-t [IMAGE_TAG] \
--load \
.
The Images can now be pushed to a Docker Image registry. They are not automatically loaded for use since they are for multiple architectures.