BUILD-KERNEL #22
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
# This is a basic workflow to help you get started with Actions | |
name: BUILD-KERNEL | |
# Controls when the workflow will run | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "kernel-build" | |
kernel-release: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-24.04 | |
outputs: | |
xarray: ${{ steps.release-array.outputs.array }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Fetch release from kernel.org | |
id: release-array | |
# Select the mainline and stable releases. | |
# Always produce a "6.12.9-1009.9" syntax release string. | |
# Always produce a "kernel-6.12_arm64.cfg" syntax config string. | |
run: | | |
echo array=$( | |
curl -s https://www.kernel.org/releases.json | jq '{ | |
include: [ | |
.releases[] | | |
select((.moniker=="mainline") or (.moniker=="stable")) | |
] | map( | |
.kernelcfg=(.version | sub("(?<x>\\d+\\.\\d+)(.*)"; "kernel-\(.x)_arm64.cfg")) | | |
.release=( | |
if (.version | test("^\\d+\\.\\d+$")) then | |
(.version | sub("(?<x>\\d+\\.\\d+)"; "\(.x).0+nobara-\(1000)")) | |
elif(.version | test("^\\d+\\.\\d+\\.\\d+$")) then | |
(.version | sub("(?<x>\\d+\\.\\d+)\\.(?<y>\\d+)"; "\(.x).\(.y)+nobara-\(.y | tonumber + 1000)")) | |
else | |
(.version | sub("(?<x>\\d+\\.\\d+)-rc(?<y>\\d+)"; "\(.x).0+nobara-\(.y | tonumber + 1000)")) | |
end | |
) | |
) | |
}' --arg yrun $GITHUB_RUN_ATTEMPT | |
) >> $GITHUB_OUTPUT | |
# This workflow contains a single job called "kernel-build" | |
kernel-package: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-24.04 | |
needs: kernel-release | |
name: kernel-${{ matrix.release }} | |
strategy: | |
matrix: ${{ fromJSON(needs.kernel-release.outputs.xarray) }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Install dependencies. | |
run: | | |
sudo apt update | |
sudo apt upgrade -y | |
sudo apt install -y build-essential gcc-aarch64-linux-gnu bison devscripts \ | |
qemu-user-static qemu-system-arm qemu-efi-aarch64 u-boot-tools binfmt-support \ | |
debootstrap flex libssl-dev bc rsync kmod cpio xz-utils fakeroot parted \ | |
udev dosfstools uuid-runtime git-lfs device-tree-compiler python3 dctrl-tools \ | |
python-is-python3 fdisk bc debhelper python3-pyelftools python3-setuptools \ | |
python3-distutils-extra python3-pkg-resources swig libfdt-dev libpython3-dev dctrl-tools | |
- name: Downloading kernel source package. | |
run: wget --quiet ${{ matrix.source }} | |
- name: Extracting kernel source package. | |
run: tar -xf $(basename ${{ matrix.source }}) | |
- name: Patching kernel source package. | |
run: | | |
patch --strip=1 --directory=linux-${KERNEL_VERSION} < patcher/kernel/package.patch # Patches by Joshua | |
patch --strip=1 --directory=linux-${KERNEL_VERSION} < patcher/kernel/overlay.patch # Patch kernel overlay loading | |
cp -f overlay/rk3588.overlay.d/rk3588* linux-${KERNEL_VERSION}/arch/arm64/boot/dts/rockchip # Copy rk3588 dtbs by Joshua | |
cp -f overlay/kernel.cfg.d/${KERNEL_CONFIG} linux-${KERNEL_VERSION}/debian.rockchip/config/config.common.ubuntu # Add basic kernel configs | |
dch \ | |
--create \ | |
--package ${KERNEL_PACKAGE} \ | |
--changelog linux-${KERNEL_VERSION}/debian.rockchip/changelog \ | |
--distribution ${KERNEL_DISTRIBUTION} \ | |
--urgency medium \ | |
-v $KERNEL_RELEASE \ | |
"Linux ${KERNEL_RELEASE} ubuntu-rockchip ${KERNEL_DISTRIBUTION}" # Get dch to create the changelog. | |
shell: bash | |
env: | |
ARCH: arm64 | |
DEBEMAIL: nobara@kurokawa | |
DEBFULLNAME: Kurokawa Nobara | |
DEB_BUILD_OPTIONS: nocheck | |
KERNEL_PACKAGE: linux-rockchip | |
KERNEL_DISTRIBUTION: oracular | |
KERNEL_VERSION: ${{ matrix.version }} | |
KERNEL_RELEASE: ${{ matrix.release }} | |
KERNEL_RELEASE_DATE: ${{ matrix.released.isodate }} | |
KERNEL_CONFIG: ${{ matrix.kernelcfg }} | |
- name: Build kernel package. | |
run: fakeroot debian/rules clean defaultconfigs binary-headers binary-rockchip do_mainline_build=true | |
shell: bash | |
working-directory: linux-${{ matrix.version }} | |
env: | |
ARCH: arm64 | |
CROSS_COMPILE: aarch64-linux-gnu- | |
CC: aarch64-linux-gnu-gcc | |
LANG: C | |
DEB_BUILD_OPTIONS: nocheck | |
- name: Build a dummy meta package. | |
run: | | |
mkdir -p dummy-package/DEBIAN | |
( | |
echo "Package: ${KERNEL_PACKAGE}" | |
echo "Source: ${KERNEL_PACKAGE}" | |
echo "Version: ${KERNEL_RELEASE}" | |
echo "Section: main" | |
echo "Priority: standard" | |
echo "Architecture: ${ARCH}" | |
for PACKAGE in linux-*${KERNEL_RELEASE}*.deb; do | |
DED_ARRAY+="${PACKAGE%%_*}, " | |
done | |
echo "Depends: ${DED_ARRAY%,*}" | |
echo "Rules-Requires-Root: no" | |
echo "Maintainer: ${DEBFULLNAME} <${DEBEMAIL}>" | |
echo "Description: A Meta Package for upstream ${KERNEL_PACKAGE} packages." | |
) > dummy-package/DEBIAN/control | |
dpkg-deb --build dummy-package "${KERNEL_PACKAGE}_${KERNEL_RELEASE}_arm64.deb" | |
shell: bash | |
env: | |
ARCH: arm64 | |
DEBEMAIL: nobara@kurokawa | |
DEBFULLNAME: Kurokawa Nobara | |
DEB_BUILD_OPTIONS: nocheck | |
KERNEL_PACKAGE: linux-rockchip | |
KERNEL_VERSION: ${{ matrix.version }} | |
KERNEL_RELEASE: ${{ matrix.release }} | |
KERNEL_RELEASE_DATE: ${{ matrix.released.isodate }} | |
- name: Upload packages | |
uses: actions/[email protected] | |
with: | |
name: kernel-package-${{ matrix.release }}_arm64 | |
path: linux-*.deb | |
compression-level: 0 | |
if-no-files-found: error |