Skip to content

ArkOS Kernel with Logo Generator #2

ArkOS Kernel with Logo Generator

ArkOS Kernel with Logo Generator #2

Workflow file for this run

# This is a workflow that is manually triggered to build an Image with an updated logo for ArkOS on supported RK3566 devices
name: ArkOS Kernel with Logo Generator
on:
workflow_dispatch:
inputs:
device_unit:
type: choice
description: 'Choose your device'
required: true
options:
- RG353
- RG503
- RGB30
- RK2023
picture_link:
description: 'HTML link to your png file'
required: true
update_hdmi:
type: choice
description: 'Would you like to update the hdmi out logo as well?'
required: false
options:
- Nope
- Yep
hdmi_picture_link:
description: 'HTML link to your png file for hdmi out'
required: false
jobs:
# This workflow contains a single job.
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: checkout_repo
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
fetch-depth: 1
- name: checkout kernel repo selected
id: Build_kernel_with_new_logo
shell: bash {0}
run: |
# Verify that html link provided is to a file ending in .png or is from ibb.co
if [[ "${{ github.event.inputs.picture_link }}" != *.png ]] && [[ "${{ github.event.inputs.picture_link }}" != *.PNG ]] && [[ "${{ github.event.inputs.picture_link }}" != *"ibb.co"* ]]; then
echo "::error::Link doesn't seem to contain a .png file"
exit 1
fi
# Install necessary kernel building and logo processing tools
sudo apt -y update
sudo apt -y install build-essential git lzop build-essential gcc bc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g netpbm imgp
# Clone the correct kernel repo for this kernel build
if [[ "${{ github.event.inputs.device_unit }}" == "RG353" ]]; then
whichgit="RG353VKernel"
git clone --depth=1 --recursive https://github.com/christianhaitian/${whichgit}.git
elif [[ "${{ github.event.inputs.device_unit }}" == "RG503" ]]; then
whichgit="rg503Kernel"
git clone --depth=1 --recursive https://github.com/christianhaitian/${whichgit}.git
else
whichgit="RG353VKernel"
git clone --depth=1 --recursive https://github.com/christianhaitian/${whichgit}.git -b rk2023
fi
# Install the necessary toolchain for building the kernel
mkdir -p ./prebuilts/gcc/linux-x86/aarch64/
wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz
tar Jxvf gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz -C ./prebuilts/gcc/linux-x86/aarch64/
cd ${whichgit}
# Check to see if this is a pasteboard.co or ibb.co link
# If it is a pasteboard.co or ibb.co link
# we need to get the real logo link
# and attempt to process it.
if [[ "${{ github.event.inputs.picture_link }}" == *"pasteboard.co"* ]]; then
wget -t 3 -T 60 --no-check-certificate "${{ github.event.inputs.picture_link }}" -O logo.txt
real_logo="$(grep 'img data-src="' logo.txt | cut -d '"' -f 2)"
wget -t 3 -T 60 --no-check-certificate "${real_logo}" -O logo.png
elif [[ "${{ github.event.inputs.picture_link }}" == *"ibb.co"* ]]; then
wget -t 3 -T 60 --no-check-certificate "${{ github.event.inputs.picture_link }}" -O logo.txt
real_logo="$(grep 'og:image" content="' logo.txt | cut -d '"' -f 4)"
wget -t 3 -T 60 --no-check-certificate "${real_logo}" -O logo.png
else
wget -t 3 -T 60 --no-check-certificate "${{ github.event.inputs.picture_link }}" -O logo.png
fi
if [ "$?" != "0" ]; then
echo "::error::Failed to get ${{ github.event.inputs.picture_link }}"
exit 1
fi
if [ ! -z "${{ github.event.inputs.hdmi_picture_link }}" ]; then
if [[ "${{ github.event.inputs.hdmi_picture_link }}" == *"pasteboard.co"* ]]; then
wget -t 3 -T 60 --no-check-certificate "${{ github.event.inputs.hdmi_picture_link }}" -O hdmi_logo.txt
real_logo="$(grep 'img data-src="' hdmi_logo.txt | cut -d '"' -f 2)"
wget -t 3 -T 60 --no-check-certificate "${real_logo}" -O hdmi_logo.png
elif [[ "${{ github.event.inputs.hdmi_picture_link }}" == *"ibb.co"* ]]; then
wget -t 3 -T 60 --no-check-certificate "${{ github.event.inputs.hdmi_picture_link }}" -O hdmi_logo.txt
real_logo="$(grep 'og:image" content="' hdmi_logo.txt | cut -d '"' -f 4)"
wget -t 3 -T 60 --no-check-certificate "${real_logo}" -O hdmi_logo.png
else
wget -t 3 -T 60 --no-check-certificate "${{ github.event.inputs.hdmi_picture_link }}" -O hdmi_logo.png
fi
if [ "$?" != "0" ]; then
echo "::error::Failed to get ${{ github.event.inputs.hdmi_picture_link }}"
exit 1
fi
fi
# Process the downloaded logo into the format necessary for the kernel
pngtopnm logo.png | ppmquant 224 | pnmnoraw > drivers/video/logo/logo_linux_clut224.ppm
if [ "$?" != "0" ]; then
echo "::error::${{ github.event.inputs.picture_link }} is not a compatible png file for the boot logo"
exit 1
fi
if [[ "${{ github.event.inputs.update_hdmi }}" == "Yep" ]]; then
if [ -f "hdmi_logo.png" ]; then
pngtopnm hdmi_logo.png | ppmquant 224 | pnmnoraw > drivers/video/logo/logo_hdmi_clut224.ppm
if [ "$?" != "0" ]; then
echo "::error::${{ github.event.inputs.hdmi_picture_link }} is not a compatible png file for the boot logo"
exit 1
fi
else
imgp -nx 1280x720 logo.png
pngtopnm logo_IMGP.png | ppmquant 224 | pnmnoraw > drivers/video/logo/logo_hdmi_clut224.ppm
if [ "$?" != "0" ]; then
echo "::error::${{ github.event.inputs.picture_link }} is not a compatible png file for the hdmi output logo"
exit 1
fi
fi
fi
# If no errors, let's build the kernel and make it available as an artifact if successful
if [[ "${{ github.event.inputs.device_unit }}" == "RK2023" ]] || [[ "${{ github.event.inputs.device_unit }}" == "RGB30" ]]; then
make ARCH=arm64 rk3566_optimized_with_wifi_linux_defconfig && make ARCH=arm64 KERNEL_DTS=rk3566 KERNEL_CONFIG=rk3566_optimized_with_wifi_linux_defconfig -j2
else
make ARCH=arm64 rk3566_optimized_linux_defconfig && make ARCH=arm64 KERNEL_DTS=rk3566 KERNEL_CONFIG=rk3566_optimized_linux_defconfig -j2
fi
cp arch/arm64/boot/Image ../.
- name: Get kernel artifact
uses: actions/upload-artifact@v3
with:
name: image_${{ github.event.inputs.device_unit }}
path: Image