Update build-kernel-op12.yml #2
This file contains hidden or 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
| name: Build OnePlus 12 Android 14 6.1 Kernel | ||
| on: | ||
| workflow_call: # This allows this workflow to be called from another workflow | ||
| jobs: | ||
| build-kernel-a14-6-1-kernelsu-susfs: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Maximize build space | ||
| uses: easimon/maximize-build-space@master | ||
| with: | ||
| root-reserve-mb: 8192 | ||
| temp-reserve-mb: 2048 | ||
| swap-size-mb: 8192 | ||
| remove-dotnet: 'true' | ||
| remove-android: 'true' | ||
| remove-haskell: 'true' | ||
| remove-codeql: 'true' | ||
| - name: Set CONFIG Environment Variable | ||
| run: | | ||
| # Set CONFIG dynamically based on matrix values | ||
| CONFIG="op12" | ||
| # Set CONFIG as an environment variable for future steps | ||
| echo "CONFIG=$CONFIG" >> $GITHUB_ENV | ||
| echo "CONFIG set to: $CONFIG" | ||
| - name: Install Repo | ||
| run: | | ||
| # Install dependencies | ||
| mkdir -p ./git-repo | ||
| curl https://storage.googleapis.com/git-repo-downloads/repo > ./git-repo/repo | ||
| chmod a+rx ./git-repo/repo | ||
| echo "REPO=$GITHUB_WORKSPACE/./git-repo/repo" >> $GITHUB_ENV | ||
| - name: Clone AnyKernel3 and Other Dependencies | ||
| run: | | ||
| echo "Cloning AnyKernel3 and other dependencies..." | ||
| # Define the branch names using the matrix values | ||
| ANYKERNEL_BRANCH="android14-6.1" | ||
| SUSFS_BRANCH="gki-android14-6.1" | ||
| # Debug print the branches | ||
| echo "Using branch for AnyKernel3: $ANYKERNEL_BRANCH" | ||
| echo "Using branch for SUSFS: $SUSFS_BRANCH" | ||
| # Clone repositories using the branch names | ||
| git clone https://github.com/TheWildJames/AnyKernel3.git -b "$ANYKERNEL_BRANCH" | ||
| git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH" | ||
| git clone https://github.com/TheWildJames/kernel_patches.git | ||
| - name: Initialize and Sync Kernel Source | ||
| run: | | ||
| echo "Creating folder for configuration: $CONFIG..." | ||
| mkdir -p "$CONFIG" | ||
| cd "$CONFIG" | ||
| # Initialize and sync kernel source | ||
| echo "Initializing and syncing kernel source..." | ||
| $REPO init -u https://github.com/OnePlusOSS/kernel_manifest.git -b oneplus/sm8650 -m oneplus12_v.xml --repo-rev=v2.16 | ||
| # Sync repo and apply patches | ||
| $REPO --version | ||
| $REPO --trace sync -c -j$(nproc --all) --no-tags --fail-fast | ||
| - name: Add KernelSU | ||
| run: | | ||
| echo "Changing to configuration directory: $CONFIG..." | ||
| cd "$CONFIG/kernel_platform" | ||
| echo "Adding KernelSU..." | ||
| curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash - | ||
| cd ./KernelSU-Next/kernel | ||
| sed -i 's/ccflags-y += -DKSU_VERSION=16/ccflags-y += -DKSU_VERSION=12321/' ./Makefile | ||
| - name: Apply SUSFS Patches | ||
| run: | | ||
| echo "Changing to configuration directory: $CONFIG..." | ||
| cd "$CONFIG/kernel_platform" | ||
| echo "Applying SUSFS patches..." | ||
| # Copy SUSFS patches | ||
| cp ../../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch ./KernelSU-Next/ | ||
| cp ../../susfs4ksu/kernel_patches/50_add_susfs_in_gki-android14-6.1.patch ./common/ | ||
| cp ../../susfs4ksu/kernel_patches/fs/* ./common/fs/ | ||
| cp ../../susfs4ksu/kernel_patches/include/linux/* ./common/include/linux/ | ||
| cd ./KernelSU-Next | ||
| # Apply SUSFS patch for KernelSU | ||
| patch -p1 --forward < 10_enable_susfs_for_ksu.patch || true | ||
| # Change to common directory and apply SUSFS patch | ||
| cd ../common | ||
| patch -p1 < 50_add_susfs_in_gki-android14-6.1.patch || true | ||
| - name: Apply Next-SUSFS Patches | ||
| run: | | ||
| echo "Changing to configuration directory: $CONFIG..." | ||
| cd "$CONFIG/kernel_platform" | ||
| echo "Applying next SUSFS patches..." | ||
| cp ../../kernel_patches/apk_sign.c_fix.patch ./ | ||
| patch -p1 -F 3 < apk_sign.c_fix.patch | ||
| cp ../../kernel_patches/core_hook.c_fix.patch ./ | ||
| patch -p1 --fuzz=3 < core_hook.c_fix.patch | ||
| cp ../../kernel_patches/selinux.c_fix.patch ./ | ||
| patch -p1 -F 3 < selinux.c_fix.patch | ||
| - name: Apply Hide Stuff Patches | ||
| run: | | ||
| echo "Changing to configuration directory: $CONFIG..." | ||
| cd "$CONFIG/kernel_platform/common" | ||
| # Apply additional patch | ||
| cp ../../../kernel_patches/69_hide_stuff.patch ./ | ||
| patch -p1 -F 3 < 69_hide_stuff.patch | ||
| - name: Add SUSFS Configuration Settings | ||
| run: | | ||
| echo "Changing to configuration directory: $CONFIG..." | ||
| cd "$CONFIG/kernel_platform" | ||
| echo "Adding configuration settings to gki_defconfig..." | ||
| # Add SUSFS configuration settings | ||
| echo "CONFIG_KSU=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_SUS_OVERLAYFS=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| echo "CONFIG_KSU_SUSFS_SUS_SU=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| # Add additional tmpfs config setting | ||
| echo "CONFIG_TMPFS_XATTR=y" >> ./common/arch/arm64/configs/gki_defconfig | ||
| - name: Run sed and perl Commands | ||
| run: | | ||
| echo "Changing to configuration directory: $CONFIG..." | ||
| cd "$CONFIG/kernel_platform" | ||
| echo "Running sed commands..." | ||
| # Run sed commands for modifications | ||
| sed -i 's/check_defconfig//' ./common/build.config.gki | ||
| sed -i '$s|echo "\$res"|echo "\$res-Wild+"|' ./common/scripts/setlocalversion | ||
| sed -i "/stable_scmversion_cmd/s/-maybe-dirty//g" ./build/kernel/kleaf/impl/stamp.bzl | ||
| sed -i 's/-dirty//' ./common/scripts/setlocalversion | ||
| #sed -i '/echo "LTO $LTO "/i export LTO=thin' ./oplus/build/oplus_setup.sh | ||
| #sed -i 's/export RECOMPILE_KERNEL="1"/export RECOMPILE_KERNEL="0"/g' ./oplus/build/oplus_setup.sh | ||
| #sed -i 's/export REPACK_IMG=true/export REPACK_IMG=false/g' ./oplus/build/oplus_setup.sh | ||
| #sed -i 's/^#\(choose_lto_type \$3\|choose_target_build \$4\|choose_repack_img \$5\)/\1/' ./oplus/build/oplus_setup.sh | ||
| # Run perl command to modify UTS_VERSION | ||
| perl -pi -e 's{UTS_VERSION="\$\(echo \$UTS_VERSION \$CONFIG_FLAGS \$TIMESTAMP \| cut -b -\$UTS_LEN\)"}{UTS_VERSION="#1 SMP PREEMPT Sat Apr 20 04:20:00 UTC 2024"}' ./common/scripts/mkcompile_h | ||
| - name: Build the Kernel | ||
| run: | | ||
| echo "Changing to configuration directory: $CONFIG..." | ||
| cd "$CONFIG" | ||
| echo "Building the kernel..." | ||
| rm -rf ./kernel_platform/common/android/abi_gki_protected_exports_* | ||
| #git config --global user.email "bins4us@hotmail.com" | ||
| #git config --global user.name "TheWildJames" | ||
| #git add * | ||
| #git commit -s -a -m "getting rid of -dirty" | ||
| ./kernel_platform/oplus/build/oplus_build_kernel.sh pineapple gki | ||
| - name: Create Bootimgs Folder and Copy Images | ||
| run: | | ||
| echo "Changing to configuration directory: $CONFIG..." | ||
| cd "$CONFIG" | ||
| echo "Copying Image" | ||
| cp ./out/dist/Image ../AnyKernel3/Image | ||
| - name: Create ZIP Files for Different Formats | ||
| run: | | ||
| echo "Creating zip files for all formats..." | ||
| cd ./AnyKernel3 | ||
| ZIP_NAME="Anykernel3-OP12-A15-android14-6.1-KernelSU-SUSFS.zip" | ||
| echo "Creating zip file $ZIP_NAME..." | ||
| zip -r "../$ZIP_NAME" ./* | ||
| - name: Upload Build Artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: kernel-${{ env.CONFIG }} | ||
| path: | | ||
| *.zip | ||