fix:set_directory

This commit is contained in:
dichgrem
2025-09-30 19:03:25 +08:00
parent 2ce91d5ae0
commit 591fe18d2b

View File

@@ -6,7 +6,7 @@ on:
enable_susfs: enable_susfs:
description: "Enable susfs support" description: "Enable susfs support"
required: false required: false
default: "ture" default: "true"
type: boolean type: boolean
device: device:
description: "Target OnePlus device" description: "Target OnePlus device"
@@ -14,16 +14,15 @@ on:
default: "corvette" default: "corvette"
type: choice type: choice
options: options:
- salami # OnePlus 11 - corvette
- corvette # OnePlus ACE3 Pro
config_source: config_source:
description: "Choose config source for myconfig" description: "Choose config source for myconfig"
required: true required: true
default: "repo" default: "repo"
type: choice type: choice
options: options:
- repo # 使用仓库根目录下的 config - repo
- default # 使用源码仓库的默认 defconfigNoGKI - default
root_solution: root_solution:
description: "Choose root solution to integrate" description: "Choose root solution to integrate"
required: false required: false
@@ -60,71 +59,68 @@ jobs:
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 gcc g++ pahole dwarves zip gcc g++
# 验证GCC版本
gcc --version gcc --version
- name: Setup directory structure - name: Setup directory structure
run: | run: |
# 创建与本地一致的目录结构 set -e
mkdir -p $GITHUB_WORKSPACE/kernel/toolchains echo "WORKDIR=$WORKDIR"
mkdir -p $GITHUB_WORKSPACE/kernel/source mkdir -p "$WORKDIR"
mkdir -p $GITHUB_WORKSPACE/kernel/anykernel3 cd "$WORKDIR"
mkdir -p $GITHUB_WORKSPACE/kernel/output # 与本地一致
mkdir -p aarch64-linux-android-4.9
echo "=== Created directory structure ===" mkdir -p arm-linux-androideabi-4.9
ls -la $GITHUB_WORKSPACE/kernel/ mkdir -p clang-r547379
mkdir -p android_kernel_oneplus_sm8650
mkdir -p sm8650-modules
mkdir -p anykernel3
mkdir -p output
echo "=== Created directory structure under $WORKDIR ==="
ls -la "$WORKDIR"
- name: Setup toolchains - name: Setup toolchains
run: | run: |
cd $GITHUB_WORKSPACE/kernel set -e
echo "=== 下载 Clang 工具链 ===" cd "$WORKDIR"
# 创建 Clang 目录 echo "=== Downloading and preparing clang-r547379 ==="
mkdir -p ./toolchains/clang-r487747c wget -nv -O clang-r547379.tar.gz "https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/main/clang-r547379.tar.gz"
# 下载 Android 官方 Clang r487747c 工具链 # extract into clang-r547379, strip top-level if present
cd toolchains mkdir -p clang-r547379
git clone --depth=1 https://gitlab.com/crdroidandroid/android_prebuilts_clang_host_linux-x86_clang-r487747c.git tar -xvf clang-r547379.tar.gz -C clang-r547379 --strip-components=1
# 检查下载是否成功 echo "clang-r547379 contents:"
if [ ! -d "android_prebuilts_clang_host_linux-x86_clang-r487747c" ]; then ls -la clang-r547379 | sed -n '1,200p'
echo "Error: Clang 工具链下载失败"
exit 1 echo "=== Cloning prebuilts GCC (aarch64 & arm) ==="
if [ ! -d "aarch64-linux-android-4.9/.git" ]; then
git clone --depth=1 https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9 aarch64-linux-android-4.9
else
echo "aarch64 prebuilts already present"
fi fi
echo "=== 移动工具链文件 ==="
# 移动到 clang-r487747c 目录 if [ ! -d "arm-linux-androideabi-4.9/.git" ]; then
mv android_prebuilts_clang_host_linux-x86_clang-r487747c/* clang-r487747c/ git clone --depth=1 https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9 arm-linux-androideabi-4.9
# 检查解压后的目录结构 else
echo "=== 检查解压后的目录结构 ===" echo "arm prebuilts already present"
ls -la clang-r487747c/ fi
# 清理临时目录
rm -rf android_prebuilts_clang_host_linux-x86_clang-r487747c echo "Prebuilts aarch64 snapshot:"
# 返回 kernel 目录 ls -la aarch64-linux-android-4.9 | sed -n '1,200p'
cd $GITHUB_WORKSPACE/kernel echo "Prebuilts arm snapshot:"
echo "=== 最终目录结构 ===" ls -la arm-linux-androideabi-4.9 | sed -n '1,200p'
echo "kernel/"
ls -la ./
echo "kernel/toolchains/"
ls -la ./toolchains/
echo "工具链设置完成 ==="
- name: Determine kernel repo & branch - name: Determine kernel repo & branch
id: vars id: vars
run: | run: |
DEV=${{ github.event.inputs.device }} set -e
DEV="${{ github.event.inputs.device }}"
case "$DEV" in case "$DEV" in
corvette) corvette)
REPO=https://github.com/crdroidandroid/android_kernel_oneplus_sm8650.git REPO=https://github.com/OPACE3PRO/android_kernel_oneplus_sm8650.git
DEVICE_CODENAME=corvette DEVICE_CODENAME=corvette
DEVICE_NAME="OnePlus ACE3 Pro" DEVICE_NAME="OnePlus ACE3 Pro"
SOC_PLATFORM=sm8650 SOC_PLATFORM=sm8650
KERNEL_DIR=android_kernel_oneplus_sm8650 KERNEL_DIR=android_kernel_oneplus_sm8650
;; ;;
salami)
REPO=https://github.com/crdroidandroid/android_kernel_oneplus_sm8550.git
DEVICE_CODENAME=salami
DEVICE_NAME="OnePlus 11"
SOC_PLATFORM=sm8550
KERNEL_DIR=android_kernel_oneplus_sm8550
;;
*) *)
echo "Unsupported device: $DEV" echo "Unsupported device: $DEV"
exit 1 exit 1
@@ -142,23 +138,50 @@ jobs:
echo "Repository: $REPO" echo "Repository: $REPO"
echo "Kernel Directory: $KERNEL_DIR" echo "Kernel Directory: $KERNEL_DIR"
- name: Clone Kernel Source - name: Clone Kernel source
run: | run: |
mkdir -p "$WORKDIR/source" set -e
if [ -z "$BRANCH" ]; then cd "$WORKDIR"
echo "BRANCH 未设置,自动检测默认分支..." # 使用上一步写入的 REPO 环境变量
BRANCH=$(git ls-remote --symref "$REPO" HEAD | awk '/^ref:/ {sub("refs/heads/", "", $2); print $2; exit}') REPO="${REPO:-}"
echo "检测到默认分支为: $BRANCH" if [ -z "$REPO" ]; then
echo "REPO is not set"
exit 1
fi fi
echo "Cloning $REPO branch $BRANCH into $WORKDIR/source/$KERNEL_DIR" # detect default branch if BRANCH not provided
git clone --depth=1 \ if [ -z "${BRANCH}" ]; then
--branch "$BRANCH" \ echo "BRANCH not set; detecting remote default branch..."
"$REPO" \ BRANCH=$(git ls-remote --symref "$REPO" HEAD | awk '/^ref:/ {sub("refs/heads/", "", $2); print $2; exit}')
"$WORKDIR/source/$KERNEL_DIR" echo "Detected default branch: $BRANCH"
fi
echo "Cloning kernel repo ($REPO) branch: $BRANCH -> $WORKDIR/android_kernel_oneplus_sm8650"
rm -rf android_kernel_oneplus_sm8650 || true
git clone --depth=1 --branch "$BRANCH" "$REPO" android_kernel_oneplus_sm8650
echo "Cloning modules repo (OPACE3PRO) -> $WORKDIR/sm8650-modules"
if [ ! -d "sm8650-modules/.git" ]; then
git clone --depth=1 https://github.com/OPACE3PRO/android_kernel_oneplus_sm8650-modules.git sm8650-modules
else
echo "sm8650-modules already exists"
fi
echo "Kernel top-level:"
ls -la android_kernel_oneplus_sm8650 | sed -n '1,200p'
echo "sm8650-modules remotes:"
git -C sm8650-modules remote -v || true
ls -la sm8650-modules | sed -n '1,200p'
- name: Show final WORKDIR layout
run: |
set -e
cd "$WORKDIR"
echo "Final layout under $WORKDIR:"
ls -la
echo "Sample clang dir listing:"
ls -la clang-r547379 | sed -n '1,200p'
echo "=== 内核源码目录结构 ==="
ls -la "$WORKDIR/source/"
- name: Clone AnyKernel3 - name: Clone AnyKernel3
run: | run: |