diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..9f8a6dfd4d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ +# syntax=docker/dockerfile:1 +# base image from ggrouv: https://github.com/ggurov/rusefibuildcontainer +FROM ubuntu:mantic +RUN apt-get -y update +RUN apt-get -y install make automake autoconf gcc-12-arm-linux-gnueabi gcc-12-arm-linux-gnueabi-base gcc-arm-none-eabi binutils-arm-none-eabi git nano openjdk-21-jdk-headless mtools dosfstools xxd +RUN apt-get -y install openssh-server cmake rsync gdb-multiarch build-essential g++-12 gcc-12-multilib g++-12-multilib zip zsh +# used for remote non-devcontainer use ex: (https://blog.jetbrains.com/clion/2020/01/using-docker-with-clion/) [also on vscode: https://code.visualstudio.com/remote/advancedcontainers/develop-remote-host] +RUN useradd -m rusefi && yes password | passwd rusefi +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12 +CMD service ssh start && /bin/bash \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..5e7c759187 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,44 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +{ + "name": "rusEFI-devcontainer", + "build": { + // Path is relative to the devcontainer.json file. + "dockerfile": "Dockerfile" + }, + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + "2222:22", // ssh on container + 29002 // simulator + ], + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "git submodule update --init", + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "eamodio.gitlens", + "marus25.cortex-debug", + "Gruntfuggly.todo-tree", + "ms-vscode.cpptools", + "vadimcn.vscode-lldb" + ], + "settings": { + "editor.tabSize": 4, + "terminal.integrated.defaultProfile.linux": "zsh", + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + "icon": "terminal-bash" + }, + "zsh": { + "path": "zsh" + } + } + } + } + } + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/.devcontainer/devcontainer.md b/.devcontainer/devcontainer.md new file mode 100644 index 0000000000..b8ce1cf8a1 --- /dev/null +++ b/.devcontainer/devcontainer.md @@ -0,0 +1,47 @@ +## devcontainer 101 + +#### why use this?: +A development container is a Docker container that vsCode, through an extension [(Visual Studio Code Dev Containers)](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), uses to set up a development environment isolated from the host. + +A more nerdy explanation is available at: https://code.visualstudio.com/docs/devcontainers/containers + +In the case of rusefi, it is used to set up the relatively complicated toolset as an alternative to [setup_linux_environment.sh](https://github.com/rusefi/rusefi/blob/master/firmware/setup_linux_environment.sh),Since the script, in addition to only working on Linux, only works for installations that use APT as a package manager (ie any Debian/Ubuntu derivative), and would only work to build the firmware (a couple of extra dependencies are used for tests and the simulator) + + +#### System requirements: + +Linux: +- Docker CE with Docker Compose, also vscode + +macOS: +- Docker Desktop 2.0+. + +Windows: +- Docker Desktop 2.0 and up +- WSL 2 + +for WSL 2: +- Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11 + +howto install WSL2: https://learn.microsoft.com/en-us/windows/wsl/install + + + +in case of a error similar to: + +| Unable to detect if server is already installed: Error: Failed to probe if server is already installed: code: Failed to probe if server is already installed: code: 4294967295, , Unsupported console settings. In order to use this feature, the legacy console must be disabled. + +https://learn.microsoft.com/en-us/windows/wsl/troubleshooting#error-0x80040306-on-installation +> This has to do with the fact that we do not support legacy console. To turn off legacy console: +> +> Open cmd.exe +> Right click title bar -> Properties -> Uncheck Use legacy console +> Click OK + +In addition, on Windows you have to clone the repository inside WSL, otherwise you will have performance problems since the container will have a longer bind (having to go from the docker container to WSL and from WSL to Windows) + +Once the container creation is complete, you will be able to compile the firmware or the simulator or the tests. +For the firmware you will want to use (firmware/bin/compile.sh) instead of make to be able to select the variant of your board. + +note: +This still needs a little testing and feedback to see if this same readme or the docker image needs to be improved. If you have any questions, ask the Discord server or personally to @derek_boom (Diego) \ No newline at end of file