quartz64 #126
Workflow file for this run
This file contains hidden or 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
| name: quartz64 | |
| on: workflow_dispatch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| check-latest: true | |
| - name: Build init | |
| run: | | |
| # Workaround for runner provider restart: https://github.com/actions/runner-images/pull/9956 | |
| sudo apt-get -qq autopurge needrestart | |
| { python3 -m pip install --no-cache-dir -U pip setuptools wheel; python3 -m pip install --no-cache-dir -U pyelftools; } & | |
| { sudo apt-get -q update; sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -qq install make gcc libc6-dev flex bison bc libssl-dev swig libgnutls28-dev; } & | |
| { curl -fO 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/snapshot/linux-rolling-stable.tar.gz'; tar xf linux-rolling-stable.tar.gz; rm linux-rolling-stable.tar.gz; } & | |
| uboot_version=$(curl -sSf 'https://api.github.com/repos/u-boot/u-boot/tags' | mawk -F\" '/^ *"name": "v[0-9.]*",$/{print $4;exit}') | |
| [ "$uboot_version" ] || { echo 'ERROR: Failed to obtain latest U-Boot version'; exit 1; } | |
| { curl -fLO "https://github.com/u-boot/u-boot/archive/$uboot_version.tar.gz"; tar xf "$uboot_version.tar.gz"; rm "$uboot_version.tar.gz"; } & | |
| uboot_version=${uboot_version#v} | |
| echo "uboot_version=$uboot_version" >> "$GITHUB_ENV" | |
| wait | |
| curl -sSfo "u-boot-$uboot_version/ddr.bin" 'https://raw.githubusercontent.com/armbian/rkbin/master/rk35/rk3566_ddr_1056MHz_v1.21.bin' & | |
| curl -sSfo "u-boot-$uboot_version/bl31.elf" 'https://raw.githubusercontent.com/armbian/rkbin/master/rk35/rk3568_bl31_v1.44.elf' & | |
| curl -sSfo linux-rolling-stable/arch/arm64/configs/quartz64_defconfig "https://raw.githubusercontent.com/$GITHUB_REPOSITORY_OWNER/DietPi/$GITHUB_REF_NAME/.build/images/Quartz64/quartz64_defconfig" & | |
| rm -Rf firmware-quartz64a | |
| mkdir -p firmware-quartz64a/DEBIAN firmware-quartz64a/boot/extlinux firmware-quartz64a/lib/firmware/brcm | |
| rm -Rf firmware-quartz64b | |
| mkdir -p firmware-quartz64b/DEBIAN firmware-quartz64b/boot/extlinux firmware-quartz64b/lib/firmware/brcm | |
| rm -Rf firmware-soquartz | |
| mkdir -p firmware-soquartz/DEBIAN firmware-soquartz/boot/extlinux firmware-soquartz/lib/firmware/brcm | |
| wait | |
| - name: Build U-Boot | |
| run: | | |
| export ROCKCHIP_TPL='ddr.bin' | |
| export BL31='bl31.elf' | |
| cd "u-boot-$uboot_version" | |
| # Disable UEFI boot manager, which causes issues in some circumstances: https://github.com/MichaIng/DietPi/issues/7709 | |
| echo 'CONFIG_BOOTMETH_EFI_BOOTMGR=n' >> configs/quartz64-a-rk3566_defconfig | |
| # Add Btrfs support to U-Boot incl. btrsubvol command | |
| echo 'CONFIG_CMD_BTRFS=y' >> configs/quartz64-a-rk3566_defconfig | |
| make quartz64-a-rk3566_defconfig | |
| make -j$(nproc) | |
| mv u-boot-rockchip.bin ../firmware-quartz64a/boot/u-boot.bin | |
| echo 'CONFIG_BOOTMETH_EFI_BOOTMGR=n' >> configs/quartz64-b-rk3566_defconfig | |
| echo 'CONFIG_CMD_BTRFS=y' >> configs/quartz64-b-rk3566_defconfig | |
| make quartz64-b-rk3566_defconfig | |
| make -j$(nproc) | |
| mv u-boot-rockchip.bin ../firmware-quartz64b/boot/u-boot.bin | |
| # Use CM4 config but add poweroff command. Currently, the 3 available (base board) configs differ in default (kernel) device tree only, and the model A base board config additionally has CONFIG_CMD_POWEROFF=y, since it has a power button, so poweroff can be used without the need for a power cycle. | |
| echo 'CONFIG_CMD_POWEROFF=y' >> configs/soquartz-cm4-rk3566_defconfig | |
| echo 'CONFIG_BOOTMETH_EFI_BOOTMGR=n' >> configs/soquartz-cm4-rk3566_defconfig | |
| echo 'CONFIG_CMD_BTRFS=y' >> configs/soquartz-cm4-rk3566_defconfig | |
| make soquartz-cm4-rk3566_defconfig | |
| make -j$(nproc) | |
| mv u-boot-rockchip.bin ../firmware-soquartz/boot/u-boot.bin | |
| cd .. | |
| rm -R "u-boot-$uboot_version" | |
| - name: Build Linux | |
| run: | | |
| cd linux-rolling-stable | |
| make quartz64_defconfig | |
| make -j$(nproc) | |
| cp arch/arm64/boot/Image.gz ../firmware-quartz64a/boot/vmlinuz | |
| cp arch/arm64/boot/Image.gz ../firmware-quartz64b/boot/vmlinuz | |
| mv arch/arm64/boot/Image.gz ../firmware-soquartz/boot/vmlinuz | |
| mv arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dtb ../firmware-quartz64a/boot/ | |
| mv arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dtb ../firmware-quartz64b/boot/ | |
| mv -v arch/arm64/boot/dts/rockchip/rk3566-soquartz*.dtb ../firmware-soquartz/boot/ | |
| make modules_install INSTALL_MOD_PATH='../firmware-quartz64a' | |
| cd .. | |
| rm firmware-quartz64a/lib/modules/*/build | |
| cp -R firmware-quartz64a/lib/modules firmware-quartz64b/lib/ | |
| cp -R firmware-quartz64a/lib/modules firmware-soquartz/lib/ | |
| - name: Build package | |
| run: | | |
| version=$(mawk '/^VERSION =/{a=$3};/^PATCHLEVEL =/{b=$3};/^SUBLEVEL/{c=$3};END{print a"."b"."c}' linux-rolling-stable/Makefile) | |
| rm -R linux-rolling-stable | |
| curl -sSfO 'https://dietpi.com/downloads/binaries/firmware-quartz64a.deb' & | |
| curl -sSfo firmware-quartz64b/lib/firmware/brcm/brcmfmac43456-sdio.bin 'https://raw.githubusercontent.com/armbian/firmware/master/brcm/brcmfmac43456-sdio.bin' & | |
| curl -sSfo firmware-quartz64b/lib/firmware/brcm/brcmfmac43456-sdio.clm_blob 'https://raw.githubusercontent.com/armbian/firmware/master/brcm/brcmfmac43456-sdio.clm_blob' & | |
| curl -sSfo firmware-quartz64b/lib/firmware/brcm/brcmfmac43456-sdio.clm_blob 'https://raw.githubusercontent.com/armbian/firmware/master/brcm/brcmfmac43456-sdio.txt' & | |
| curl -sSfo firmware-quartz64a/lib/firmware/brcm/brcmfmac43455-sdio.txt 'https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/brcm/brcmfmac43455-sdio.AW-CM256SM.txt' & | |
| wait | |
| cur_version=$(dpkg-deb -f firmware-quartz64a.deb Version) | |
| rm firmware-quartz64a.deb | |
| cur_suffix=${cur_version#*-dietpi} | |
| echo "Current package version is: $cur_version" | |
| echo "New kernel version is: $version" | |
| [ "$version-dietpi$cur_suffix" = "$cur_version" ] && version="$version-dietpi$((cur_suffix+1))" || version="$version-dietpi1" | |
| echo "New package version will be: $version" | |
| cp firmware-quartz64a/lib/firmware/brcm/brcmfmac43455-sdio.txt firmware-soquartz/lib/firmware/brcm/ | |
| cat << '_EOF_' > firmware-quartz64a/boot/extlinux/extlinux.conf | |
| label DietPi | |
| linux /boot/vmlinuz | |
| fdt /boot/rk3566-quartz64-a.dtb | |
| append root=/dev/mmcblk0p1 rootfstype=ext4 rootwait earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8 console=tty1 consoleblank=0 net.ifnames=0 | |
| _EOF_ | |
| cp firmware-quartz64a/boot/extlinux/extlinux.conf firmware-quartz64b/boot/extlinux/ | |
| sed --follow-symlinks -i 's/quartz64-a.dtb/quartz64-b.dtb/' firmware-quartz64b/boot/extlinux/extlinux.conf | |
| cp firmware-quartz64a/boot/extlinux/extlinux.conf firmware-soquartz/boot/extlinux/ | |
| sed --follow-symlinks -i 's/quartz64-a.dtb/soquartz-cm4.dtb/' firmware-soquartz/boot/extlinux/extlinux.conf | |
| echo '/boot/extlinux/extlinux.conf' > firmware-quartz64a/DEBIAN/conffiles | |
| echo '/boot/extlinux/extlinux.conf' > firmware-quartz64b/DEBIAN/conffiles | |
| echo '/boot/extlinux/extlinux.conf' > firmware-soquartz/DEBIAN/conffiles | |
| cat << '_EOF_' > firmware-quartz64a/DEBIAN/postinst | |
| #!/bin/dash | |
| echo 'Flashing U-Boot' | |
| BOOT_DRIVE=$(lsblk -npo PKNAME "$(findmnt -Ufvnro SOURCE -T /boot)") | |
| if [ $BOOT_DRIVE ] | |
| then | |
| echo "Flashing to detected boot drive: $BOOT_DRIVE" | |
| else | |
| echo 'ERROR: Unable to detect boot drive, aborting U-Boot flashing' | |
| exit 1 | |
| fi | |
| dd 'if=/boot/u-boot.bin' "of=$BOOT_DRIVE" seek=64 conv=fdatasync | |
| if grep -q 'root=/dev/mmcblk0p1' /boot/extlinux/extlinux.conf | |
| then | |
| echo 'Setting root filesystem entries in extlinux.conf' | |
| ROOT_PARTUUID=$(findmnt -Ufnro PARTUUID -M /) | |
| if [ $ROOT_PARTUUID ] | |
| then | |
| echo "Setting root filessystem PARTUUID: $ROOT_PARTUUID" | |
| else | |
| echo 'ERROR: Unable to detect root filessystem PARTUUID, aborting' | |
| exit 1 | |
| fi | |
| sed --follow-symlinks -i "s|root=/dev/mmcblk0p1|root=PARTUUID=$ROOT_PARTUUID|" /boot/extlinux/extlinux.conf | |
| ROOT_FSTYPE=$(findmnt -Ufnro FSTYPE -M /) | |
| if [ $ROOT_FSTYPE ] | |
| then | |
| echo "Setting root filesystem type: $ROOT_FSTYPE" | |
| else | |
| echo 'ERROR: Unable to detect root filesystem type, aborting' | |
| exit 1 | |
| fi | |
| sed --follow-symlinks -i "s|rootfstype=ext4|rootfstype=$ROOT_FSTYPE|" /boot/extlinux/extlinux.conf | |
| fi | |
| exit 0 | |
| _EOF_ | |
| cp firmware-quartz64a/DEBIAN/postinst firmware-quartz64b/DEBIAN/ | |
| cp firmware-quartz64a/DEBIAN/postinst firmware-soquartz/DEBIAN/ | |
| chmod +x firmware-*/DEBIAN/postinst | |
| find firmware-quartz64a ! \( -path firmware-quartz64a/DEBIAN -prune \) -type f -exec md5sum {} + | sed 's|firmware-quartz64a/||' > firmware-quartz64a/DEBIAN/md5sums | |
| find firmware-quartz64b ! \( -path firmware-quartz64b/DEBIAN -prune \) -type f -exec md5sum {} + | sed 's|firmware-quartz64b/||' > firmware-quartz64b/DEBIAN/md5sums | |
| find firmware-soquartz ! \( -path firmware-soquartz/DEBIAN -prune \) -type f -exec md5sum {} + | sed 's|firmware-soquartz/||' > firmware-soquartz/DEBIAN/md5sums | |
| cat << _EOF_ > firmware-quartz64a/DEBIAN/control | |
| Package: firmware-quartz64a | |
| Version: $version | |
| Architecture: arm64 | |
| Maintainer: MichaIng <micha@dietpi.com> | |
| Date: $(date -u '+%a, %d %b %Y %T %z') | |
| Installed-Size: $(du -sk 'firmware-quartz64a' | mawk '{print $1}') | |
| Section: kernel | |
| Priority: optional | |
| Description: Linux kernel and U-Boot bootloader for Quartz64 Model A | |
| _EOF_ | |
| sed --follow-symlinks -i "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-quartz64a' | mawk '{print $1}')" firmware-quartz64a/DEBIAN/control | |
| cp firmware-quartz64a/DEBIAN/control firmware-quartz64b/DEBIAN/ | |
| sed --follow-symlinks -i -e 's/quartz64a/quartz64b/' -e 's/Model A$/Model B/' -e "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-quartz64b' | mawk '{print $1}')" firmware-quartz64b/DEBIAN/control | |
| cp firmware-quartz64a/DEBIAN/control firmware-soquartz/DEBIAN/ | |
| sed --follow-symlinks -i -e 's/quartz64a/soquartz/' -e 's/Quartz64 Model A$/SOQuartz/' -e "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-soquartz' | mawk '{print $1}')" firmware-soquartz/DEBIAN/control | |
| sudo chown -R root:root firmware-quartz64a firmware-quartz64b firmware-soquartz | |
| dpkg-deb -b -Zxz -z9 -Sextreme firmware-quartz64a | |
| dpkg-deb -b -Zxz -z9 -Sextreme firmware-quartz64b | |
| dpkg-deb -b -Zxz -z9 -Sextreme firmware-soquartz | |
| sudo rm -R firmware-quartz64a firmware-quartz64b firmware-soquartz | |
| - name: Upload | |
| run: | | |
| [ -d ~/.ssh ] || mkdir ~/.ssh | |
| umask 377 | |
| echo '${{ secrets.KNOWN_HOSTS }}' > ~/.ssh/known_hosts | |
| echo '${{ secrets.SSH_KEY }}' > ~/.ssh/id_ed25519 | |
| curl -T "firmware-{quartz64a,quartz64b,soquartz}.deb" --key ~/.ssh/id_ed25519 '${{ secrets.UPLOAD_URL }}all/' | |
| curl 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache' -H 'Authorization: Bearer ${{ secrets.CF_TOKEN }}' -H 'Content-Type: application/json' \ | |
| --data '{"files":["https://dietpi.com/downloads/binaries/testing/","https://dietpi.com/downloads/binaries/testing/firmware-quartz64a.deb","https://dietpi.com/downloads/binaries/testing/firmware-quartz64b.deb","https://dietpi.com/downloads/binaries/testing/firmware-soquartz.deb"]}' |