|
| 1 | +name: Build |
| 2 | +permissions: |
| 3 | + contents: write # Allow writing to repository contents (for pushing tags) |
| 4 | + actions: write # Allows triggering actions |
| 5 | + |
| 6 | + |
| 7 | +inputs: |
| 8 | + model: |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + soc: |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + branch: |
| 15 | + required: true |
| 16 | + type: string |
| 17 | + manifest: |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + android_version: |
| 21 | + required: true |
| 22 | + type: string |
| 23 | + kernel_version: |
| 24 | + required: true |
| 25 | + type: string |
| 26 | + ksun_branch: |
| 27 | + required: true |
| 28 | + type: string |
| 29 | + default: stable |
| 30 | + susfs_branch: |
| 31 | + required: true |
| 32 | + type: string |
| 33 | + default: "" |
| 34 | + |
| 35 | +runs: |
| 36 | + using: "composite" |
| 37 | + steps: |
| 38 | + - name: Setup Build System |
| 39 | + shell: bash |
| 40 | + run: | |
| 41 | + export DEBIAN_FRONTEND=noninteractive |
| 42 | + echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV |
| 43 | + |
| 44 | + df -h |
| 45 | + |
| 46 | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL /usr/local/share/powershell /usr/share/swift || true |
| 47 | + sudo docker image prune --all --force |
| 48 | + echo "some directories deleted" |
| 49 | + |
| 50 | + # Remove large unwanted packages |
| 51 | + sudo apt-get purge -y \ |
| 52 | + aria2 ansible azure-cli shellcheck rpm xorriso zsync \ |
| 53 | + esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \ |
| 54 | + google-cloud-sdk imagemagick \ |
| 55 | + libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \ |
| 56 | + mercurial apt-transport-https mono-complete libmysqlclient \ |
| 57 | + unixodbc-dev yarn chrpath libssl-dev libxft-dev \ |
| 58 | + libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \ |
| 59 | + snmp pollinate libpq-dev postgresql-client powershell ruby-full \ |
| 60 | + sphinxsearch subversion mongodb-org microsoft-edge-stable || true |
| 61 | + |
| 62 | + # Regex-based purges (for bulk families like mysql, php, dotnet) |
| 63 | + sudo apt-get purge -y $(dpkg-query -W -f='${binary:Package}\n' | grep -E '^mysql|^php|^dotnet') || true |
| 64 | + |
| 65 | + # Clean up |
| 66 | + sudo apt-get autoremove -y |
| 67 | + sudo apt-get autoclean -y |
| 68 | + echo "some packages purged" |
| 69 | + |
| 70 | + df -h |
| 71 | + |
| 72 | + # Install dependencies |
| 73 | + echo "Installing Repo and Python" |
| 74 | + sudo apt update |
| 75 | + sudo apt install -y python3 python-is-python3 |
| 76 | + |
| 77 | + mkdir -p ./git-repo |
| 78 | + curl -sSL https://storage.googleapis.com/git-repo-downloads/repo > ./git-repo/repo |
| 79 | + chmod a+rx ./git-repo/repo |
| 80 | + echo "REPO=$GITHUB_WORKSPACE/./git-repo/repo" >> $GITHUB_ENV |
| 81 | + |
| 82 | + # Set CONFIG Environment Variable |
| 83 | + echo "CONFIG=${{ inputs.model }}" >> $GITHUB_ENV |
| 84 | +
|
| 85 | + - name: Clone AnyKernel3 and Other Dependencies |
| 86 | + shell: bash |
| 87 | + run: | |
| 88 | + echo "Cloning AnyKernel3 and other dependencies..." |
| 89 | + |
| 90 | + ANYKERNEL_BRANCH="gki-2.0" |
| 91 | + if [[ -z "${{ inputs.susfs_branch }}" ]]; then |
| 92 | + SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}" |
| 93 | + else |
| 94 | + SUSFS_BRANCH="${{ inputs.susfs_branch }}" |
| 95 | + fi |
| 96 | + |
| 97 | + # Debug print the branches |
| 98 | + echo "Using branch for AnyKernel3: $ANYKERNEL_BRANCH" |
| 99 | + echo "Using branch for SUSFS: $SUSFS_BRANCH" |
| 100 | + |
| 101 | + # Clone repositories using the branch names |
| 102 | + git clone https://github.com/TheWildJames/AnyKernel3.git -b "$ANYKERNEL_BRANCH" |
| 103 | + git clone https://github.com/TheWildJames/kernel_patches.git |
| 104 | + |
| 105 | + # Clone the repo with all branches and history (can optimize later if needed) |
| 106 | + git clone https://gitlab.com/simonpunk/susfs4ksu.git |
| 107 | + cd susfs4ksu || exit 1 |
| 108 | + |
| 109 | + # Try to check if TARGET_REF is a valid branch or tag |
| 110 | + if git rev-parse --verify "origin/$SUSFS_BRANCH" >/dev/null 2>&1 || git rev-parse --verify "$SUSFS_BRANCH" >/dev/null 2>&1 ; then |
| 111 | + # It's a branch or commit hash |
| 112 | + git checkout "$SUSFS_BRANCH" |
| 113 | + else |
| 114 | + echo "Error: '$TARGET_REF' is neither a valid branch/tag nor a valid commit hash." |
| 115 | + exit 1 |
| 116 | + fi |
| 117 | +
|
| 118 | + - name: Initialize and Sync Kernel Source |
| 119 | + shell: bash |
| 120 | + run: | |
| 121 | + echo "Creating folder for configuration: $CONFIG..." |
| 122 | + mkdir -p "$CONFIG" |
| 123 | + cd "$CONFIG" |
| 124 | + |
| 125 | + # Initialize and sync kernel source |
| 126 | + echo "Initializing and syncing kernel source..." |
| 127 | + $REPO init -u https://github.com/OnePlusOSS/kernel_manifest.git -b ${{ inputs.branch }} -m ${{ inputs.manifest }} --repo-rev=v2.16 --depth=1 --no-clone-bundle --no-tags |
| 128 | + |
| 129 | + # Sync repo and apply patches |
| 130 | + $REPO --version |
| 131 | + $REPO --trace sync -c --no-clone-bundle --no-tags --optimized-fetch -j$(nproc --all) --fail-fast |
| 132 | + |
| 133 | + - name: Add KernelSU Next |
| 134 | + shell: bash |
| 135 | + run: | |
| 136 | + echo "Changing to configuration directory: $CONFIG..." |
| 137 | + cd "$CONFIG/kernel_platform" |
| 138 | + |
| 139 | + echo "Adding KernelSU Next..." |
| 140 | + |
| 141 | + if [ "${{ inputs.ksun_branch }}" == "stable" ]; then |
| 142 | + curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next/kernel/setup.sh" | bash - |
| 143 | + else |
| 144 | + curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next/kernel/setup.sh" | bash -s ${{ inputs.ksun_branch }} |
| 145 | + fi |
| 146 | +
|
| 147 | + - name: Apply SUSFS Patches |
| 148 | + shell: bash |
| 149 | + run: | |
| 150 | + echo "Changing to configuration directory: $CONFIG..." |
| 151 | + cd "$CONFIG/kernel_platform" |
| 152 | + |
| 153 | + echo "Applying SUSFS patches..." |
| 154 | + |
| 155 | + # Copy SUSFS patches |
| 156 | + cp ../../susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./common/ |
| 157 | + cp ../../susfs4ksu/kernel_patches/fs/* ./common/fs/ |
| 158 | + cp ../../susfs4ksu/kernel_patches/include/linux/* ./common/include/linux/ |
| 159 | + |
| 160 | + cd ./KernelSU-Next |
| 161 | + |
| 162 | + echo "Applying next SUSFS patches..." |
| 163 | + susfs_version=$(grep '#define SUSFS_VERSION' ../common/include/linux/susfs.h | awk -F'"' '{print $2}') |
| 164 | + echo "SUSVER=$susfs_version" >> $GITHUB_ENV |
| 165 | + BASE_VERSION=10200 |
| 166 | + KSU_VERSION=$(expr $(curl -sI "https://api.github.com/repos/KernelSU-Next/KernelSU-Next/commits?sha=${{ inputs.ksun_branch }}&per_page=1" | grep -i "link:" | sed -n 's/.*page=\([0-9]*\)>; rel="last".*/\1/p') "+" $BASE_VERSION) |
| 167 | + echo "KSUVER=$KSU_VERSION" >> $GITHUB_ENV |
| 168 | + echo "KernelSU Next Version: $KSU_VERSION" |
| 169 | + echo "SusFS Version: $susfs_version" |
| 170 | + |
| 171 | + case "$susfs_version" in |
| 172 | + "v1.5.5"|"v1.5.6"|"v1.5.7") |
| 173 | + cp "../../../kernel_patches/next/0001-kernel-implement-susfs-v1.5.5-v1.5.7-KSUN-v1.0.8.patch" "./ksun_susfs_latest.patch" |
| 174 | + ;; |
| 175 | + "v1.5.8") |
| 176 | + cp "../../../kernel_patches/next/0001-kernel-implement-susfs-v1.5.8-KernelSU-Next-v1.0.8.patch" "./ksun_susfs_latest.patch" |
| 177 | + ;; |
| 178 | + *) |
| 179 | + echo "Invalid version: $susfs_version" |
| 180 | + exit 1 |
| 181 | + ;; |
| 182 | + esac |
| 183 | + patch -p1 --forward < ksun_susfs_latest.patch || true |
| 184 | + |
| 185 | + |
| 186 | + # Change to common directory and apply SUSFS patch |
| 187 | + cd ../common |
| 188 | + if [ "${{ inputs.android_version }}" = "android15" ] && [ "${{ inputs.kernel_version }}" = "6.6" ]; then |
| 189 | + if ! grep -qxF '#include <trace/hooks/fs.h>' ./fs/namespace.c; then |
| 190 | + sed -i '/#include <trace\/hooks\/blk.h>/a #include <trace\/hooks\/fs.h>' ./fs/namespace.c |
| 191 | + else |
| 192 | + echo "Line already present. Skipping insert." |
| 193 | + fi |
| 194 | + fi |
| 195 | + patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true |
| 196 | + |
| 197 | + if ! grep -qxF '#define CMD_SUSFS_HIDE_SUS_MNTS_FOR_ALL_PROCS 0x55561' ./include/linux/susfs_def.h; then |
| 198 | + curl -Ls https://raw.githubusercontent.com/fatalcoder524/kernel_patches_additional/refs/heads/main/hide_sus_mnts_for_all_procs.patch | patch -p1 -F 3 |
| 199 | + else |
| 200 | + echo "Line already present. Skipping SUSFS_HIDE_SUS_MNTS_FOR_ALL_PROCS Patch." |
| 201 | + fi |
| 202 | + |
| 203 | + KERNEL_VERSION="${{ inputs.kernel_version }}" |
| 204 | + MIN_VERSION="5.16" |
| 205 | + |
| 206 | + if [ "$(printf '%s\n' "$KERNEL_VERSION" "$MIN_VERSION" | sort -V | head -n1)" = "$KERNEL_VERSION" ]; then |
| 207 | + echo "Patching ptrace!" |
| 208 | + curl -Ls https://raw.githubusercontent.com/fatalcoder524/kernel_patches_additional/refs/heads/main/ptrace.patch | patch -p1 -F 3 |
| 209 | + else |
| 210 | + echo "Kernel >= $MIN_VERSION, skipping ptrace patch" |
| 211 | + fi |
| 212 | +
|
| 213 | + - name: Apply KSUN Hooks |
| 214 | + shell: bash |
| 215 | + run: | |
| 216 | + echo "Changing to configuration directory: $CONFIG..." |
| 217 | + cd "$CONFIG/kernel_platform/common" |
| 218 | + echo "Applying KSUN Hooks..." |
| 219 | + cp ../../../kernel_patches/next/scope_min_manual_hooks_v1.4.patch ./manual_hooks.patch |
| 220 | + patch -p1 --fuzz=3 < ./manual_hooks.patch |
| 221 | + |
| 222 | + - name: Apply Hide Stuff Patches |
| 223 | + shell: bash |
| 224 | + run: | |
| 225 | + echo "Changing to configuration directory: $CONFIG..." |
| 226 | + cd "$CONFIG/kernel_platform/common" |
| 227 | + # Apply additional patch |
| 228 | + cp ../../../kernel_patches/69_hide_stuff.patch ./ |
| 229 | + patch -p1 -F 3 < 69_hide_stuff.patch |
| 230 | +
|
| 231 | + - name: Add KernelSU-Next and SUSFS Configuration Settings |
| 232 | + shell: bash |
| 233 | + run: | |
| 234 | + echo "Changing to configuration directory: $CONFIG..." |
| 235 | + cd "$CONFIG/kernel_platform" |
| 236 | + |
| 237 | + echo "Adding configuration settings to gki_defconfig..." |
| 238 | + |
| 239 | + # Add KSU configuration settings |
| 240 | + echo "CONFIG_KSU=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 241 | + echo "CONFIG_KSU_KPROBES_HOOK=n" >> ./common/arch/arm64/configs/gki_defconfig |
| 242 | + |
| 243 | + # Add SUSFS configuration settings |
| 244 | + echo "CONFIG_KSU_SUSFS=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 245 | + echo "CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 246 | + echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 247 | + echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 248 | + echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 249 | + echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 250 | + echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 251 | + echo "CONFIG_KSU_SUSFS_SUS_OVERLAYFS=n" >> ./common/arch/arm64/configs/gki_defconfig |
| 252 | + echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 253 | + echo "CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 254 | + echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 255 | + echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 256 | + echo "CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 257 | + echo "CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 258 | + echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 259 | + echo "CONFIG_KSU_SUSFS_SUS_SU=n" >> ./common/arch/arm64/configs/gki_defconfig |
| 260 | + |
| 261 | + # Add additional tmpfs config setting |
| 262 | + echo "CONFIG_TMPFS_XATTR=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 263 | + echo "CONFIG_TMPFS_POSIX_ACL=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 264 | +
|
| 265 | + - name: Add BBR Support |
| 266 | + shell: bash |
| 267 | + run: | |
| 268 | + echo "Changing to configuration directory: $CONFIG..." |
| 269 | + cd "$CONFIG/kernel_platform" |
| 270 | + |
| 271 | + echo "Adding configuration settings to gki_defconfig..." |
| 272 | + echo "CONFIG_TCP_CONG_ADVANCED=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 273 | + echo "CONFIG_TCP_CONG_BBR=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 274 | + echo "CONFIG_TCP_CONG_BIC=n" >> ./common/arch/arm64/configs/gki_defconfig |
| 275 | + echo "CONFIG_TCP_CONG_WESTWOOD=n" >> ./common/arch/arm64/configs/gki_defconfig |
| 276 | + echo "CONFIG_TCP_CONG_HTCP=n" >> ./common/arch/arm64/configs/gki_defconfig |
| 277 | + |
| 278 | + echo "CONFIG_NET_SCH_FQ=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 279 | + echo "CONFIG_NET_SCH_FQ_CODEL=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 280 | +
|
| 281 | + - name: Add TTL Target Support |
| 282 | + shell: bash |
| 283 | + run: | |
| 284 | + echo "Changing to configuration directory: $CONFIG..." |
| 285 | + cd "$CONFIG/kernel_platform" |
| 286 | + |
| 287 | + echo "Adding configuration settings to gki_defconfig..." |
| 288 | + echo "CONFIG_IP_NF_TARGET_TTL=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 289 | + echo "CONFIG_IP6_NF_TARGET_HL=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 290 | + echo "CONFIG_IP6_NF_MATCH_HL=y" >> ./common/arch/arm64/configs/gki_defconfig |
| 291 | +
|
| 292 | + - name: Run sed and perl Commands |
| 293 | + shell: bash |
| 294 | + run: | |
| 295 | + echo "Changing to configuration directory: $CONFIG..." |
| 296 | + cd "$CONFIG/kernel_platform" |
| 297 | + |
| 298 | + echo "Running sed commands..." |
| 299 | + |
| 300 | + sed -i 's/CONFIG_LTO=n/CONFIG_LTO=y/' "./common/arch/arm64/configs/gki_defconfig" |
| 301 | + sed -i 's/CONFIG_LTO_CLANG_FULL=y/CONFIG_LTO_CLANG_THIN=y/' "./common/arch/arm64/configs/gki_defconfig" |
| 302 | + sed -i 's/CONFIG_LTO_CLANG_NONE=y/CONFIG_LTO_CLANG_THIN=y/' "./common/arch/arm64/configs/gki_defconfig" |
| 303 | + |
| 304 | + # Run sed commands for modifications |
| 305 | + sed -i 's/check_defconfig//' ./common/build.config.gki |
| 306 | + # For Old setlocalversion Script |
| 307 | + tac ./common/scripts/setlocalversion | sed '0,/echo "\$res"/s//res=\$\(echo \$res \| cut -d- -f1-2\)-OP-Wild\;echo "\$res"\;/' | tac > ./common/scripts/setlocalversion.tmp && mv ./common/scripts/setlocalversion.tmp ./common/scripts/setlocalversion |
| 308 | + tac ./msm-kernel/scripts/setlocalversion | sed '0,/echo "\$res"/s//res=\$\(echo \$res \| cut -d- -f1-2\)-OP-Wild\;echo "\$res"\;/' | tac > ./msm-kernel/scripts/setlocalversion.tmp && mv ./msm-kernel/scripts/setlocalversion.tmp ./msm-kernel/scripts/setlocalversion |
| 309 | + tac ./external/dtc/scripts/setlocalversion | sed '0,/echo "\$res"/s//res=\$\(echo \$res \| cut -d- -f1-2\)-OP-Wild\;echo "\$res"\;/' | tac > ./external/dtc/scripts/setlocalversion.tmp && mv ./external/dtc/scripts/setlocalversion.tmp ./external/dtc/scripts/setlocalversion |
| 310 | + # For New setlocalversion Script |
| 311 | + sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${KERNELVERSION}-${{ inputs.android_version }}-OP-Wild"/' ./common/scripts/setlocalversion |
| 312 | + sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${KERNELVERSION}-${{ inputs.android_version }}-OP-Wild"/' ./msm-kernel/scripts/setlocalversion |
| 313 | + sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${KERNELVERSION}-${{ inputs.android_version }}-OP-Wild"/' ./external/dtc/scripts/setlocalversion |
| 314 | + chmod +x ./common/scripts/setlocalversion |
| 315 | + chmod +x ./msm-kernel/scripts/setlocalversion |
| 316 | + chmod +x ./external/dtc/scripts/setlocalversion |
| 317 | + sed -i "/stable_scmversion_cmd/s/-maybe-dirty//g" ./build/kernel/kleaf/impl/stamp.bzl || echo "No stamp.bzl!" |
| 318 | + sed -i 's/-dirty//' ./common/scripts/setlocalversion |
| 319 | + sed -i 's/-dirty//' ./msm-kernel/scripts/setlocalversion |
| 320 | + sed -i 's/-dirty//' ./external/dtc/scripts/setlocalversion |
| 321 | + sed -i 's/-dirty//' ./build/kernel/kleaf/workspace_status_stamp.py || echo "No workspace_status_stamp.py!" |
| 322 | + |
| 323 | + sed -i '/echo "LTO $LTO "/i export LTO=thin' ./oplus/build/oplus_setup.sh |
| 324 | + sed -i 's/export REPACK_IMG=true/export REPACK_IMG=false/g' ./oplus/build/oplus_setup.sh |
| 325 | + |
| 326 | + # Run perl command to modify UTS_VERSION |
| 327 | + DATESTR=$(date -u) |
| 328 | + perl -pi -e 's{UTS_VERSION="\$\(echo \$UTS_VERSION \$CONFIG_FLAGS \$TIMESTAMP \| cut -b -\$UTS_LEN\)"}{UTS_VERSION="#1 SMP PREEMPT $DATESTR"}' ./common/scripts/mkcompile_h |
| 329 | + perl -pi -e 's{UTS_VERSION="\$\(echo \$UTS_VERSION \$CONFIG_FLAGS \$TIMESTAMP \| cut -b -\$UTS_LEN\)"}{UTS_VERSION="#1 SMP PREEMPT $DATESTR"}' ./msm-kernel/scripts/mkcompile_h |
| 330 | +
|
| 331 | + - name: Build the Kernel |
| 332 | + shell: bash |
| 333 | + run: | |
| 334 | + echo "Changing to configuration directory: $CONFIG..." |
| 335 | + cd "$CONFIG" |
| 336 | + |
| 337 | + echo "Building the kernel..." |
| 338 | + # Clear Cache |
| 339 | + sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches' |
| 340 | + |
| 341 | + rm ./kernel_platform/common/android/abi_gki_protected_exports_* || echo "No protected exports!" |
| 342 | + rm ./kernel_platform/msm-kernel/android/abi_gki_protected_exports_* || echo "No protected exports!" |
| 343 | + |
| 344 | + BUILD_TYPE="gki" |
| 345 | + BAZEL_ARGS=(--jobs=$(nproc --all) --lto=thin) |
| 346 | + if [ "${{ inputs.soc }}" == "sun" ]; then |
| 347 | + BUILD_TYPE="perf" |
| 348 | + BAZEL_ARGS+=(-g) |
| 349 | + fi |
| 350 | + |
| 351 | + (stdbuf -oL bash -c ' |
| 352 | + while true; do |
| 353 | + echo "=== $(date) ===" |
| 354 | + free -h |
| 355 | + echo "======" |
| 356 | + df -h |
| 357 | + echo "======" |
| 358 | + top -b -n 1 | head -n 15 |
| 359 | + echo "" |
| 360 | + sleep 60 |
| 361 | + done |
| 362 | + ') & |
| 363 | + MONITOR_PID=$! |
| 364 | + trap "kill $MONITOR_PID" EXIT |
| 365 | + |
| 366 | + if [ -f ./kernel_platform/build_with_bazel.py ]; then |
| 367 | + ./kernel_platform/oplus/bazel/oplus_modules_variant.sh ${{ inputs.soc }} "$BUILD_TYPE" "" |
| 368 | + ./kernel_platform/build_with_bazel.py -t ${{ inputs.soc }} $BUILD_TYPE "${BAZEL_ARGS[@]}" -o "$(pwd)/out" |
| 369 | + else |
| 370 | + LTO=thin ./kernel_platform/oplus/build/oplus_build_kernel.sh ${{ inputs.soc }} "$BUILD_TYPE" |
| 371 | + fi |
| 372 | +
|
| 373 | + - name: Create ZIP Files for Different Formats |
| 374 | + shell: bash |
| 375 | + run: | |
| 376 | + echo "Changing to configuration directory: $CONFIG..." |
| 377 | + cd "$CONFIG" |
| 378 | + |
| 379 | + echo "Copying Image" |
| 380 | + cp ./out/dist/Image ../AnyKernel3/Image |
| 381 | + |
| 382 | + echo "Navigating to AnyKernel3 directory..." |
| 383 | + cd ../AnyKernel3 |
| 384 | + |
| 385 | + # Zip the files in the AnyKernel3 directory with a new naming convention |
| 386 | + ZIP_NAME="AnyKernel3_${{ inputs.model }}_${{ inputs.android_version }}-${{ inputs.kernel_version }}_Next_${{ env.KSUVER }}_SUSFS_${{ env.SUSVER }}.zip" |
| 387 | + echo "Creating zip file $ZIP_NAME..." |
| 388 | + zip -r "../$ZIP_NAME" ./* |
| 389 | +
|
| 390 | + - name: Upload Build Artifacts |
| 391 | + uses: actions/upload-artifact@v4 |
| 392 | + with: |
| 393 | + name: kernel-${{ env.CONFIG }} |
| 394 | + path: | |
| 395 | + *.zip |
0 commit comments