https://github.com/openhd/openhd-imagebuilder
Script for building OpenHD Images
https://github.com/openhd/openhd-imagebuilder
build-system images openhd
Last synced: about 1 year ago
JSON representation
Script for building OpenHD Images
- Host: GitHub
- URL: https://github.com/openhd/openhd-imagebuilder
- Owner: OpenHD
- License: gpl-3.0
- Created: 2019-01-22T17:15:01.000Z (over 7 years ago)
- Default Branch: 2.6-evo
- Last Pushed: 2025-04-21T19:23:02.000Z (about 1 year ago)
- Last Synced: 2025-04-28T10:25:30.187Z (about 1 year ago)
- Topics: build-system, images, openhd
- Language: Shell
- Homepage:
- Size: 8.65 MB
- Stars: 33
- Watchers: 7
- Forks: 57
- Open Issues: 2
-
Metadata Files:
- Readme: README.asciidoc
- License: LICENSE
Awesome Lists containing this project
README
// SETTINGS \\
:doctype: book
// -- Table of Contents
:toc:
:toclevels: 3
:toc-title:
:toc-placement!:
// -- Icons
ifdef::env-github[]
:caution-caption: :fire:
:important-caption: :exclamation:
:note-caption: :paperclip:
:tip-caption: :bulb:
:warning-caption: :warning:
endif::[]
ifdef::env-github[]
:status:
:outfilesuffix: .asciidoc
endif::[]
:sectanchors:
:numbered:
// SETTINGS END \\
# OpenHD-Image-Builder
// Table of Contents
toc::[]
## Flashing
When flashing please use the OpenHD-ImageWriter.
If you want to flash the Images manually you need to create a (air.txt) or (ground.txt) file in the openhd folder, which is in the root of the FAT32 Partition on the SD-CARD.
## What is this
This project takes a base image and modifies it into an OpenHD compatible image.
For the long version, read on.
## Using
In order to be able to run this you need a Debian or Ubuntu Linux machine with 30 Gb free space on the main partition, and with the following packages:
```sh
sudo apt install unzip curl git qemu qemu-user-static binfmt-support build-essential gcc-arm*
```
If any of the packages fails to install, run apt update prior to the apt install command:
```
sudo apt update
```
Then git clone this repository to a suitable folder
```sh
git clone https://github.com/OpenHD/OpenHD-ImageBuilder.git
cd OpenHD-ImageBuilder
```
Elevate your prompt:
```sh
sudo -s
```
And run:
```sh
./build.sh TARGET
```
or
valid targets are:
```sh
pi-bullseye
x86-noble
rock5b
rock5a
radxa-cm3
x20
radxa-zero3w
```
## More information (what's going on?)
**Note:** if a build fails for some reason, be sure to run the cleanup script so that any temporarily mounted images are cleaned up:
./clean-fail.sh
### STAGES
The core concept (and some code) was taken from link:https://github.com/RPi-Distro/pi-gen[pi-gen], the Raspbian image generator.
Whenever we make a OpenHD image, we basically perform several steps in order:
- Step 01-00 Download a base image
- Step 01-01 Increase the size of the root partition if necessary
- Step 02-00 Install,Remove,Hold Packages (gets documentation soon)
- Step 03-00 Misc changes to the image, copying files, setting usernames,...
- Step 03-01 Enable/Disable Services
- Step 03-02 Additional changes for device detection (poc)
- Cleanup
The ImageBuilder allows us to run the build process once, and when we want to make a change in stage 3, we only run stage 3 and 4 again by removing the `SKIP` file from the `stages/03-Packages` and the `stages/04-Wifibroadcast` folders. The build system will copy the kernel `IMAGE.img` from stage 2 to stage 3 and re-run all the scripts in stage 3. The resulting image is copied to stage 4 and all those scripts are run. Finally, when there are no more stages, the `IMAGE.img` from the last stage is copied to the `./deploy` directory and renamed to include the target board and OpenHD version.
#### Skipping
By placing a `SKIP` file in the stage folder, the entire stage will be skipped by the build system. Please be aware there is no sanity check in place, removing the `SKIP` file from stage 3 while leaving the `SKIP` file in stage 4 will produce an image based on the previous run, ignoring the modifications done in step 3.
It is also possible to put a `SKIP-IMAGE` file into a stage, this will disable any attempt to copy the image from the previous stage. This is mainly used to prevent image copying in stage `00` and `01` where no image is yet available.
#### Scripts
Every stage comprises one or more scripts. Scripts need to be named in the format `XX-run.sh` or `XX-run-chroot.sh`. The order is determined by the XX part, where any `-chroot` script is run **AFTER** the non-chroot script.
**chroot**? What's that? Well, it's a little complex, but basically it allows you to run statements within the image as if you were running the image on an actual target board like the Raspberry Pi. This is used to download and install the `apt-get` packages and several scripts to make the image ready for use with the OpenHD system. Please remember to use `sudo` in the `-chroot` scripts where approperiate.
#### Small
We've added a small option, which removes the old images after each step is done.
# Contributing
*Thanks to all the people who already contributed!*
[#img-contributors,link=https://github.com/OpenHD/OpenHD-ImageBuilder/graphs/contributors]
image::https://contrib.rocks/image?repo=OpenHD/OpenHD-ImageBuilder[Contributors]