update:workflow

This commit is contained in:
Dich
2025-07-03 19:18:02 +08:00
parent 64989cced5
commit 8d346016ab

View File

@@ -64,7 +64,7 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install dependencies and update GCC - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
@@ -72,12 +72,8 @@ jobs:
git libncurses-dev libssl-dev \ git libncurses-dev libssl-dev \
libelf-dev lzop python3 unzip xz-utils \ libelf-dev lzop python3 unzip xz-utils \
zstd rsync ca-certificates wget \ zstd rsync ca-certificates wget \
pahole dwarves zip pahole dwarves zip gcc g++
# 安装GCC以满足内核版本要求
sudo apt-get install -y gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90
# 验证GCC版本 # 验证GCC版本
gcc --version gcc --version
@@ -130,7 +126,7 @@ jobs:
ls -la ./toolchains/ ls -la ./toolchains/
echo "工具链设置完成 ===" echo "工具链设置完成 ==="
- name: Determine kernel repo & branch and set device variables - name: Determine kernel repo & branch
id: vars id: vars
run: | run: |
DEV=${{ github.event.inputs.device }} DEV=${{ github.event.inputs.device }}
@@ -300,12 +296,15 @@ jobs:
if [ "${{ github.event.inputs.root_solution }}" = "kernelsu" ]; then if [ "${{ github.event.inputs.root_solution }}" = "kernelsu" ]; then
echo "✅ 集成 KernelSU" echo "✅ 集成 KernelSU"
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash - curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
echo "ROOT_SUFFIX=_KernelSU" >> $GITHUB_ENV
elif [ "${{ github.event.inputs.root_solution }}" = "kernelsu-next" ]; then elif [ "${{ github.event.inputs.root_solution }}" = "kernelsu-next" ]; then
echo "✅ 集成 KernelSU-Next" echo "✅ 集成 KernelSU-Next"
curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next/kernel/setup.sh" | bash - curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next/kernel/setup.sh" | bash -
echo "ROOT_SUFFIX=_KernelSU-Next" >> $GITHUB_ENV
elif [ "${{ github.event.inputs.root_solution }}" = "sukisu" ]; then elif [ "${{ github.event.inputs.root_solution }}" = "sukisu" ]; then
echo "✅ 集成 SukiSU-Ultra" echo "✅ 集成 SukiSU-Ultra"
curl -LSs "https://raw.githubusercontent.com/SukiSU-Ultra/SukiSU-Ultra/main/kernel/setup.sh" | bash -s main curl -LSs "https://raw.githubusercontent.com/SukiSU-Ultra/SukiSU-Ultra/main/kernel/setup.sh" | bash -s main
echo "ROOT_SUFFIX=_SukiSU" >> $GITHUB_ENV
elif [ "${{ github.event.inputs.root_solution }}" = "none" ]; then elif [ "${{ github.event.inputs.root_solution }}" = "none" ]; then
echo " 未选择任何 Root 方案,跳过" echo " 未选择任何 Root 方案,跳过"
else else
@@ -336,7 +335,7 @@ jobs:
which clang which clang
clang --version clang --version
echo "=== 验证 clang 是否支持 --target ===" echo "=== 验证 clang 是否支持 --target ==="
clang --target=aarch64-linux-gnu -v -c /dev/null -o /dev/null || echo "❌ 不支持" clang --target=aarch64-linux-gnu -fsyntax-only -x c /dev/null || echo "❌ clang 不支持 aarch64 目标"
echo "=== 验证 binutils 是否可用 ===" echo "=== 验证 binutils 是否可用 ==="
which llvm-objcopy which llvm-objcopy
which llvm-strip which llvm-strip
@@ -424,8 +423,7 @@ jobs:
cp source/$KERNEL_DIR/out/arch/arm64/boot/Image output/ cp source/$KERNEL_DIR/out/arch/arm64/boot/Image output/
# 修改 AnyKernel3 配置 # 修改 AnyKernel3 配置
cd output cd output && rm -rf ramdisk patch modules
rm -rf ramdisk patch modules
# 创建更新信息文件 # 创建更新信息文件
cat > kernel_info.txt << EOF cat > kernel_info.txt << EOF
@@ -485,6 +483,17 @@ jobs:
# 保存包名供后续步骤使用 # 保存包名供后续步骤使用
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV
- name: Compress vmlinux
if: always()
run: |
VMLINUX=kernel/source/${{ env.KERNEL_DIR }}/out/vmlinux
if [ -f "$VMLINUX" ]; then
echo "✅ vmlinux exists, compressing..."
gzip -c "$VMLINUX" > "${VMLINUX}.gz"
else
echo "⚠️ vmlinux not found, skipping compression"
fi
- name: Upload build artifacts - name: Upload build artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: always() if: always()
@@ -493,6 +502,7 @@ jobs:
path: | path: |
kernel/source/${{ env.KERNEL_DIR }}/out/arch/arm64/boot/Image* kernel/source/${{ env.KERNEL_DIR }}/out/arch/arm64/boot/Image*
kernel/source/${{ env.KERNEL_DIR }}/out/arch/arm64/boot/dts/*/*.dtb kernel/source/${{ env.KERNEL_DIR }}/out/arch/arm64/boot/dts/*/*.dtb
kernel/source/${{ env.KERNEL_DIR }}/out/vmlinux.gz
kernel/source/${{ env.KERNEL_DIR }}/out/error.log kernel/source/${{ env.KERNEL_DIR }}/out/error.log
kernel/source/${{ env.KERNEL_DIR }}/out/.config kernel/source/${{ env.KERNEL_DIR }}/out/.config
kernel/output/*.zip kernel/output/*.zip