Skip to content

Build Kernel Rockchip #1

Build Kernel Rockchip

Build Kernel Rockchip #1

name: Build Kernel Rockchip
on:
workflow_dispatch:
inputs:
BOARD:
description: 'Board type'
required: true
default: 'tpm312'
type: choice
options:
- r08
- rock960
- tpm312
- tb-ls3399
- zysj
BRANCH:
description: 'Armbian kernel branch'
default: 'current'
required: false
type: choice
options:
- current
- edge
RELEASE:
description: 'Release name'
default: 'bookworm'
required: true
type: choice
options:
- jammy
- noble
- bullseye
- bookworm
Version:
description: 'Armbian Kernel Version'
default: 'main'
required: false
type: choice
options:
- main
- v24.08
BOOT_LOGO:
description: 'Include boot logo'
default: 'yes'
required: false
type: choice
options:
- yes
- no
jobs:
build-armbian-kernel:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download source code
run: |
df -hT ${PWD}
git clone -q --single-branch --depth=1 --branch=${{ github.event.inputs.Version }} https://github.com/armbian/build.git build
ln -sf ${{ github.workspace }}/build ${{ github.workspace }}/build
# 复制 config 和 userpatches 目录文件
cp -rf ${{ github.workspace }}/addboard/config/boards/* ${{ github.workspace }}/build/config/boards
mkdir -p "${{ github.workspace }}/build/userpatches"
cp -rf ${{ github.workspace }}/addboard/userpatches/* ${{ github.workspace }}/build/userpatches
- name: Compile Armbian Kernel [ ${{ inputs.RELEASE }} ]
run: |
cd ${GITHUB_WORKSPACE}/build/
./compile.sh BOARD=${{ inputs.BOARD }} RELEASE=${{ inputs.RELEASE }} BRANCH=${{ inputs.BRANCH }} BUILD_MINIMAL=no \
BUILD_DESKTOP=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,xz BOOT_LOGO=${{ inputs.BOOT_LOGO }}
- name: Prepare Release Metadata
run: |
# 提取版本号
# latest_image=$(ls ${{ github.workspace }}/build/output/images/Armbian-unofficial_*.img.xz | grep -oE 'Armbian-unofficial_[0-9.]+_.*' | sort -V | tail -n 1)
latest_image=$(ls ${{ github.workspace }}/build/output/images/Armbian-unofficial_*.img.xz | sort -V | tail -n 1)
version=$(echo "$latest_image" | cut -d'_' -f2)
# 提取板子型号
board_model=$(echo "$latest_image" | cut -d'_' -f3)
# 由于我们不想在awk中处理扩展名,我们可以先删除它
filename_no_ext=$(echo "$latest_image" | sed 's/\.img\.xz$//')
# 然后使用awk提取版本号
kernel_version=$(echo "$filename_no_ext" | awk -F'_' '{print $(NF)}')
echo "Latest Image: $latest_image"
echo "Version: $version"
echo "Board Model: $board_model"
echo "Kernel Version: $kernel_version"
# 将版本号设置为环境变量
echo "VERSION=$version" >> $GITHUB_ENV
echo "BOARD_MODEL=$board_model" >> $GITHUB_ENV
echo "KERNEL_VERSION=$kernel_version" >> $GITHUB_ENV
- name: Prepare Kernel Packages
run: |
cd "${GITHUB_WORKSPACE}/build/output/packages-hashed/"
file=$(find . -maxdepth 1 -type f -name 'kernel-*.tar' | head -n 1)
# 检查是否找到了文件
if [ -n "$file" ]; then
echo "Found file: $file"
# 重命名文件
mv "$file" "kernel_${{ env.KERNEL_VERSION }}_rockchip.tar"
echo "Renamed file to: kernel_${{ env.KERNEL_VERSION }}_rockchip.tar"
# 列出目录中的文件以验证重命名
ls -l
echo "Directory listing after renaming:"
find . -maxdepth 1 -type f
else
echo "No matching file found."
fi
- name: Upload Kernel Packages to Release
if: success()
uses: ncipollo/release-action@main
with:
tag: "Armbian_Kernel"
name: "Armbian_Kernel"
artifacts: "${{ github.workspace }}/build/output/packages-hashed/kernel_${{ env.KERNEL_VERSION }}_rockchip.tar"
allowUpdates: true
removeArtifacts: false
replacesArtifacts: true
token: ${{ secrets.MY_TOKEN }}
body: |
### Armbian Kernel Packages
- The kernel can be used to compile Armbian
- Usage method: After unzipping, install the deb packages in order
draft: false
prerelease: false