Test DKMS in chroot #67
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
name: Build Image | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
disable_dkms: | |
description: 'Disable DKMS support' | |
default: false | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
SCRIPT_PATH: 'https://raw.githubusercontent.com/awawa-dev/P010_for_V4L2/refs/heads/dkms' | |
OS_IMAGE: 'https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2024-10-28/2024-10-22-raspios-bookworm-arm64-lite.img.xz' | |
DISABLE_DKMS: '${{ github.event.inputs.disable_dkms || false }}' | |
steps: | |
- name: Install Dependencies | |
run: | | |
sudo apt update | |
sudo apt install coreutils p7zip-full qemu-user-static python3-git | |
- name: Checkout CustomPiOS | |
uses: actions/[email protected] | |
with: | |
repository: 'guysoft/CustomPiOS' | |
path: CustomPiOS | |
ref: c5b7ab895dde5b0fe43c1c8e55c8b86a3d5ced92 | |
- name: Prepare HyperHDR module | |
run: | | |
cd CustomPiOS | |
sudo bash -x src/make_custom_pi_os HyperHDR | |
sudo chown -R runner HyperHDR | |
- name: Download Raspbian Image (64-bits) | |
run: | | |
mkdir -p CustomPiOS/HyperHDR/src/image-raspios_lite_arm64 | |
cd CustomPiOS/HyperHDR/src/image-raspios_lite_arm64 | |
wget -q -c --trust-server-names '${{env.OS_IMAGE}}' | |
echo "workspace_dir=CustomPiOS/HyperHDR/src/workspace-raspios_lite_arm64" >> $GITHUB_ENV | |
echo "workspace_variant=raspios_lite_arm64" >> $GITHUB_ENV | |
- name: Apply P010 patch | |
run: | | |
cd CustomPiOS/HyperHDR/src | |
echo 'export DIST_NAME=HyperHDR' > config | |
echo 'export DIST_VERSION=${{ github.event.inputs.tags }}' >> config | |
echo 'export MODULES="base(network,hyperhdr)"' >> config | |
echo 'export RPI_IMAGER_NAME="${DIST_NAME} version ${DIST_VERSION}"' >> config | |
echo 'export RPI_IMAGER_DESCRIPTION="Raspberry Pi OS with P010 patched kernel"' >> config | |
echo 'export RPI_IMAGER_ICON="https://github.com/awawa-dev/HyperHDR/blob/master/resources/icons/hyperhdr-icon-32px.png"' >> config | |
echo 'export BASE_IMAGE_ENLARGEROOT=2000' >> config | |
echo 'export BASE_IMAGE_RESIZEROOT=200' >> config | |
cd modules/hyperhdr | |
echo '#!/usr/bin/env bash' > start_chroot_script | |
echo 'set -x' >> start_chroot_script | |
echo 'set -e' >> start_chroot_script | |
echo 'source /common.sh' >> start_chroot_script | |
echo 'type -p curl >/dev/null || apt install curl -y' >> start_chroot_script | |
echo 'curl -fsSL https://awawa-dev.github.io/hyperhdr.public.apt.gpg.key | dd of=/usr/share/keyrings/hyperhdr.public.apt.gpg.key \' >> start_chroot_script | |
echo '&& chmod go+r /usr/share/keyrings/hyperhdr.public.apt.gpg.key \' >> start_chroot_script | |
echo '&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hyperhdr.public.apt.gpg.key] https://awawa-dev.github.io $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hyperhdr.list > /dev/null \' >> start_chroot_script | |
echo '&& sudo apt update \' >> start_chroot_script | |
echo '&& sudo apt install hyperhdr -y' >> start_chroot_script | |
echo 'sudo apt install -y dkms git bc bison flex libssl-dev bc make' >> start_chroot_script | |
echo 'sudo mkdir -p /usr/src/v4l2_p010-1.0' >> start_chroot_script | |
echo 'sudo wget ${{env.SCRIPT_PATH}}/dkms/p10_dkms.patch -O /usr/src/v4l2_p010-1.0/p10_dkms.patch' >> start_chroot_script | |
echo 'sudo wget ${{env.SCRIPT_PATH}}/dkms/dkms.conf -O /usr/src/v4l2_p010-1.0/dkms.conf' >> start_chroot_script | |
echo 'sudo wget ${{env.SCRIPT_PATH}}/dkms/dkms-patchmodule.sh -O /usr/src/v4l2_p010-1.0/dkms-patchmodule.sh && sudo chmod +x /usr/src/v4l2_p010-1.0/dkms-patchmodule.sh' >> start_chroot_script | |
echo 'sudo dkms add -m v4l2_p010 -v 1.0' >> start_chroot_script | |
echo 'sudo dkms build -m v4l2_p010 -v 1.0' >> start_chroot_script | |
echo 'sudo dkms install -m v4l2_p010 -v 1.0' >> start_chroot_script | |
echo 'sudo apt clean -y' >> start_chroot_script | |
echo 'touch /boot/ssh' >> start_chroot_script | |
echo "echo -n 'pi:' > /boot/userconf" >> start_chroot_script | |
echo "echo 'raspberry' | openssl passwd -6 -stdin >> /boot/userconf" >> start_chroot_script | |
echo 'echo "HyperHDR" > /etc/hostname' >> start_chroot_script | |
echo 'sed -i "s/raspberrypi/HyperHDR/" /etc/hosts' >> start_chroot_script | |
echo "systemctl -q enable [email protected]" >> start_chroot_script | |
echo 'sed -i "s/^#dtparam=spi=on.*/dtparam=spi=on/" /boot/config.txt' >> start_chroot_script | |
echo 'sed -i "s/^#dtparam=spi=on.*/dtparam=spi=on/" /boot/firmware/config.txt' >> start_chroot_script | |
echo 'sed -i "s/^#hdmi_force_hotplug=1.*/hdmi_force_hotplug=1/" /boot/config.txt' >> start_chroot_script | |
chmod +x start_chroot_script | |
- name: Build P010 patched Raspberry Pi Image | |
run: | | |
sudo modprobe loop | |
cd CustomPiOS/HyperHDR | |
sudo bash -x src/build_dist ${{ env.workspace_variant }} | |
- name: Copy output | |
id: copy | |
run: | | |
IMAGE=RaspberryPiOS-P010-hdr-os-image-bookworm-aarch64 | |
cp ${{ env.workspace_dir }}/*.img $IMAGE.img | |
xz -v9 $IMAGE.img | |
echo "image=$IMAGE" >> $GITHUB_OUTPUT | |
- name: Upload image | |
uses: actions/[email protected] | |
if: (startsWith(github.event.ref, 'refs/tags') != true) | |
with: | |
name: ${{ steps.copy.outputs.image }} | |
path: ${{ steps.copy.outputs.image }}.img.xz | |
- name: Create draft release | |
uses: softprops/[email protected] | |
if: startsWith(github.event.ref, 'refs/tags') | |
with: | |
name: Raspberry PI OS aarch (P010 patched) ${{ env.VERSION }} | |
tag_name: ${{ env.TAG }} | |
files: ${{ steps.copy.outputs.image }}.img.xz | |
draft: true |