Skip to content

Docker container that contains everything required to build the Betaflight firmware

License

Notifications You must be signed in to change notification settings

betaflight/docker-betaflight-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker Betaflight build

Docker Pulls Docker Stars License

(Markdown optimised for display in Dockerhub.)

Clone and edit 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.

Usage

Install Docker

The latest docker platform is available from https://www.docker.com/. If your system does not meet the system requirements for the latest version, check out the 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 repository to your user directory. If you want to place it outside the user directory you need to adjust the VirtualBox VM sharing settings 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 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.

About

Docker container that contains everything required to build the Betaflight firmware

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published