-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 410c33a
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
on: push | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: | | ||
podman build --squash-all -t "ghcr.io/${{ github.repository }}" . | ||
podman login -u token -p "${{ github.token }}" ghcr.io | ||
podman push "ghcr.io/${{ github.repository }}" | ||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: sudo podman run --privileged "ghcr.io/${{ github.repository }}" | ||
- run: podman run arm64v8/debian true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM debian:testing AS build | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential ca-certificates git libglib2.0-dev ninja-build pkg-config python3 python3-venv | ||
RUN git clone --depth 1 https://gitlab.com/qemu-project/qemu.git | ||
RUN cd qemu && mkdir build && cd build && ../configure --target-list=aarch64-linux-user --static --disable-pie && make -j $(nproc) && cp qemu-aarch64 /aarch64-binfmt-P | ||
COPY register.c register.c | ||
RUN gcc -Wall -Wextra -Werror -static -o /register-aarch64-binfmt-P register.c | ||
|
||
FROM scratch | ||
COPY --from=build /aarch64-binfmt-P /aarch64-binfmt-P | ||
COPY --from=build /register-aarch64-binfmt-P /register-aarch64-binfmt-P | ||
CMD [ "/register-aarch64-binfmt-P" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
usr/bin/dd | ||
usr/bin/qemu-aarch64-static | ||
usr/lib/binfmt.d/qemu-aarch64.conf | ||
usr/libexec/qemu-binfmt/aarch64-binfmt-P |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
#include <err.h> | ||
#include <stddef.h> | ||
|
||
#include <sys/mount.h> | ||
#include <sys/stat.h> | ||
|
||
int main() | ||
{ | ||
int fd; | ||
|
||
if (mkdir("/binfmt_misc", 0700) == -1) err(1, "mkdir /binfmt_misc"); | ||
if (mount("", "/binfmt_misc", "binfmt_misc", 0, 0) == -1) err(1, "mount binfmt_misc"); | ||
|
||
if ((fd = open("/binfmt_misc/register", O_WRONLY)) == -1) err(1, "open /binfmt_misc/register"); | ||
char str[] = ":qemu-aarch64:M::\\x7f\\x45\\x4c\\x46\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfe\\xff\\xff\\xff:/aarch64-binfmt-P:POCF"; | ||
size_t len = sizeof(str) - 1; | ||
if (write(fd, str, len) != (ssize_t) len) err(1, "write /binfmt_misc/register"); | ||
|
||
close(fd); | ||
|
||
umount("/binfmt_misc"); | ||
rmdir("/binfmt_misc"); | ||
return 0; | ||
} |