Build Nameless OPlus SM8250 Kernel #14
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 Nameless OPlus SM8250 Kernel | |
| on: | |
| workflow_dispatch: | |
| env: | |
| TZ: Asia/Shanghai | |
| jobs: | |
| build: | |
| name: Build Kernel by ${{ github.actor }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set swap to 10G | |
| uses: pierotofy/set-swap-space@master | |
| with: | |
| swap-size-gb: 10 | |
| - name: Setup build kernel environment | |
| run: | | |
| echo "BUILD_TIME=$(TZ=Asia/Shanghai date "+%y%m%d")" >> $GITHUB_ENV | |
| echo "BUILD_TIME_1=$(TZ=Asia/Shanghai date "+%Y-%m-%d")" >> $GITHUB_ENV | |
| sudo apt-get update | |
| sudo apt-get install git ccache automake flex lzop bison gperf build-essential zip curl zlib1g-dev g++-multilib libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven libssl-dev pwgen libswitch-perl policycoreutils minicom libxml-sax-base-perl libxml-simple-perl bc libc6-dev-i386 lib32ncurses5-dev libx11-dev lib32z-dev libgl1-mesa-dev xsltproc unzip device-tree-compiler python2 python3 | |
| mkdir -p $GITHUB_WORKSPACE/kernel_workspace | |
| - name: Download Clang-aosp | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace | |
| mkdir clang-aosp | |
| wget https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/refs/heads/main/clang-r522817.tar.gz | |
| tar -C clang-aosp/ -zxvf clang-r522817.tar.gz | |
| - name: Download Gcc-aosp | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace | |
| mkdir gcc-64 | |
| wget -O gcc-aarch64.tar.gz https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/+archive/refs/tags/android-12.1.0_r27.tar.gz | |
| tar -C gcc-64/ -zxvf gcc-aarch64.tar.gz | |
| - name: Download kernel source | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace | |
| git clone --recursive https://github.com/Nameless-AOSP-OSS/kernel_oneplus_sm8250 -b fifteen android-kernel --depth=1 | |
| cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel/scripts | |
| sed -i 's/ -dirty//g' setlocalversion | |
| cd $GITHUB_WORKSPACE/patches | |
| sed -i '1655 r path_umount.c' $GITHUB_WORKSPACE/kernel_workspace/android-kernel/fs/namespace.c | |
| - name: Setup official KernelSU | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
| curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.9.5 | |
| KSU_VERSION=$(cd KernelSU && expr $(/usr/bin/git rev-list --count HEAD) + 10200) | |
| echo "KSUVER=$KSU_VERSION" >> $GITHUB_ENV | |
| - name: Build kernel with official KernelSU | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
| export ARCH=arm64 | |
| export SUBARCH=arm64 | |
| export BRAND_SHOW_FLAG=oneplus | |
| export PATH=$GITHUB_WORKSPACE/kernel_workspace/clang-aosp/bin:$GITHUB_WORKSPACE/kernel_workspace/gcc-64/bin:$PATH | |
| export KBUILD_BUILD_HOST=Github-Action | |
| export KBUILD_BUILD_USER=$(echo ${{ github.actor }} | tr A-Z a-z) | |
| BA_CMD="CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android-" | |
| EX_CMD="LD=ld.lld LLVM=1 LLVM_IAS=1" | |
| DEFCONFIG="vendor/kona-perf_defconfig vendor/debugfs.config" | |
| make O=out ARCH=arm64 CC=clang $BA_CMD $EX_CMD $DEFCONFIG | |
| make -j$(nproc --all) O=out ARCH=arm64 CC=clang $BA_CMD $EX_CMD | |
| - name: Check a kernel output files with official KernelSU | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace | |
| if [ -f android-kernel/out/arch/arm64/boot/Image ]; then | |
| echo "CHECK_IMAGE=true" >> $GITHUB_ENV | |
| else | |
| echo "Kernel output file is empty" | |
| exit 1 | |
| fi | |
| - name: Make AnyKernel3 with official KernelSU | |
| if: env.CHECK_IMAGE == 'true' | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace | |
| git clone https://github.com/osm0sis/AnyKernel3 --depth=1 AnyKernel3 | |
| sed -i 's/do.devicecheck=1/do.devicecheck=0/g' AnyKernel3/anykernel.sh | |
| sed -i 's!BLOCK=/dev/block/platform/omap/omap_hsmmc.0/by-name/boot;!BLOCK=auto;!g' AnyKernel3/anykernel.sh | |
| sed -i 's/IS_SLOT_DEVICE=0;/IS_SLOT_DEVICE=auto;/g' AnyKernel3/anykernel.sh | |
| cp android-kernel/out/arch/arm64/boot/Image AnyKernel3/ | |
| rm -rf AnyKernel3/.git* AnyKernel3/README.md | |
| - name: Compress AnyKernel3 with official KernelSU folder to zip | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace/AnyKernel3 | |
| zip -r $GITHUB_WORKSPACE/AK3-Nameless-OPlus-SM8250-Official-KSU_${{ env.KSUVER }}-${{ env.BUILD_TIME }}.zip ./* | |
| - name: Upload Image | |
| if: env.CHECK_IMAGE == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Image-Official-KSU_${{ env.KSUVER }} | |
| path: kernel_workspace/android-kernel/out/arch/arm64/boot/Image | |
| - name: Upload AnyKernel3 | |
| if: env.CHECK_IMAGE == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: AK3-Nameless-OPlus-SM8250-Official-KSU_${{ env.KSUVER }}-${{ env.BUILD_TIME }} | |
| path: kernel_workspace/AnyKernel3/* | |
| - name: Setup unofficial KernelSU | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
| rm -rf KernelSU | |
| rm -rf drivers/kernelsu | |
| curl -LSs "https://raw.githubusercontent.com/backslashxx/KernelSU/magic/kernel/setup.sh" | bash -s magic | |
| KSU_VERSION_1=$(cd KernelSU && expr $(/usr/bin/git rev-list --count HEAD) + 10174) | |
| echo "KSUVER_1=$KSU_VERSION_1" >> $GITHUB_ENV | |
| - name: Build kernel with unofficial KernelSU | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace/android-kernel | |
| rm -rf out/arch/arm64/boot/Image | |
| export ARCH=arm64 | |
| export SUBARCH=arm64 | |
| export BRAND_SHOW_FLAG=oneplus | |
| export PATH=$GITHUB_WORKSPACE/kernel_workspace/clang-aosp/bin:$GITHUB_WORKSPACE/kernel_workspace/gcc-64/bin:$PATH | |
| export KBUILD_BUILD_HOST=Github-Action | |
| export KBUILD_BUILD_USER=$(echo ${{ github.actor }} | tr A-Z a-z) | |
| BA_CMD="CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android-" | |
| EX_CMD="LD=ld.lld LLVM=1 LLVM_IAS=1" | |
| DEFCONFIG="vendor/kona-perf_defconfig vendor/debugfs.config" | |
| make O=out ARCH=arm64 CC=clang $BA_CMD $EX_CMD $DEFCONFIG | |
| make -j$(nproc --all) O=out ARCH=arm64 CC=clang $BA_CMD $EX_CMD | |
| - name: Check a kernel output files with unofficial KernelSU | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace | |
| if [ -f android-kernel/out/arch/arm64/boot/Image ]; then | |
| echo "CHECK_IMAGE_1=true" >> $GITHUB_ENV | |
| else | |
| echo "Kernel output file is empty" | |
| exit 1 | |
| fi | |
| - name: Make AnyKernel3 with unofficial KernelSU | |
| if: env.CHECK_IMAGE_1 == 'true' | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace | |
| rm -rf AnyKernel3/Image | |
| cp android-kernel/out/arch/arm64/boot/Image AnyKernel3/ | |
| - name: Compress AnyKernel3 with unofficial KernelSU folder to zip | |
| run: | | |
| cd $GITHUB_WORKSPACE/kernel_workspace/AnyKernel3 | |
| zip -r $GITHUB_WORKSPACE/AK3-Nameless-OPlus-SM8250-Unofficial-KSU_${{ env.KSUVER_1 }}-${{ env.BUILD_TIME }}.zip ./* | |
| - name: Upload Image | |
| if: env.CHECK_IMAGE_1 == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Image-Unofficial-KSU_${{ env.KSUVER_1 }} | |
| path: kernel_workspace/android-kernel/out/arch/arm64/boot/Image | |
| - name: Upload AnyKernel3 | |
| if: env.CHECK_IMAGE_1 == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: AK3-Nameless-OPlus-SM8250-Unofficial-KSU_${{ env.KSUVER_1 }}-${{ env.BUILD_TIME }} | |
| path: kernel_workspace/AnyKernel3/* | |
| - name: Send AnyKernel3 to Telegram | |
| env: | |
| TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
| TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }} | |
| run: | | |
| caption1="\ | |
| <blockquote><a href=\"https://github.com/tiann/KernelSU/tree/v0.9.5\"><b>Official KernelSU</b> - ${{ env.KSUVER }}</a></blockquote>" | |
| caption2="\ | |
| <blockquote><a href=\"https://github.com/backslashxx/KernelSU\"><b>Unofficial KernelSU</b> - ${{ env.KSUVER_1 }}</a></blockquote> | |
| ROM:<blockquote><b>Nameless-CLO 15</b> - <a href=\"https://t.me/NamelessUpdates/186\">Dec 2024 update</a></blockquote> | |
| Device:<blockquote>OnePlus 8 | OnePlus 8 Pro | OnePlus 8T | OnePlus 9R</blockquote> | |
| Build Time:<blockquote>${{ env.BUILD_TIME_1 }}</blockquote> | |
| Special Note: | |
| <blockquote>The official version requires installing the <a href=\"https://t.me/KernelSU_group/3234/290349\">manager version 11948</a> or an earlier version</blockquote> | |
| <blockquote>The unofficial version is recommended to install an <a href=\"https://github.com/backslashxx/KernelSU/actions/runs/12525967084\">unofficial manager</a></blockquote> | |
| Change Log:<blockquote>Change to using the unofficial KernelSU fork by backslashxx. You need to uninstall the original one and then reinstall the manager.</blockquote> | |
| <a href=\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\">Github Action</a>" | |
| media=$(jq -n \ | |
| --arg media1 "attach://official" \ | |
| --arg caption1 "$caption1" \ | |
| --arg media2 "attach://unofficial" \ | |
| --arg caption2 "$caption2" \ | |
| '[{type: "document", media: $media1, caption: $caption1, parse_mode: "HTML"}, | |
| {type: "document", media: $media2, caption: $caption2, parse_mode: "HTML"}]') | |
| curl "https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMediaGroup?chat_id=$TELEGRAM_CHAT_ID" \ | |
| -F "media=$media" \ | |
| -F official="@$GITHUB_WORKSPACE/AK3-Nameless-OPlus-SM8250-Official-KSU_${{ env.KSUVER }}-${{ env.BUILD_TIME }}.zip" \ | |
| -F unofficial="@$GITHUB_WORKSPACE/AK3-Nameless-OPlus-SM8250-Unofficial-KSU_${{ env.KSUVER_1 }}-${{ env.BUILD_TIME }}.zip" |