You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
2.0 KiB

  1. # Building with Docker
  2. Building with [Docker](https://www.docker.com/) is remarkably easy: an isolated container will hold all the needed compilation tools so that they won't interfere with your system and you won't need to install and manage them by yourself. You'll only need to have Docker itself [installed](https://docs.docker.com/install/).
  3. The first time that you'll run a build it will take a little more time than following executions since it will be building its base image first. Once this initial process is completed, the firmware will be always built immediately.
  4. If you want to start from scratch - _even if that's rarely needed_ - delete the `inav-build` image on your system (`docker image rm inav-build`).
  5. ## Linux
  6. In the repo's root, run:
  7. ```
  8. ./build.sh <TARGET>
  9. ```
  10. Where `<TARGET>` must be replaced with the name of the target that you want to build. For example:
  11. ```
  12. ./build.sh MATEKF405SE
  13. ```
  14. ## Windows 10
  15. Docker on Windows requires full paths for mounting volumes in `docker run` commands. For example: `c:\Users\pspyc\Documents\Projects\inav` becomes `//c/Users/pspyc/Documents/Projects/inav` .
  16. If you are getting error "standard_init_linux.go:219: exec user process caused: no such file or directory", make sure `\cmake\docker.sh` has lf (not crlf) line endings.
  17. You'll have to manually execute the same steps that the build script does:
  18. 1. `docker build -t inav-build .`
  19. + This step is only needed the first time.
  20. 2. `docker run --rm -it -u root -v <PATH_TO_REPO>:/src inav-build <TARGET>`
  21. + Where `<PATH_TO_REPO>` must be replaced with the absolute path of where you cloned this repo (see above), and `<TARGET>` with the name of the target that you want to build.
  22. + Note that on Windows/WSL 2 mounted /src folder is writeable for root user only. You have to run build under root user. You can achieve this by using `-u root` option in the command line above, or by removing "USER inav" line from the .\DockerFile before building image.
  23. Refer to the [Linux](#Linux) instructions or the [build script](/build.sh) for more details.