https://github.com/betaflight/docker-betaflight-build
Docker container that contains everything required to build the Betaflight firmware
https://github.com/betaflight/docker-betaflight-build
betaflight docker
Last synced: 9 months ago
JSON representation
Docker container that contains everything required to build the Betaflight firmware
- Host: GitHub
- URL: https://github.com/betaflight/docker-betaflight-build
- Owner: betaflight
- License: gpl-3.0
- Created: 2016-11-14T08:03:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-10-14T14:13:14.000Z (over 4 years ago)
- Last Synced: 2025-03-20T18:11:15.528Z (over 1 year ago)
- Topics: betaflight, docker
- Language: Dockerfile
- Size: 39.1 KB
- Stars: 40
- Watchers: 5
- Forks: 24
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker Betaflight build
[](https://hub.docker.com/r/betaflight/betaflight-build/) [](https://hub.docker.com/r/betaflight/betaflight-build/) [](https://github.com/betaflight/betaflight-build/blob/master/LICENSE)
_(Markdown optimised for display in [Dockerhub](https://hub.docker.com/r/betaflight/betaflight-build).)_
Clone and edit [Betaflight](https://github.com/betaflight/betaflight) locally on your platform. This image will take it from there and turn your code into a binary which you then can flash to your flight controller with the [Betaflight Configurator](https://github.com/betaflight/betaflight-configurator).
## Usage
### Install Docker
The latest docker platform is available from [https://www.docker.com/](https://www.docker.com/products/overview#/install_the_platform). If your system does not meet the system requirements for the latest version, check out the [Docker Toolbox](https://www.docker.com/products/docker-toolbox).
### Clone the Betaflight repository
Docker runs on a VirtualBox VM which by default only shares the user directory from the underlying guest OS. On Windows that is c:/Users/<user> and on Mac it's /Users/<user>. Hence, you need to clone the [Betaflight](https://github.com/betaflight/betaflight) repository to your *user directory*. If you want to place it outside the user directory you need to adjust the [VirtualBox VM sharing settings](http://stackoverflow.com/q/33934776/131929) accordingly.
### Run this image with Docker
Start Docker and change into the Betaflight source directory (in the Docker console).
First you need to set your working directory in Docker:
For Windows -
cd /c/users/<user name>
Next, Clone the Betaflight repository.
(Note the below link is for the main Betaflight project. If Cloning a workign Fork, you will need to get the link from the GitHub website.)
To Clone a Github repository
git clone https://github.com/betaflight/betaflight.git
To view Branches within a repository
git branch -a
To checkout a branch
git checkout <branch name>
To pull the branch to your local PC
git pull
Then run:
docker run --rm -ti -v \`pwd\`:/opt/betaflight betaflight/betaflight-build
Depending on the performance of your system it takes 1-3min until the compilation finishes. The first time you run this it takes longer because Docker needs to download the image and create a container.
**Note for Windows users**
(Docker on) Windows handles paths slightly differently. You need to specify the full path to the Betaflight directory in the command and you need to add an extra forward slash (/) to the Windows path. The command thus becomes (c equals C drive i.e. c:):
docker run --rm -it -v c:/Users/<user>/<betaflight>:/opt/betaflight betaflight/betaflight-build
If the Windows path contains spaces it would have to be wrapped in quotes as usual on Windows.
docker run --rm -it -v "c:/Users/joe blogs/<betaflight>":/opt/betaflight betaflight/betaflight-build
#### Output
The firmware file (.bin or .hex) is created in the obj subfolder of your betaflight source directory.
#### Options
You can pass optional parameters to the Docker build like so:
docker run -e "<parameter>=value" --rm -it -v \`pwd\`:/opt/betaflight betaflight/betaflight-build
For Windows:
docker run -e "parameter=<value>" --rm -it -v c:/Users/<user>/<any sub-directory names>/betaflight:/opt/betaflight betaflight/betaflight-build
These parameters are supported:
- TARGET=<target name>: The platform (target) to build, e.g. TARGET=STM32F7X2;
- OPTIONS=<options>: specify build options to be used as defines during the build.
Special cases:
- TARGET=all: build all targets (may take a long time);
- TARGET=test: build and run the unit tests;
- TARGET=unified: build all Unified Targets;
- TARGET=unified\zip: build all Unified Targets and pack them into ZIP files (good for adding to GitHub issues);
- TARGET=pre-push: build representative targets and build and run the tests (**do this to check that your changes do not introduce build failures every time before opening a pull request**).
### Flashing the built binary
Use the [Betaflight Configurator](https://chrome.google.com/webstore/detail/betaflight-configurator/kdaghagfopacdngbohiknlhcocjccjao) Chrome app to flash and configure your firmware.
## Support
Don't leave comments on Docker Hub that are intended to be support requests, since Docker Hub doesn't send notifications when you write them. Instead create an issue on [GitHub](https://github.com/betaflight/docker-betaflight-build/issues).