Skip to content

Commit

Permalink
Add build for mipsel,loongarch64 to GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Mar 17, 2024
1 parent 6fe14d9 commit cffa283
Show file tree
Hide file tree
Showing 2 changed files with 282 additions and 1 deletion.
281 changes: 281 additions & 0 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1078,3 +1078,284 @@ jobs:
with:
name: SeriousSamTSE-Vk-${{ steps.date.outputs.time }}-1.10.6d-x86_64.AppImage
path: SeriousSamTSE-Vk-${{ steps.date.outputs.time }}-1.10.6d-x86_64.AppImage

build-linux-mipsel:
name: Linux ${{ matrix.Configuration }} mipsel
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Configuration: [Release]
Platform: [x64]

steps:
- uses: actions/checkout@v4

- name: Install nipsel image
run: |
sudo apt-get update -qq
sudo apt-get install -qq -y xz-utils qemu qemu-user-static binfmt-support parted wget dosfstools zip
sudo adduser $USER kvm
echo "*** Download and install mipsel image ***"
wget -c http://nightly.altlinux.org/p9-mipsel/release/alt-p9-lxqt-20190703-mipsel.img.xz
xz -d alt-p9-lxqt-20190703-mipsel.img.xz
mkdir alt-mipsel && mkdir alt-image
sudo losetup -f --show -o $((2048*512)) alt-p9-lxqt-20190703-mipsel.img
sudo mount /dev/loop3 alt-image
sudo cp -ax alt-image/* alt-mipsel
echo "*** Remove mipsel image ***"
sudo umount alt-image
sudo losetup -d /dev/loop3
rm -f alt-p9-lxqt-20190703-mipsel.img
rm -f alt-p9-lxqt-20190703-mipsel.img.xz
echo "*** Install magic bytes ***"
cat > qemu-mipsel.conf << EOF
:mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel-static:
EOF
echo "*** Create processor info ***"
sudo cp -vfr qemu-mipsel.conf /etc/binfmt.d/
sudo sudo systemctl restart systemd-binfmt.service
sudo cat /proc/sys/fs/binfmt_misc/mipsel
echo "*** Create processor info ***"
cat > Baikal-T << EOF
system type : Baikal-T Generic SoC
machine : Baikal-T1 BFK3 evaluation board
processor : 0
cpu model : MIPS P5600 V3.0 FPU V2.0
BogoMIPS : 1196.85
wait instruction : yes
microsecond timers : yes
tlb_entries : 576
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : vz msa eva xpa
shadow register sets : 1
kscratch registers : 3
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
EOF
echo "*** Create mount script ***"
cat > alt-mipsel.sh << EOF
sudo mount --bind /proc alt-mipsel/proc
sudo mount --bind /sys alt-mipsel/sys
sudo mount --bind /dev alt-mipsel/dev
sudo mount --bind /dev/pts alt-mipsel/dev/pts
sudo mount --bind Baikal-T /proc/cpuinfo
EOF
echo "*** Copy qemu user static binaries to mipsel dir ***"
sudo cp -f /usr/bin/qemu-* alt-mipsel/usr/bin
chmod +x alt-mipsel.sh
cat > resolv.conf << EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
sudo cp -f resolv.conf alt-mipsel/etc
sudo cp -f resolv.conf alt-mipsel/var/resolv/etc
- name: Build
run: |
sudo sh alt-mipsel.sh
sudo chroot alt-mipsel /bin/bash -e <<EOF
uname -a
cat /proc/cpuinfo
apt-get update -qq
apt-get install -qq -y git cmake gcc-c++ libSDL2-devel libogg-devel libstdc++-devel-static libvorbis-devel zlib-devel flex bison
apt-get install -qq -y libvulkan1 vulkan-validation-layers libvulkan-devel
git clone https://github.com/tx00100xt/SeriousSamClassic-VK.git seriossam
mkdir /seriossam/build
mkdir /seriossam/build-xplus
cd /seriossam/build
cmake ..
make -j8
make install
cd /seriossam/build-xplus
cmake -DXPLUS=TRUE ..
make -j8
make install
exit
EOF
- name: Get current date
id: date
uses: Kaven-Universe/github-action-current-date-time@v1
with:
format: "YYYYMMDD"

- name: Show current date
run: |
echo "${{ steps.date.outputs.time }}"
- name: Create Archive
run: |
cd ${{github.workspace}}
mkdir {mipsel,mipsel/SamTFE,mipsel/SamTFE/Mods,mipsel/SamTFE/Mods/XPLUS,mipsel/SamTSE,mipsel/SamTSE/Mods,mipsel/SamTSE/Mods/XPLUS,}
sudo mv -f ${{github.workspace}}/alt-mipsel/seriossam/SamTFE/Bin ${{github.workspace}}/mipsel/SamTFE
sudo mv -f ${{github.workspace}}/alt-mipsel/seriossam/SamTSE/Bin ${{github.workspace}}/mipsel/SamTSE
sudo mv -f ${{github.workspace}}/alt-mipsel/seriossam/SamTFE/Mods/XPLUS/Bin ${{github.workspace}}/mipsel/SamTFE/Mods/XPLUS
sudo mv -f ${{github.workspace}}/alt-mipsel/seriossam/SamTSE/Mods/XPLUS/Bin ${{github.workspace}}/mipsel/SamTSE/Mods/XPLUS
sudo chown -R $USER:$USER mipsel
echo "*** Create archive ***"
cd ${{github.workspace}}
cp -fr {SamTFE/SE1_10b.gro,SamTFE/ModEXT.txt} mipsel/SamTFE
cp -fr {SamTSE/SE1_10b.gro,SamTSE/ModEXT.txt} mipsel/SamTSE
tar -cJpvf SeriousSamClassicVk-${{ steps.date.outputs.time }}-lnx-mipsel-bin.tar.xz mipsel
- name: Free up resources
run: |
echo "*** Umount ***"
sudo umount ${{github.workspace}}/alt-mipsel/proc/cpuinfo
sudo umount ${{github.workspace}}/alt-mipsel/proc
sudo umount ${{github.workspace}}/alt-mipsel/dev/pts
sudo umount ${{github.workspace}}/alt-mipsel/dev
sudo umount ${{github.workspace}}/alt-mipsel/sys
echo "*** Remove mopsel image ***"
sudo rm -fr ${{github.workspace}}/alt-mipsel
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: SeriousSamClassicVk-${{ steps.date.outputs.time }}-lnx-mipsel-bin.tar.xz
path: SeriousSamClassicVk-${{ steps.date.outputs.time }}-lnx-mipsel-bin.tar.xz

build-linux-loongarch64:
name: Linux ${{ matrix.Configuration }} loongarch64
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Configuration: [Release]
Platform: [x64]

steps:
- uses: actions/checkout@v4

- name: Install loongarch64 image
run: |
sudo apt-get update -qq
sudo apt-get install -qq -y git xz-utils qemu qemu-user-static binfmt-support parted wget dosfstools zip p7zip-full squashfs-tools rpm2cpio
sudo adduser $USER kvm
echo "*** Download and install qemu-loongarch64-static ***"
wget -c http://mirror.ghettoforge.org/distributions/gf/el/9/gf/x86_64/qemu-user-static-loongarch64-8.2.0-1.2.gf.el9.x86_64.rpm
rpm2cpio qemu-user-static-loongarch64-8.2.0-1.2.gf.el9.x86_64.rpm | cpio -i --make-directories
sudo cp -vfr usr/bin/qemu-loongarch64-static /usr/bin
echo "*** Download and install loongarch64 image ***"
echo Images 20240221 20231201
wget -c http://get.srt.basealt.ru/ports/loongarch64/Sisyphus/images/loongarch64/regular-xfce-20240221-loongarch64.iso
7z x '-i!live' regular-xfce-20240221-loongarch64.iso
sudo unsquashfs -d alt-loongarch64 live
rm -f regular-xfce-20240221-loongarch64.iso
rm -f live
echo "*** Install magic bytes ***"
cat > qemu-loongarch64.conf << EOF
:loongarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-loongarch64-static:
EOF
echo "*** Create processor info ***"
sudo cp -vfr qemu-loongarch64.conf /etc/binfmt.d/
sudo sudo systemctl restart systemd-binfmt.service
sudo cat /proc/sys/fs/binfmt_misc/loongarch64
echo "*** Create processor info ***"
cat > Loongson-3A5000 << EOF
system type : generic-loongson-machine
processor : 0
package : 0
core : 0
cpu family : Loongson-64bit
model name : Loongson-3A5000-HV
CPU Revision : 0x11
FPU Revision : 0x00
CPU MHz : 2500.00
BogoMIPS : 5000.00
TLB entries : 2112
Address sizes : 48 bits physical, 48 bits virtual
isa : loongarch32 loongarch64
features : cpucfg lam ual fpu lsx lasx complex crypto lvz lbt_x86 lbt_arm lbt_mips
hardware watchpoint : yes, iwatch count: 8, dwatch count: 8
EOF
echo "*** Create mount script ***"
cat > alt-loongarch64.sh << EOF
sudo mount --bind /proc alt-loongarch64/proc
sudo mount --bind /sys alt-loongarch64/sys
sudo mount --bind /dev alt-loongarch64/dev
sudo mount --bind /dev/pts alt-loongarch64/dev/pts
sudo mount --bind Loongson-3A5000 /proc/cpuinfo
EOF
echo "*** Copy qemu user static binaries to loongarch64 dir ***"
sudo cp -vfr /usr/bin/qemu-* alt-loongarch64/usr/bin
chmod +x alt-loongarch64.sh
cat > resolv.conf << EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
sudo cp -f resolv.conf alt-loongarch64/etc
sudo cp -f resolv.conf alt-loongarch64/var/resolv/etc
- name: Build
run: |
sudo sh alt-loongarch64.sh
sudo chroot alt-loongarch64 /bin/bash -e <<EOF
uname -a
cat /proc/cpuinfo
apt-get update -qq
apt-get install -qq -y git cmake gcc-c++ libSDL2 libSDL2-devel-static libSDL2-devel libogg-devel libstdc++-devel-static libvorbis-devel zlib-devel flex bison
apt-get install -qq -y libvulkan1 vulkan-validation-layers libvulkan-devel
cp -vfr /usr/lib64/*SDL2* /usr/lib
cp -vfr /usr/lib64/*libz.* /usr/lib
cp -vfr /usr/lib64/libvulkan* /usr/lib
git clone https://github.com/tx00100xt/SeriousSamClassic-VK.git seriossam
mkdir /seriossam/build
mkdir /seriossam/build-xplus
cd /seriossam/build
cmake ..
make -j8
make install
cd /seriossam/build-xplus
cmake -DXPLUS=TRUE ..
make -j8
make install
exit
EOF
- name: Get current date
id: date
uses: Kaven-Universe/github-action-current-date-time@v1
with:
format: "YYYYMMDD"

- name: Show current date
run: |
echo "${{ steps.date.outputs.time }}"
- name: Create Archive
run: |
cd ${{github.workspace}}
mkdir {loongarch64,loongarch64/SamTFE,loongarch64/SamTFE/Mods,loongarch64/SamTFE/Mods/XPLUS,loongarch64/SamTSE,loongarch64/SamTSE/Mods,loongarch64/SamTSE/Mods/XPLUS,}
sudo mv -f ${{github.workspace}}/alt-loongarch64/seriossam/SamTFE/Bin ${{github.workspace}}/loongarch64/SamTFE
sudo mv -f ${{github.workspace}}/alt-loongarch64/seriossam/SamTSE/Bin ${{github.workspace}}/loongarch64/SamTSE
sudo mv -f ${{github.workspace}}/alt-loongarch64/seriossam/SamTFE/Mods/XPLUS/Bin ${{github.workspace}}/loongarch64/SamTFE/Mods/XPLUS
sudo mv -f ${{github.workspace}}/alt-loongarch64/seriossam/SamTSE/Mods/XPLUS/Bin ${{github.workspace}}/loongarch64/SamTSE/Mods/XPLUS
sudo chown -R $USER:$USER loongarch64
echo "*** Create archive ***"
cd ${{github.workspace}}
cp -fr {SamTFE/SE1_10b.gro,SamTFE/ModEXT.txt} loongarch64/SamTFE
cp -fr {SamTSE/SE1_10b.gro,SamTSE/ModEXT.txt} loongarch64/SamTSE
tar -cJpvf SeriousSamClassicVk-${{ steps.date.outputs.time }}-lnx-loongarch64-bin.tar.xz loongarch64
- name: Free up resources
run: |
echo "*** Umount ***"
sudo umount ${{github.workspace}}/alt-loongarch64/proc/cpuinfo
sudo umount ${{github.workspace}}/alt-loongarch64/proc
sudo umount ${{github.workspace}}/alt-loongarch64/dev/pts
sudo umount ${{github.workspace}}/alt-loongarch64/dev
sudo umount ${{github.workspace}}/alt-loongarch64/sys
echo "*** Remove mopsel image ***"
sudo rm -fr ${{github.workspace}}/alt-loongarch64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: SeriousSamClassicVk-${{ steps.date.outputs.time }}-lnx-loongarch64-bin.tar.xz
path: SeriousSamClassicVk-${{ steps.date.outputs.time }}-lnx-loongarch64-bin.tar.xz
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ Supported OS
### Build status
|CI|Platform|Compiler|Configurations|Platforms|Status|
|---|---|---|---|---|---|
|GitHub Actions|Windows, Ubuntu, FreeBSD, Alpine, Raspberry PI OS Lite, macOS|MSVC, GCC, Clang|Release|x86, x64, armv7l, aarch64, riscv64, ppc64le, s390x|![GitHub Actions Build Status](https://github.com/tx00100xt/SeriousSamClassic-VK/actions/workflows/cibuild.yml/badge.svg)
|GitHub Actions|Windows, Ubuntu, FreeBSD, Alpine, Raspberry PI OS Lite, macOS|MSVC, GCC, Clang|Release|x86, x64, armv7l, aarch64, riscv64, ppc64le, s390x, mipsel, loongarch64|![GitHub Actions Build Status](https://github.com/tx00100xt/SeriousSamClassic-VK/actions/workflows/cibuild.yml/badge.svg)

You can download a the automatically build based on the latest commit.
To do this, go to the [Actions tab], select the top workflows, and then Artifacts.
Expand Down

0 comments on commit cffa283

Please sign in to comment.