diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2822090e..9589d400 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/docker-bake.hcl b/docker-bake.hcl index ba5ca32c..8f6465a8 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -36,6 +36,7 @@ target "all-arch" { "linux/s390x", "linux/riscv64", "linux/386", + "linux/loong64", ] } diff --git a/hack/install-and-test b/hack/install-and-test index e42d2b28..07c20971 100755 --- a/hack/install-and-test +++ b/hack/install-and-test @@ -17,8 +17,12 @@ echo $status | jq .supported | grep linux/riscv64 echo $status | jq .supported | grep linux/ppc64le echo $status | jq .supported | grep linux/386 +# TODO: needs https://github.com/moby/buildkit/pull/4392 +#echo $status | jq .supported | grep linux/loong64 + echo $status | jq .emulators | grep qemu-riscv64 echo $status | jq .emulators | grep qemu-arm +echo $status | jq .emulators | grep qemu-loongarch64 docker run --rm arm64v8/alpine uname -a docker run --rm arm32v7/alpine uname -a @@ -26,6 +30,7 @@ docker run --rm ppc64le/alpine uname -a docker run --rm s390x/alpine uname -a docker run --rm i386/alpine uname -a docker run --rm tonistiigi/debian:riscv uname -a +docker run --rm yangzewei2023/debian:loongarch64 uname -a if [ "$(uname -m)" != "x86_64" ]; then exit 0; fi @@ -33,6 +38,10 @@ status=$(docker run --rm --privileged tonistiigi/binfmt:${TAG:-test} --uninstall if echo $status | jq .supported | grep linux/arm64; then exit 1; fi if echo $status | jq .supported | grep linux/riscv64; then exit 1; fi + +# TODO: needs https://github.com/moby/buildkit/pull/4392 +#if echo $status | jq .supported | grep linux/loong64; then exit 1; fi + echo $status | jq .supported | grep linux/ppc64le echo $status | jq .supported | grep linux/arm/v7 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