Skip to content

Commit 89472ab

Browse files
committed
Support for multi-arch Docker images
1 parent dee575b commit 89472ab

File tree

3 files changed

+38
-23
lines changed

3 files changed

+38
-23
lines changed

README.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@ moment though.
5959

6060
## 🛠 System Requirements
6161

62-
The tutorials are primarily targeted at **Linux**-based distributions. Most stuff will also work on
63-
other Unix flavors such as **macOS**, but this is only _experimental_.
62+
The tutorials are primarily targeted at **Linux**-based distributions. Most stuff will also work on **macOS**, but this is only _experimental_.
6463

6564
### 🚀 The tl;dr Version
6665

67-
1. [Install Docker][install_docker].
68-
1. Ensure your user account is in the [docker group].
66+
1. [Install Docker Desktop][install_docker].
67+
1. (**Linux only**) Ensure your user account is in the [docker group].
6968
1. Prepare the `Rust` toolchain. Most of it will be handled on first use through the
7069
[rust-toolchain](rust-toolchain) file. What's left for us to do is:
7170
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_.
8281
```
8382

8483
1. In case you use `Visual Studio Code`, I strongly recommend installing the [Rust Analyzer extension].
85-
1. If you are **NOT** running Linux, some `Ruby` gems are needed as well:
84+
1. (**macOS only**) Install a few `Ruby` gems.
85+
86+
Run this in the repository root folder:
8687

8788
```bash
88-
sudo gem install bundler
89-
bundle config set path '.vendor/bundle'
90-
bundle install
89+
bundle install --path .vendor/bundle --without development
9190
```
9291

9392
[docker group]: https://docs.docker.com/engine/install/linux-postinstall/

docker/rustembedded-osdev-utils/Dockerfile

+13-11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
FROM ubuntu:20.04
66

77
ARG VCS_REF
8+
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
9+
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
810

911
LABEL org.label-schema.vcs-ref=$VCS_REF \
1012
org.label-schema.vcs-url="https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials"
@@ -40,6 +42,15 @@ RUN set -ex; \
4042
ruby \
4143
ruby-dev \
4244
; \
45+
# GCC AArch64 tools
46+
if [ "$(uname -m)" = "aarch64" ]; then wget ${GCC_AARCH64}; else wget ${GCC_X86_64}; fi; \
47+
tar -xf gcc-arm-10*; \
48+
cp \
49+
gcc-arm-10*/bin/aarch64-none-elf-objdump \
50+
gcc-arm-10*/bin/aarch64-none-elf-readelf \
51+
gcc-arm-10*/bin/aarch64-none-elf-nm \
52+
/usr/local/bin/; \
53+
rm -rf gcc-arm-10*; \
4354
# Ruby dependencies
4455
gem install bundler; \
4556
bundle config set --local without 'development'; \
@@ -51,7 +62,7 @@ RUN set -ex; \
5162
./configure --target-list=aarch64-softmmu --enable-modules \
5263
--enable-tcg-interpreter --enable-debug-tcg \
5364
--python=/usr/bin/python3; \
54-
make -j8; \
65+
make -j10; \
5566
make install; \
5667
cd ..; \
5768
rm -rf qemu; \
@@ -60,19 +71,10 @@ RUN set -ex; \
6071
cd openocd; \
6172
./bootstrap; \
6273
./configure --enable-ftdi; \
63-
make -j8; \
74+
make -j10; \
6475
make install; \
6576
# GDB
6677
wget -P ~ git.io/.gdbinit; \
67-
# GCC AArch64 tools
68-
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; \
69-
tar -xf gcc-arm-10*; \
70-
cp \
71-
gcc-arm-10*/bin/aarch64-none-elf-objdump \
72-
gcc-arm-10*/bin/aarch64-none-elf-readelf \
73-
gcc-arm-10*/bin/aarch64-none-elf-nm \
74-
/usr/local/bin/; \
75-
rm -rf gcc-arm-10*; \
7678
# Cleanup
7779
apt-get purge -y --auto-remove $tempPkgs; \
7880
apt-get autoremove -q -y; \

docker/rustembedded-osdev-utils/Makefile

+18-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22
##
33
## Copyright (c) 2019-2021 Andre Richter <[email protected]>
44

5-
default: docker_build
5+
# Reference followed: https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux
66

7-
docker_build:
7+
TAG=2021.11
8+
9+
default: build_local
10+
11+
build_local:
12+
cp ../../Gemfile .
13+
docker build \
14+
--tag rustembedded/osdev-utils:$(TAG) \
15+
--build-arg VCS_REF=`git rev-parse --short HEAD` . \
16+
rm Gemfile
17+
18+
buildx_push:
819
cp ../../Gemfile .
9-
docker build -t rustembedded/osdev-utils:2021.11 \
10-
--build-arg VCS_REF=`git rev-parse --short HEAD` .
20+
docker buildx build \
21+
--push \
22+
--platform linux/arm64/v8,linux/amd64 \
23+
--tag rustembedded/osdev-utils:$(TAG) \
24+
--build-arg VCS_REF=`git rev-parse --short HEAD` .
1125
rm Gemfile

0 commit comments

Comments
 (0)