forked from othermod/PSPi-Version-6
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from CoryManson/main
Refactor image builds
- Loading branch information
Showing
66 changed files
with
1,717 additions
and
1,250 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
name: Build Buildroot Image | ||
description: 'Build PSPi image' | ||
inputs: | ||
os: | ||
description: 'Operating system to build' | ||
required: true | ||
download_url: | ||
description: 'Download URL for image' | ||
required: true | ||
compressed_image_name: | ||
description: 'Name of downloaded compressed image file' | ||
required: true | ||
image_name: | ||
description: 'Name of uncompressed image file' | ||
required: true | ||
pspi_image_name: | ||
description: 'Name of the pspi artifact image' | ||
required: true | ||
version: | ||
description: 'gitversion version output' | ||
required: true | ||
createRelease: | ||
description: 'Create a release' | ||
default: 'false' | ||
checksum_type: | ||
description: 'Checksum type' | ||
required: true | ||
AZCOPY_TENANT_ID: | ||
description: 'Azure Tenant ID' | ||
required: true | ||
AZCOPY_SPA_CLIENT_SECRET: | ||
description: 'Azure Service Principal Client Secret' | ||
required: true | ||
AZCOPY_SPA_APPLICATION_ID: | ||
description: 'Azure Service Principal Application ID' | ||
required: true | ||
AZCOPY_STORAGE_ACCOUNT_NAME: | ||
description: 'Azure Storage Account Name' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Download driver artifacts | ||
- name: Download Drivers | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: rpi/drivers/bin | ||
merge-multiple: true | ||
|
||
# Install dependencies | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install squashfs-tools -y | ||
shell: bash | ||
|
||
# Download image | ||
- name: Download image file | ||
run: | | ||
mkdir -p downloads | ||
mkdir -p images | ||
cd downloads | ||
wget -nv -O ${{ inputs.compressed_image_name }} ${{ inputs.download_url }} | ||
# Check file extension of downloaded checksum | ||
if [[ ${{ inputs.checksum_type }} == sha256 ]]; then | ||
sha256sum -c $GITHUB_ACTION_PATH/checksums.sha256 --ignore-missing | ||
elif [[ ${{ inputs.checksum_type }} == sha1 ]]; then | ||
sha1sum -c $GITHUB_ACTION_PATH/checksums.sha1 --ignore-missing | ||
elif [[ ${{ inputs.checksum_type }} == md5 ]]; then | ||
md5sum -c $GITHUB_ACTION_PATH/checksums.md5 --ignore-missing | ||
else | ||
echo "Unknown checksum file extension" | ||
exit 1 | ||
fi | ||
if [[ ${{ inputs.compressed_image_name }} == *.gz ]]; then | ||
gunzip ${{ inputs.compressed_image_name }} | ||
elif [[ ${{ inputs.compressed_image_name }} == *.xz ]]; then | ||
unxz ${{ inputs.compressed_image_name }} | ||
else | ||
echo "Unknown image type" | ||
exit 1 | ||
fi | ||
mv *.img ../images/ | ||
working-directory: ${{ runner.temp }} | ||
shell: bash | ||
|
||
- name: Build Image | ||
shell: bash | ||
run: $GITHUB_ACTION_PATH/build-${{ inputs.os }}.sh | ||
working-directory: ${{ runner.temp }} | ||
env: | ||
GITHUB_WORKSPACE: ${{ github.workspace }} | ||
IMAGE_NAME: ${{ inputs.image_name }} | ||
PSPI_IMAGE_NAME: ${{ inputs.pspi_image_name }} | ||
|
||
# Generate sha256 filehash of image files | ||
- name: Generate sha256 filehash | ||
run: | | ||
for i in $(ls *.img.gz) | ||
do | ||
sha256sum "$i" | awk '{print $1}' > "$i.sha256" | ||
done | ||
working-directory: ${{ runner.temp }}/completed_images | ||
shell: bash | ||
|
||
# Update github release | ||
- name: Update Release | ||
if: github.ref == 'refs/heads/main' || inputs.createRelease == 'true' | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: v${{ inputs.version }} | ||
name: v${{ inputs.version }} | ||
body_path: .github/workflows/RELEASE_FORMAT.txt | ||
draft: true | ||
fail_on_unmatched_files: true | ||
files: | | ||
${{ runner.temp }}/completed_images/*.img.gz | ||
${{ runner.temp }}/completed_images/*.img.gz.sha256 | ||
# Upload artifacts | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.pspi_image_name }} | ||
retention-days: 7 | ||
path: | | ||
${{ runner.temp }}/completed_images/*.img.gz | ||
${{ runner.temp }}/completed_images/*.img.gz.sha256 |
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,82 @@ | ||
#!/bin/bash | ||
set +x | ||
|
||
# "Permission denied" in the github workflow means that your script file does not have the "execute" permission set. | ||
# git update-index --chmod=+x .\.github\actions\build-buildroot-image\build-batocera.sh | ||
|
||
mkdir -p completed_images | ||
cd images | ||
|
||
# Create mount directory and mount image file | ||
echo "Make mount directory and mount image" | ||
sudo mkdir -p /mnt/image /tmp/squashfs /tmp/upper /tmp/work /tmp/target | ||
sudo mount -o loop,offset=$((512*2048)) $IMAGE_NAME /mnt/image | ||
|
||
# Add files to /boot | ||
echo "Add files to /boot" | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/batocera/config.txt /mnt/image/config.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/cm4.txt /mnt/image/cm4.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/pi0.txt /mnt/image/pi0.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/pspi.conf /mnt/image/pspi.conf | ||
sudo cp $GITHUB_WORKSPACE/rpi/overlays/* /mnt/image/overlays/ | ||
sudo mkdir -p /mnt/image/drivers | ||
sudo cp $GITHUB_WORKSPACE/rpi/drivers/bin/* /mnt/image/drivers/ | ||
|
||
# Mount squashfs | ||
echo "Mount squashfs" | ||
sudo mount --type="squashfs" --options="loop" --source="/mnt/image/boot/batocera" --target="/tmp/squashfs" | ||
# Mount overlay | ||
echo "Mount overlay" | ||
sudo mount --type="overlay" --options="lowerdir=/tmp/squashfs,upperdir=/tmp/upper,workdir=/tmp/work" --source="overlay" --target="/tmp/target" | ||
|
||
# Add custom.sh | ||
echo "Add custom.sh" | ||
sudo cp $GITHUB_WORKSPACE/rpi/scripts/batocera/custom.sh /tmp/target/usr/share/batocera/datainit/system/custom.sh | ||
sudo chmod +x /tmp/target/usr/share/batocera/datainit/system/custom.sh | ||
|
||
# Update S12populateshare to copy custom.sh into system at boot | ||
echo "Update S12populateshare to copy custom.sh into system at boot" | ||
sudo sed -i '/bios\/ps2/i\ system\/custom.sh \\' /tmp/target/etc/init.d/S12populateshare | ||
|
||
# Add driver libraries | ||
echo "Add driver libraries" | ||
sudo cp $GITHUB_WORKSPACE/rpi/libraries/batocera/* /tmp/target/usr/lib/ | ||
|
||
# Add Multimedia keys for volume control | ||
echo "Add Multimedia keys for volume control" | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/batocera/multimedia_keys.conf /tmp/target/usr/share/batocera/datainit/system/configs/multimedia_keys.conf | ||
|
||
# update S12populateshare to copy multimedia_keys.conf into system at boot | ||
echo "Update S12populateshare to copy multimedia_keys.conf into system at boot" | ||
sudo sed -i '/bios\/ps2/i\ system\/configs\/multimedia_keys.conf \\' /tmp/target/etc/init.d/S12populateshare | ||
|
||
# repack squashfs | ||
echo "Repack squashfs" | ||
sudo mksquashfs /tmp/target ./filesystem.squashfs -noappend -comp zstd | ||
|
||
# Unmount | ||
echo "Unmount overlay" | ||
sudo umount --type="overlay" /tmp/target | ||
echo "Unmount squashfs" | ||
sudo umount --type="squashfs" /tmp/squashfs | ||
|
||
# zero out all space in the original image file | ||
echo "zero out all space in the original image file. an error from dd (no space left on device) is expected here" | ||
sudo dd if=/dev/zero of=/mnt/image/boot/batocera bs=1M status=progress | ||
sleep 5 | ||
sudo rm /mnt/image/boot/batocera | ||
df -h /mnt/image | ||
|
||
# Copy squashfs back to image | ||
echo "Copy squashfs back to image" | ||
sudo cp filesystem.squashfs /mnt/image/boot/batocera | ||
|
||
# unmount | ||
echo "Unmount image" | ||
sudo umount /mnt/image | ||
|
||
# Compress image | ||
echo "Compress image" | ||
gzip -9 $IMAGE_NAME | ||
echo "Move image to completed_images & rename" | ||
mv $IMAGE_NAME.gz ../completed_images/$PSPI_IMAGE_NAME |
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,80 @@ | ||
#!/bin/bash | ||
set +x | ||
|
||
# "Permission denied" in the github workflow means that your script file does not have the "execute" permission set. | ||
# git update-index --chmod=+x .\.github\actions\build-buildroot-image\build-lakka.sh | ||
|
||
mkdir -p completed_images | ||
cd images | ||
|
||
# Create mount directory and mount image file | ||
echo "Make mount directory and mount image" | ||
devicePath=$(sudo losetup -f) | ||
sudo losetup -Pf $IMAGE_NAME | ||
sudo losetup -l | ||
sudo mkdir -p /mnt/image /mnt/squashfs /tmp/upper /tmp/work /tmp/target | ||
sudo mount -o loop,offset=$((512*8192)) $devicePath /mnt/image | ||
|
||
# Add files to /boot | ||
echo "Add files to /boot" | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/lakka/config.txt /mnt/image/config.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/cm4.txt /mnt/image/cm4.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/pi0.txt /mnt/image/pi0.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/pspi.conf /mnt/image/pspi.conf | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/lakka/distroconfig.txt /mnt/image/distroconfig.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/overlays/* /mnt/image/overlays/ | ||
sudo mkdir -p /mnt/image/drivers | ||
sudo cp $GITHUB_WORKSPACE/rpi/drivers/bin/* /mnt/image/drivers/ | ||
|
||
# Mount squashfs | ||
echo "Mount squashfs" | ||
sudo mount --type="squashfs" --options="loop" --source="/mnt/image/SYSTEM" --target="/mnt/squashfs" | ||
# Mount overlay | ||
echo "Mount overlay" | ||
sudo mount --type="overlay" --options="lowerdir=/mnt/squashfs,upperdir=/tmp/upper,workdir=/tmp/work" --source="overlay" --target="/tmp/target" | ||
|
||
# Add autostart.sh | ||
echo "Add autostart.sh" | ||
sudo cp $GITHUB_WORKSPACE/rpi/scripts/lakka/autostart.sh /tmp/target/usr/config/autostart.sh | ||
sudo chmod +x /tmp/target/usr/config/autostart.sh | ||
|
||
# Add joypad autoconfig | ||
echo "Add joypad autoconfig" | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/lakka/PSPi-Controller.cfg /tmp/target/etc/retroarch-joypad-autoconfig/udev/PSPi-Controller.cfg | ||
|
||
# Repack squashfs | ||
echo "Repack squashfs" | ||
sudo mksquashfs /tmp/target ./filesystem.squashfs -noappend | ||
|
||
# Unmount | ||
echo "Unmount overlay" | ||
sudo umount --type="overlay" /tmp/target | ||
echo "Unmount squashfs" | ||
sudo umount --type="squashfs" /mnt/squashfs | ||
|
||
# zero out all space in the original image file | ||
echo "zero out all space in the original image file. an error from dd (no space left on device) is expected here" | ||
sudo dd if=/dev/zero of=/mnt/image/SYSTEM bs=1M status=progress | ||
sleep 5 | ||
sudo rm /mnt/image/SYSTEM | ||
df -h /mnt/image | ||
|
||
# Copy squashfs back to image | ||
echo "Copy squashfs back to image" | ||
sudo cp filesystem.squashfs /mnt/image/SYSTEM | ||
|
||
# Update md5sum file | ||
sudo md5sum /mnt/image/SYSTEM > /mnt/image/SYSTEM.md5 | ||
|
||
# unmount | ||
echo "Unmount image" | ||
sudo umount /mnt/image | ||
sudo losetup -d $devicePath | ||
|
||
# Recompress image | ||
echo "Recompress image" | ||
gzip -9 $IMAGE_NAME | ||
|
||
# Move image to completed_images and rename | ||
echo "Move image to completed_images and rename" | ||
mv $IMAGE_NAME.gz ../completed_images/$PSPI_IMAGE_NAME |
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,76 @@ | ||
#!/bin/bash | ||
set +x | ||
|
||
# "Permission denied" in the github workflow means that your script file does not have the "execute" permission set. | ||
# git update-index --chmod=+x .\.github\actions\build-buildroot-image\build-recalbox.sh | ||
|
||
mkdir -p completed_images | ||
cd images | ||
|
||
# Create mount directory and mount image file | ||
echo "Make mount directory and mount image" | ||
sudo mkdir -p /mnt/image /mnt/squashfs /tmp/upper /tmp/work /tmp/target | ||
sudo mount -o loop,offset=$((512*2048)) $IMAGE_NAME /mnt/image | ||
|
||
# Add files to /boot | ||
echo "Add files to /boot" | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/recalbox/config.txt /mnt/image/config.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/cm4.txt /mnt/image/cm4.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/pi0.txt /mnt/image/pi0.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/pspi.conf /mnt/image/pspi.conf | ||
sudo cp $GITHUB_WORKSPACE/rpi/configs/recalbox/recalbox-user-config.txt /mnt/image/recalbox-user-config.txt | ||
sudo cp $GITHUB_WORKSPACE/rpi/overlays/* /mnt/image/overlays/ | ||
sudo mkdir -p /mnt/image/drivers | ||
sudo cp $GITHUB_WORKSPACE/rpi/drivers/bin/* /mnt/image/drivers/ | ||
|
||
# Mount squashfs | ||
echo "Mount squashfs" | ||
sudo mount --type="squashfs" --options="loop" --source="/mnt/image/boot/recalbox" --target="/mnt/squashfs" | ||
# Mount overlay | ||
echo "Mount overlay" | ||
sudo mount --type="overlay" --options="lowerdir=/mnt/squashfs,upperdir=/tmp/upper,workdir=/tmp/work" --source="overlay" --target="/tmp/target" | ||
|
||
# Add custom.sh to recalbox | ||
echo "Add custom.sh to recalbox" | ||
sudo cp $GITHUB_WORKSPACE/rpi/scripts/recalbox/custom.sh /tmp/target/recalbox/share_init/system/custom.sh | ||
sudo chmod +x /tmp/target/recalbox/share_init/system/custom.sh | ||
|
||
# Update S12populateshare to copy custom.sh into system at boot | ||
echo "Update S12populateshare to copy custom.sh into system at boot" | ||
sudo sed -i "`wc -l < /tmp/target/etc/init.d/S12populateshare`i\\# copy pspi custom.sh\\" /tmp/target/etc/init.d/S12populateshare | ||
sudo sed -i "`wc -l < /tmp/target/etc/init.d/S12populateshare`i\\cp "/recalbox/share_init/system/custom.sh" "/recalbox/share/system/custom.sh"\\" /tmp/target/etc/init.d/S12populateshare | ||
|
||
# Add driver libraries | ||
echo "Add driver libraries" | ||
sudo cp $GITHUB_WORKSPACE/rpi/libraries/recalbox/* /tmp/target/usr/lib/ | ||
|
||
# repack squashfs | ||
echo "Repack squashfs" | ||
sudo mksquashfs /tmp/target ./filesystem.squashfs -noappend | ||
|
||
# Unmount | ||
echo "Unmount overlay" | ||
sudo umount --type="overlay" /tmp/target | ||
echo "Unmount squashfs" | ||
sudo umount --type="squashfs" /mnt/squashfs | ||
|
||
# zero out all space in the original image file | ||
echo "zero out all space in the original image file. an error from dd (no space left on device) is expected here" | ||
sudo dd if=/dev/zero of=/mnt/image/boot/recalbox bs=1M status=progress | ||
sleep 5 | ||
sudo rm /mnt/image/boot/recalbox | ||
df -h /mnt/image | ||
|
||
# Copy squashfs back to image | ||
echo "Copy squashfs back to image" | ||
sudo cp filesystem.squashfs /mnt/image/boot/recalbox | ||
|
||
# Unmount | ||
echo "Unmount image" | ||
sudo umount /mnt/image | ||
|
||
# Recompress image | ||
echo "Recompress image" | ||
gzip -9 $IMAGE_NAME | ||
echo "Move image to completed_images & rename" | ||
mv $IMAGE_NAME.gz ../completed_images/$PSPI_IMAGE_NAME |
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,2 @@ | ||
deb540cd1f450c52c8b6b6a4420ef1e481041bad recalbox-rpizero2.img.xz | ||
bb8e6e862cedc4b6b1c77bab3540c358dbf11e25 recalbox-rpi4_64.img.xz |
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,4 @@ | ||
bc77d61f458dac83d8015692f2f483e18cde18140011fad9b19f9fa723b87194 batocera-bcm2837-bcm2837-39-20240301.img.gz | ||
7bcc3ac2b2cbeb502c2946931551ce4d74c68ba54d7d07bc01a3ffad1a90edba batocera-bcm2711-bcm2711-39-20240228.img.gz | ||
b1d3bc4bbf7d5ce80383f3cc7f42367bb5f001f7c84a046e27e93f831e57dccb Lakka-RPi3.aarch64-5.x-20240502-2f60c70.img.gz | ||
dfc047bf30e72350f65d23415525ad1e608e52ce5b89e193c4c154d5dba89b26 Lakka-RPi4.aarch64-5.x-20240502-2f60c70.img.gz |
Oops, something went wrong.