diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 1546d9f..34dbb9b 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -10,19 +10,31 @@ on: KERNEL_TREE: description: 'Kernel tree URL' required: true - default: 'https://github.com/cd-Crypton/android_kernel_realme_sm6225' + default: 'https://github.com/carlodandan/android_kernel_realme_sm6225' KERNEL_BRANCH: description: 'Kernel tree Branch' required: true - default: 'android13-staging' + default: 'lineage-21' KERNEL_DEFCONFIG: description: 'Kernel defconfig' required: true - default: 'vendor/bengal-perf_defconfig' + default: 'vendor/sm6225-perf_defconfig' KERNEL_IMAGE_NAME: description: 'Kernel image name' required: true default: 'Image.gz' + LLVM_IAS: + description: 'Use Integrated Assembler?' + required: true + type: choice + default: 'LLVM_IAS=1' + options: + - LLVM_IAS=1 + - LLVM_IAS=0 + EXTRA_CMDS: + description: '(Optional) Extra command separated by a space to be passed directly to make (leave blank if not using).' + type: string + required: false jobs: build: @@ -33,41 +45,47 @@ jobs: contents: write steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Packages run: | 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 device-tree-compiler + sudo apt-get install bison flex rsync bison device-tree-compiler bc cpio -y - name: Setup Proton run: | mkdir -p android && cd android git config --global advice.detachedHead false - git clone --depth=1 https://github.com/kdrag0n/proton-clang -b ${{ github.event.inputs.PROTON_RELEASE }} ./toolchains/proton-clang + git clone --depth=1 https://github.com/kdrag0n/proton-clang -b ${{ inputs.PROTON_RELEASE }} ./toolchains/proton-clang - name: Clone Kernel Tree run: | cd android - git clone --depth=1 ${{ github.event.inputs.KERNEL_TREE }} -b ${{ github.event.inputs.KERNEL_BRANCH }} ./kernel + git clone --depth=1 ${{ inputs.KERNEL_TREE }} -b ${{ inputs.KERNEL_BRANCH }} ./kernel - name: Set Properties run: | - echo "MAKE=$(cat make.txt)" >> $GITHUB_ENV - echo "ADD=$(cat add.txt)" >> $GITHUB_ENV echo "BUILD_DATE=$(TZ=Asia/Manila date +%Y%m%d)" >> $GITHUB_ENV - name: Build Kernel run: | - PATH="${GITHUB_WORKSPACE}/android/toolchains/proton-clang/bin:/bin:$PATH" cd android/kernel - ${{ env.MAKE }} ${{ env.ADD }} ${{ github.event.inputs.KERNEL_DEFCONFIG }} - ${{ env.MAKE }} ${{ env.ADD }} -j"$(nproc --all)" + export PATH="${GITHUB_WORKSPACE}/android/toolchains/proton-clang/bin:$PATH" + export ARCH=arm64 + export CROSS_COMPILE=aarch64-linux-gnu- + export CROSS_COMPILE_COMPAT=arm-linux-gnueabi- + if [ -z ${{ inputs.EXTRA_CMDS }} ]; then + make -j$(nproc --all) CC=clang O=out LD=ld.lld LLVM=1 ${{ inputs.LLVM_IAS }} ${{ inputs.KERNEL_DEFCONFIG }} + make -j$(nproc --all) CC=clang O=out LD=ld.lld LLVM=1 ${{ inputs.LLVM_IAS }} + else + make -j$(nproc --all) CC=clang O=out LD=ld.lld LLVM=1 ${{ inputs.LLVM_IAS }} ${{ inputs.EXTRA_CMDS }} ${{ inputs.KERNEL_DEFCONFIG }} + make -j$(nproc --all) CC=clang O=out LD=ld.lld LLVM=1 ${{ inputs.LLVM_IAS }} ${{ inputs.EXTRA_CMDS }} + fi - name: Check Kernel run: | cd android - if [ -f kernel/out/arch/arm64/boot/${{ github.event.inputs.KERNEL_IMAGE_NAME }} ]; then + if [ -f kernel/out/arch/arm64/boot/${{ inputs.KERNEL_IMAGE_NAME }} ]; then echo "KERNEL_IS_OK=true" >> $GITHUB_ENV echo "KERNEL_VERSION=$(cat kernel/out/include/config/kernel.release)" >> $GITHUB_ENV else @@ -80,21 +98,22 @@ jobs: run: | cd android git clone --depth=1 https://github.com/cd-Crypton/AnyKernel3.git -b FOR-ALL - cd kernel/out/arch/arm64/boot && cp -r ${{ github.event.inputs.KERNEL_IMAGE_NAME }} ${GITHUB_WORKSPACE}/android/AnyKernel3 - cd ${GITHUB_WORKSPACE}/android/AnyKernel3 - zip -r9 UPDATE-AnyKernel3-${{ env.BUILD_DATE }}.zip * -x .git README.md *placeholder + cp -nf kernel/out/arch/arm64/boot/${{ inputs.KERNEL_IMAGE_NAME }} ${GITHUB_WORKSPACE}/android/AnyKernel3 + cp -nf $(find kernel/out -name '*.ko') ${GITHUB_WORKSPACE}/android/AnyKernel3/modules/system/lib/modules/ + cd AnyKernel3/ + zip -r9 UPDATE-AnyKernel3-${{ env.BUILD_DATE }}-proton.zip * -x .git README.md *placeholder - name: Upload to Release if: env.KERNEL_IS_OK == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | - android/kernel/out/arch/arm64/boot/${{ github.event.inputs.KERNEL_IMAGE_NAME }} - android/AnyKernel3/UPDATE-AnyKernel3-${{ env.BUILD_DATE }}.zip + android/kernel/out/arch/arm64/boot/${{ inputs.KERNEL_IMAGE_NAME }} + android/AnyKernel3/UPDATE-AnyKernel3-${{ env.BUILD_DATE }}-proton.zip name: Proton Kernel Build | ${{ env.KERNEL_VERSION }} | ${{ env.BUILD_DATE }} tag_name: ${{ github.run_id }} body: | ### Notes - * Kernel were built/compiled using proton-clang. + * Kernel were built/compiled using [proton-clang](https://github.com/kdrag0n/proton-clang/tree/${{ inputs.PROTON_RELEASE }}). * Test at your own risk. - * Use kernel flasher or any custom recoveries to flash the compressed kernel zip file. + * Use kernel flasher or any custom recoveries to flash the compressed kernel zip file. \ No newline at end of file diff --git a/add.txt b/add.txt deleted file mode 100644 index 2904a27..0000000 --- a/add.txt +++ /dev/null @@ -1 +0,0 @@ -DEPMOD=depmod KCFLAGS="${KCFLAGS} -D__ANDROID_COMMON_KERNEL__" STOP_SHIP_TRACEPRINTK=1 IN_KERNEL_MODULES=1 KMI_GENERATION=2 diff --git a/make.txt b/make.txt deleted file mode 100644 index 32d59b9..0000000 --- a/make.txt +++ /dev/null @@ -1 +0,0 @@ -make O=out ARCH=arm64 CC=clang LD=ld.lld LLVM=1 CROSS_COMPILE=aarch64-linux-gnu CROSS_COMPILE_COMPAT=arm-linux-gnueabi