From b94a3060819c878e7b6577b0dceef8e371bd52a5 Mon Sep 17 00:00:00 2001 From: yzewei Date: Mon, 25 Dec 2023 14:56:39 +0800 Subject: [PATCH] add loong 64 support Signed-off-by: yzewei --- .github/workflows/ci.yml | 3 ++- cmd/binfmt/config.go | 5 +++++ scripts/configure_qemu.sh | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 868713d5..66451901 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,13 +114,14 @@ jobs: name: Test mainline if: matrix.target == 'mainline' run: | - docker run --rm --privileged tonistiigi/binfmt:test --uninstall amd64,arm64,arm,ppc64le,s390x,riscv64 + docker run --rm --privileged tonistiigi/binfmt:test --uninstall amd64,arm64,arm,ppc64le,s390x,riscv64,loongarch64 docker run --rm --privileged tonistiigi/binfmt:test --install all docker run --rm arm64v8/alpine uname -a docker run --rm arm32v7/alpine uname -a docker run --rm ppc64le/alpine uname -a docker run --rm s390x/alpine uname -a docker run --rm tonistiigi/debian:riscv uname -a + docker run --rm yangzewei2023/debian:loongarch64 uname -a docker run --rm --platform=linux/s390x s390x/ubuntu apt update docker run --rm --platform=linux/ppc64le ppc64le/ubuntu apt update docker run --rm --platform=linux/arm64 arm64v8/ubuntu apt update diff --git a/cmd/binfmt/config.go b/cmd/binfmt/config.go index 1bdb95f8..6d4920cb 100644 --- a/cmd/binfmt/config.go +++ b/cmd/binfmt/config.go @@ -65,6 +65,11 @@ var configs = map[string]config{ magic: `\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08`, mask: `\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff`, }, + "loongarch64": { + binary: "qemu-loongarch64", + magic: `\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01`, + mask: `\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff`, + }, } func allArch() []string { diff --git a/scripts/configure_qemu.sh b/scripts/configure_qemu.sh index 3e542ff0..43c323a8 100755 --- a/scripts/configure_qemu.sh +++ b/scripts/configure_qemu.sh @@ -34,6 +34,9 @@ if [ -z "$QEMU_TARGETS" ]; then if [ "$arch" != "mips64" ] ; then QEMU_TARGETS="$QEMU_TARGETS mips64-linux-user" fi + if [ "$arch" != "loong64" ] ; then + QEMU_TARGETS="$QEMU_TARGETS loongarch64-linux-user" + fi fi set -x