Debian Kernel ARM64 latest #46
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 free software, licensed under the MIT License. | |
# See /LICENSE for more information. | |
# | |
# Description: Build Kernel using GitHub Actions | |
# Change from P3TERX | |
# | |
name: Debian Kernel ARM64 latest | |
on: | |
workflow_dispatch: | |
#schedule: | |
#- cron: "36 19 * * 2,6" | |
# inputs: | |
# ssh: | |
# description: 'SSH connection to Actions' | |
# required: false | |
# default: 'false' | |
env: | |
UPLOAD_DIR: true | |
UPLOAD_RELEASE: true | |
UPLOAD_WETRANSFER: false | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: docker.io/qctt/kernelbuild:debian12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Initialization environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt update && apt install dwarves gcc-aarch64-linux-gnu -y | |
sudo chown $USER:$GROUPS /workdir | |
sudo chown $USER:$GROUPS /workdir/upload | |
- name: Check for updates | |
id: check | |
run: | | |
github_tag=$(curl -s 'https://api.github.com/repos/ylx2016/kernel/releases' | grep 'Debian_Kernel' | grep '_arm64_' | head -n 1 | awk -F '"' '{print $4}' | awk -F '[/]' '{print $8}') | |
github_ver=$(curl -s 'https://api.github.com/repos/ylx2016/kernel/releases' | grep ${github_tag} | grep 'deb' | grep 'headers' | awk -F '"' '{print $4}' | awk -F '[/]' '{print $9}' | awk -F '[-]' '{print $3}' | awk -F '[_]' '{print $1}') | |
kernel_ver=$(curl -s https://www.kernel.org/ | grep ' <a href="https://cdn.kernel.org/pub/linux/kernel/' | head -n 1 | awk -F '[>]' '{print $2}' | awk -F '[<]' '{print $1}') | |
echo "github_ver=" $github_ver | |
echo "kernel_ver=" $kernel_ver | |
if [[ $github_ver == *"$kernel_ver"* ]]; then | |
echo "::set-output name=status::fail" | |
else | |
echo "::set-output name=status::success" | |
fi | |
- name: Get source code | |
id: code | |
working-directory: /workdir | |
if: steps.check.outputs.status == 'success' | |
run: | | |
df -hT $PWD | |
kernel_file=$(curl -s https://www.kernel.org/ | grep 'alt="Download"' | awk -F '"' '{print $2}') | |
kernel_ver=$(curl -s https://www.kernel.org/ | grep ' <a href="https://cdn.kernel.org/pub/linux/kernel/' | head -n 1 | awk -F '[>]' '{print $2}' | awk -F '[<]' '{print $1}') | |
wget -O kernel.tar.xz $kernel_file | |
tar -Jxvf kernel.tar.xz -C /workdir && cd /workdir/linux-$kernel_ver | |
echo "::set-output name=status::success" | |
- name: SSH connection to Actions | |
uses: P3TERX/[email protected] | |
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh') | |
env: | |
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
- name: Compile the kernel | |
id: compile | |
if: steps.code.outputs.status == 'success' | |
working-directory: /workdir | |
run: | | |
kernel_ver=$(curl -s https://www.kernel.org/ | grep ' <a href="https://cdn.kernel.org/pub/linux/kernel/' | head -n 1 | awk -F '[>]' '{print $2}' | awk -F '[<]' '{print $1}') | |
cd linux-$kernel_ver | |
#wget -O .config https://raw.githubusercontent.com/ylx2016/kernel/master/5.13.arm64.config | |
wget -O .config https://raw.githubusercontent.com/ylx2016/kernel/master/kernel-aarch64-rhel.config | |
sed -ri '/CONFIG_SYSTEM_TRUSTED_KEYS/s/=.+/=""/g' .config | |
sed -ri '/CONFIG_DEBUG_KERNEL=/c\CONFIG_DEBUG_KERNEL=n' .config | |
sed -ri '/CONFIG_DEBUG_MISC=/c\CONFIG_DEBUG_MISC=n' .config | |
sed -ri '/CONFIG_MODULE_SIG=/c\CONFIG_MODULE_SIG=n' .config | |
sed -ri '/CONFIG_DEBUG_INFO=/c\CONFIG_DEBUG_INFO=n' .config | |
sed -i 's/.*CONFIG_DEBUG_INFO_BTF.*/CONFIG_DEBUG_INFO_BTF=n/' .config | |
sed -i 's/.*CONFIG_DEBUG_INFO_DWARF4.*/CONFIG_DEBUG_INFO_DWARF4=n/' .config | |
sed -i 's/.*CONFIG_DEBUG_INFO_DWARF5.*/CONFIG_DEBUG_INFO_DWARF5=n/' .config | |
sed -i 's/.*CONFIG_DEBUG_INFO_NONE.*/CONFIG_DEBUG_INFO_NONE=n/' .config | |
scripts/config --disable MODULE_SIG | |
scripts/config --disable DEBUG_INFO | |
scripts/config --disable DEBUG_INFO_BTF | |
scripts/config --disable DEBUG_INFO_DWARF4 | |
scripts/config --disable DEBUG_INFO_DWARF5 | |
scripts/config --disable DEBUG_INFO_NONE | |
scripts/config --disable SYSTEM_TRUSTED_KEYS | |
scripts/config --disable SYSTEM_REVOCATION_KEYS | |
echo -e "$(nproc) thread compile" | |
sudo time make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc) bindeb-pkg | |
cd /workdir && mv *.deb /workdir/upload | |
echo "::set-output name=status::success" | |
echo "FILE_DATE=Kernel_Debian_$kernel_ver_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV | |
- name: Check space usage | |
if: (!cancelled()) && steps.compile.outputs.status == 'success' | |
run: df -hT | |
- name: Upload | |
uses: actions/upload-artifact@main | |
if: steps.compile.outputs.status == 'success' && env.UPLOAD_DIR == 'true' | |
with: | |
name: ${{ env.FILE_DATE }} | |
path: /workdir/upload | |
- name: Upload to WeTransfer | |
id: wetransfer | |
if: steps.compile.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled() | |
run: | | |
curl -fsSL git.io/file-transfer | sh | |
./transfer wet -s -p 16 --no-progress /workdir/upload 2>&1 | tee wetransfer.log | |
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)" | |
echo "::set-output name=url::$(cat wetransfer.log | grep https | cut -f3 -d" ")" | |
- name: Generate release tag | |
id: tag | |
if: env.UPLOAD_RELEASE == 'true' && steps.compile.outputs.status == 'success' && !cancelled() | |
run: | | |
kernel_ver=$(curl -s https://www.kernel.org/ | grep ' <a href="https://cdn.kernel.org/pub/linux/kernel/' | head -n 1 | awk -F '[>]' '{print $2}' | awk -F '[<]' '{print $1}') | |
echo "::set-output name=release_tag::Debian_Kernel_${kernel_ver}_latest_arm64_bbr_$(date +"%Y.%m.%d-%H%M")" | |
touch release.txt | |
echo "::set-output name=status::success" | |
- name: Upload kernel to release | |
uses: softprops/action-gh-release@v1 | |
if: steps.tag.outputs.status == 'success' && !cancelled() | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.release_tag }} | |
body_path: release.txt | |
files: /workdir/upload/* |