Skip to content

Commit 98db66a

Browse files
committed
feat: add loong64 support
1 parent 47b6655 commit 98db66a

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

.github/workflows/build.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- { qemu_arch: x86_64, appimage_arch: x86_64 }
3636
- { qemu_arch: armv7, appimage_arch: armhf }
3737
- { qemu_arch: aarch64, appimage_arch: aarch64 }
38+
- { qemu_arch: loong64, appimage_arch: loong64 }
3839

3940
steps:
4041
- name: Checkout
@@ -46,12 +47,21 @@ jobs:
4647
git rev-parse --short HEAD | xargs >> src/runtime/version
4748
4849
- name: Build
50+
if: matrix.appimage_arch != 'loong64'
4951
env:
5052
ARCHITECTURE: ${{ matrix.appimage_arch }}
5153
run: |
5254
sudo apt-get -y install qemu-user-static
5355
./chroot_build.sh
5456
57+
- name: Build Loongarch
58+
if: matrix.appimage_arch == 'loong64'
59+
env:
60+
ARCH: ${{ matrix.appimage_arch }}
61+
run: |
62+
docker run --rm --privileged loongcr.lcpu.dev/multiarch/archlinux --reset -p yes
63+
./build_docker.sh
64+
5565
- name: Sign
5666
env:
5767
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ modules.order
5050
Module.symvers
5151
Mkfile.old
5252
dkms.conf
53+
54+
miniroot
55+
fuse-3.15.0
56+
out
57+
squa*
58+
*.tar.*

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export CFLAGS="-ffunction-sections -fdata-sections -Os"
2929

3030
# Build static squashfuse
3131
apk add zstd-dev zlib-dev zlib-static # fuse3-dev fuse3-static fuse-static fuse-dev
32+
if [ "$ARCHITECTURE" == "loong64" ];then
33+
apk add --no-cache zstd-static
34+
fi
3235
find / -name "libzstd.*" 2>/dev/null || true
3336
wget -c -q "https://github.com/vasi/squashfuse/archive/e51978c.tar.gz"
3437
echo "f544029ad30d8fbde4e4540c574b8cdc6d38b94df025a98d8551a9441f07d341 e51978c.tar.gz" | sha256sum -c

build_docker.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
if [[ "${ARCH:-}" == "" ]]; then
6+
echo "Usage: env ARCH=... bash $0"
7+
exit 1
8+
fi
9+
10+
repo_root="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")"/.)"
11+
12+
case "$ARCH" in
13+
x86_64)
14+
image_prefix=amd64/alpine
15+
platform=linux/amd64
16+
;;
17+
i686)
18+
image_prefix=i386/alpine
19+
platform=linux/i386
20+
;;
21+
armhf)
22+
image_prefix=arm32v7/alpine
23+
platform=linux/arm/v7
24+
;;
25+
aarch64)
26+
image_prefix=arm64v8/alpine
27+
platform=linux/arm64/v8
28+
;;
29+
loong64)
30+
# image_prefix=lcr.loongnix.cn/library # official unsatble
31+
image_prefix=quay.io/msojocs/alpine-loong64
32+
platform=linux/loong64
33+
;;
34+
*)
35+
echo "unknown architecture: $ARCH"
36+
exit 2
37+
;;
38+
esac
39+
40+
uid="$(id -u)"
41+
docker run \
42+
--rm \
43+
-i \
44+
-e ARCH \
45+
-e GITHUB_ACTIONS \
46+
-e GITHUB_RUN_NUMBER \
47+
-e ARCHITECTURE="loong64" \
48+
-e OUT_UID="$uid" \
49+
-v "$repo_root":/source \
50+
-v "$PWD":/out \
51+
-w /out \
52+
"$image_prefix:3.19" \
53+
sh <<\EOF
54+
/source/build.sh
55+
chown "$OUT_UID" out
56+
chown "$OUT_UID" out/*
57+
EOF
58+
59+
mv out/runtime-fuse3-loong64 out/runtime-loong64

0 commit comments

Comments
 (0)