Skip to content

Commit

Permalink
assemble arm64 image in amd64 container
Browse files Browse the repository at this point in the history
1. In order to support qemu-binfmt with non-native chroot, install
qemu-user-static on host rather than in container

On debian 12 host, after install qemu-user-static

$ cat /proc/sys/fs/binfmt_misc/qemu-aarch64
enabled
interpreter /usr/libexec/qemu-binfmt/aarch64-binfmt-P
flags: POCF
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff

On an amd64 host:
$ debootstrap --arch=arm64 buster buster-chroot http://deb.debian.org/debian
...
$ chroot buster-chroot /bin/bash

See https://issues.guix.gnu.org/36117 for detail

2. Install arch-test in container unconditionally
which is required by mmdebstrap

root@0fb7bae77452:/usr/src/config/uefi-arm64-ostree# ruck build --config image.yaml
...
2024-04-01 12:30:49,605 Running mmdebstrap.
I: automatically chosen mode: root
E: install arch-test for foreign architecture support

Signed-off-by: Hongxu Jia <[email protected]>
  • Loading branch information
hongxu-jia committed Apr 1, 2024
1 parent 2f70f79 commit 440181c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM debian:testing
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --no-install-recommends \
arch-test \
mmdebstrap \
bubblewrap \
dosfstools \
Expand Down Expand Up @@ -32,8 +33,6 @@ RUN apt-get update && \
git && \
rm -rf /var/lib/apt/lists/*

RUN if [ "$(uname -m)" = "x86_64" ]; then apt update && apt install qemu-user-static arch-test -y; fi

COPY files/pip.conf /etc/pip.conf
RUN pip install omegaconf

Check failure on line 37 in docker/Dockerfile

View workflow job for this annotation

GitHub Actions / docker

DL3013 warning: Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>` or `pip install --requirement <requirements file>`

Check failure on line 37 in docker/Dockerfile

View workflow job for this annotation

GitHub Actions / docker

DL3042 warning: Avoid use of cache directory with pip. Use `pip install --no-cache-dir <package>`

Expand Down
4 changes: 4 additions & 0 deletions tools/build-container.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash

# qemu-binfmt with non-native chroot
sudo apt update
sudo apt install qemu-user-static -y

docker build -t ruck docker

0 comments on commit 440181c

Please sign in to comment.