Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
FROM fedora:latest

# Install Development Tools and required packages
RUN dnf update -y && \
dnf install -y @development-tools && \
dnf install -y \
direnv \
arm-none-eabi-gcc-cs \
arm-none-eabi-gcc-c++ \
arm-none-eabi-newlib \
cmake \
git \
python3 \
python3-virtualenv \
python3-pip \
ninja-build \
pkgconf \
glib2-devel \
flex \
bison \
clang \
zlib-devel \
meson \
pixman-devel \
alsa-lib-devel \
texinfo \
lzo-devel \
snappy-devel \
libaio-devel \
libtasn1-devel \
gnutls-devel \
nettle-devel \
curl \
dtc \
libcap-devel \
libcap-ng-devel \
socat \
libslirp-devel \
libffi-devel \
libusb1-devel \
ncurses-devel && \
dnf clean all

RUN dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y rleh/arm-none-eabi-gdb && \
dnf install -y arm-none-eabi-gdb

ARG USERNAME=vscode
RUN useradd -m -s /bin/bash ${USERNAME} && \
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

# Set working directory and switch to non-root user
WORKDIR /home/${USERNAME}
USER ${USERNAME}

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. $HOME/.cargo/env && \
rustup component add rust-src && \
rustup component add llvm-tools-preview && \
cargo install cargo-binutils && \
rustup target add thumbv7em-none-eabihf && \
rustup target add thumbv7em-none-eabi

# Clone, build, and install QEMU
RUN git clone --depth 1 https://github.com/thomasw04/qemu.git /tmp/qemu && \
cd /tmp/qemu && \
python3 -m venv .venv && \
. .venv/bin/activate && \
pip install --no-cache-dir tomli sphinx && \
mkdir build && cd build && \
../configure --disable-werror --cc=clang --cxx=clang++ --extra-cflags="-Wno-error -fdeclspec" --target-list=arm-softmmu,arm-linux-user --enable-kvm && \
make -j$(nproc) && \
sudo make install && \
cd / && \
rm -rf /tmp/qemu

RUN git clone --single-branch --depth 1 -b "develop" \
https://github.com/stlink-org/stlink.git /tmp/stlink && \
cd /tmp/stlink && \
make -j release && \
sudo make install && \
sudo ldconfig

# Fix for fedora not finding libstlink.so.1
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Osiris Dev Container",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"remoteUser": "vscode",
"privileged": false,
"capAdd": [
// Permissions for accessing host USB devices
"SYS_RAWIO", "CAP_MKNOD"
],
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"vadimcn.vscode-lldb",
"ms-vscode.cmake-tools",
"llvm-vs-code-extensions.vscode-clangd"
]
}
},
"runArgs": [
// Mount USB devices under Linux
"--device",
"/dev/bus/usb:/dev/bus/usb"
],
"mounts": [
// Make ssh keys available
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
]
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build/
build*/
.vscode/
qemu/
.venv/
Expand Down