Support for multi-arch Docker images

pull/143/head
Andre Richter 3 years ago
parent dee575bb18
commit 89472abea5
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -59,13 +59,12 @@ moment though.
## 🛠 System Requirements
The tutorials are primarily targeted at **Linux**-based distributions. Most stuff will also work on
other Unix flavors such as **macOS**, but this is only _experimental_.
The tutorials are primarily targeted at **Linux**-based distributions. Most stuff will also work on **macOS**, but this is only _experimental_.
### 🚀 The tl;dr Version
1. [Install Docker][install_docker].
1. Ensure your user account is in the [docker group].
1. [Install Docker Desktop][install_docker].
1. (**Linux only**) Ensure your user account is in the [docker group].
1. Prepare the `Rust` toolchain. Most of it will be handled on first use through the
[rust-toolchain](rust-toolchain) file. What's left for us to do is:
1. If you already have a version of Rust installed:
@ -82,12 +81,12 @@ other Unix flavors such as **macOS**, but this is only _experimental_.
```
1. In case you use `Visual Studio Code`, I strongly recommend installing the [Rust Analyzer extension].
1. If you are **NOT** running Linux, some `Ruby` gems are needed as well:
1. (**macOS only**) Install a few `Ruby` gems.
Run this in the repository root folder:
```bash
sudo gem install bundler
bundle config set path '.vendor/bundle'
bundle install
bundle install --path .vendor/bundle --without development
```
[docker group]: https://docs.docker.com/engine/install/linux-postinstall/

@ -5,6 +5,8 @@
FROM ubuntu:20.04
ARG VCS_REF
ARG GCC_AARCH64=https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf.tar.xz
ARG GCC_X86_64=https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
LABEL org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials"
@ -40,6 +42,15 @@ RUN set -ex; \
ruby \
ruby-dev \
; \
# GCC AArch64 tools
if [ "$(uname -m)" = "aarch64" ]; then wget ${GCC_AARCH64}; else wget ${GCC_X86_64}; fi; \
tar -xf gcc-arm-10*; \
cp \
gcc-arm-10*/bin/aarch64-none-elf-objdump \
gcc-arm-10*/bin/aarch64-none-elf-readelf \
gcc-arm-10*/bin/aarch64-none-elf-nm \
/usr/local/bin/; \
rm -rf gcc-arm-10*; \
# Ruby dependencies
gem install bundler; \
bundle config set --local without 'development'; \
@ -51,7 +62,7 @@ RUN set -ex; \
./configure --target-list=aarch64-softmmu --enable-modules \
--enable-tcg-interpreter --enable-debug-tcg \
--python=/usr/bin/python3; \
make -j8; \
make -j10; \
make install; \
cd ..; \
rm -rf qemu; \
@ -60,19 +71,10 @@ RUN set -ex; \
cd openocd; \
./bootstrap; \
./configure --enable-ftdi; \
make -j8; \
make -j10; \
make install; \
# GDB
wget -P ~ git.io/.gdbinit; \
# GCC AArch64 tools
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.2-2020.11/binrel/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz; \
tar -xf gcc-arm-10*; \
cp \
gcc-arm-10*/bin/aarch64-none-elf-objdump \
gcc-arm-10*/bin/aarch64-none-elf-readelf \
gcc-arm-10*/bin/aarch64-none-elf-nm \
/usr/local/bin/; \
rm -rf gcc-arm-10*; \
# Cleanup
apt-get purge -y --auto-remove $tempPkgs; \
apt-get autoremove -q -y; \

@ -2,10 +2,24 @@
##
## Copyright (c) 2019-2021 Andre Richter <andre.o.richter@gmail.com>
default: docker_build
# Reference followed: https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux
docker_build:
TAG=2021.11
default: build_local
build_local:
cp ../../Gemfile .
docker build \
--tag rustembedded/osdev-utils:$(TAG) \
--build-arg VCS_REF=`git rev-parse --short HEAD` . \
rm Gemfile
buildx_push:
cp ../../Gemfile .
docker build -t rustembedded/osdev-utils:2021.11 \
--build-arg VCS_REF=`git rev-parse --short HEAD` .
docker buildx build \
--push \
--platform linux/arm64/v8,linux/amd64 \
--tag rustembedded/osdev-utils:$(TAG) \
--build-arg VCS_REF=`git rev-parse --short HEAD` .
rm Gemfile

Loading…
Cancel
Save