forked from AppImage/type2-runtime
-
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
Showing
5 changed files
with
121 additions
and
3 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
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 |
---|---|---|
|
@@ -50,3 +50,9 @@ modules.order | |
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
|
||
miniroot | ||
fuse-3.15.0 | ||
out | ||
squa* | ||
*.tar.* |
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
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,21 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
repo_root="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")"/.)" | ||
image="msojocs/alpine-loongarch:240514" | ||
platform="linux/loong64" | ||
uid="$(id -u)" | ||
docker run \ | ||
--platform "$platform" \ | ||
--rm \ | ||
-i \ | ||
-e ARCH \ | ||
-e GITHUB_ACTIONS \ | ||
-e GITHUB_RUN_NUMBER \ | ||
-e OUT_UID="$uid" \ | ||
-v "$repo_root":/source \ | ||
-v "$PWD":/out \ | ||
-w /out \ | ||
"$image" \ | ||
sh -ex /source/build.sh |
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,71 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
############################################# | ||
# Download and extract minimal Alpine system | ||
############################################# | ||
if [ ! -f "alpine-minirootfs-edge-240514-loongarch64.tar.gz" ]; then | ||
wget "https://dev.alpinelinux.org/~loongarch/edge/releases/loongarch64/alpine-minirootfs-edge-240514-loongarch64.tar.gz" | ||
fi | ||
if [ ! -z "$(ls -A miniroot/proc)" ]; then | ||
sudo umount miniroot/proc miniroot/sys miniroot/dev | ||
fi | ||
sudo rm -rf ./miniroot true # Clean up from previous runs | ||
mkdir -p ./miniroot | ||
cd ./miniroot | ||
sudo tar xf ../alpine-minirootfs-*-"${ARCHITECTURE}".tar.gz | ||
cd - | ||
|
||
############################################# | ||
# Prepare chroot | ||
############################################# | ||
|
||
sudo cp -r ./src miniroot/src | ||
sudo cp -r ./patches miniroot/patches | ||
|
||
sudo mount -o bind /dev miniroot/dev | ||
sudo mount -t proc none miniroot/proc | ||
sudo mount -t sysfs none miniroot/sys | ||
sudo cp -p /etc/resolv.conf miniroot/etc/ | ||
|
||
############################################# | ||
# Run build.sh in chroot | ||
############################################# | ||
|
||
if [ "$ARCHITECTURE" = "x86" ] || [ "$ARCHITECTURE" = "x86_64" ]; then | ||
echo "Architecture is x86 or x86_64, hence not using qemu-arm-static" | ||
sudo cp build.sh miniroot/build.sh && sudo chroot miniroot /bin/sh -ex /build.sh | ||
elif [ "$ARCHITECTURE" = "aarch64" ] ; then | ||
echo "Architecture is aarch64, hence using qemu-aarch64-static" | ||
sudo cp "$(which qemu-aarch64-static)" miniroot/usr/bin | ||
sudo cp build.sh miniroot/build.sh && sudo chroot miniroot qemu-aarch64-static /bin/sh -ex /build.sh | ||
elif [ "$ARCHITECTURE" = "armhf" ] ; then | ||
echo "Architecture is armhf, hence using qemu-arm-static" | ||
sudo cp "$(which qemu-arm-static)" miniroot/usr/bin | ||
sudo cp build.sh miniroot/build.sh && sudo chroot miniroot qemu-arm-static /bin/sh -ex /build.sh | ||
elif [ "$ARCHITECTURE" = "loongarch64" ] ; then | ||
echo "Architecture is loongarch64, hence using qemu-loongarch64-static" | ||
sudo cp "$(which qemu-loongarch64-static)" miniroot/usr/bin | ||
sudo cp build.sh miniroot/build.sh && sudo chroot miniroot qemu-loongarch64-static /bin/sh -ex /build.sh | ||
else | ||
echo "Edit chroot_build.sh to support this architecture as well, it should be easy" | ||
exit 1 | ||
fi | ||
|
||
############################################# | ||
# Clean up chroot | ||
############################################# | ||
|
||
sudo umount miniroot/proc miniroot/sys miniroot/dev | ||
|
||
############################################# | ||
# Copy build artefacts out | ||
############################################# | ||
|
||
# Use the same architecture names as https://github.com/AppImage/AppImageKit/releases/ | ||
if [ "$ARCHITECTURE" = "x86" ] ; then ARCHITECTURE=i686 ; fi | ||
|
||
mkdir out/ | ||
sudo find miniroot/ -type f -executable -name 'runtime-fuse3' -exec cp {} "out/runtime-${ARCHITECTURE}" \; | ||
sudo rm -rf miniroot/ |