diff --git a/.github/workflows/Miui.yml b/.github/workflows/Miui.yml index 6ce33d0fcf4c..a42c69de320a 100644 --- a/.github/workflows/Miui.yml +++ b/.github/workflows/Miui.yml @@ -1,4 +1,4 @@ -name: MiuiQ-ksu +name: test1 on: @@ -13,35 +13,63 @@ jobs: - name: Setup environment run: | sudo apt install python2 -y - echo "BUILD_TIME=$(TZ=Asia/Jakarta date "+%H-%M~%d_%m_%Y")" >> $GITHUB_ENV - echo "TIME=$(TZ=Asia/Jakarta date "+%d_%m_%Y")" >> $GITHUB_ENV + echo "BUILD_TIME=$(TZ=Asia/Jakarta date "+%H-%M_%d-%m-%Y")" >> $GITHUB_ENV + echo "KERNEL_VERSION="$(cat arch/arm64/configs/vendor/ginkgo-perf_defconfig | grep "CONFIG_LOCALVERSION\=" | sed -r 's/.*"(.+)".*/\1/' | sed 's/^.//')"" >> $GITHUB_ENV + export TC_DIR="$GITHUB_WORKSPACE/toolchain/linux-x86" + export CLANG_DIR="$GITHUB_WORKSPACE/toolchain/linux-x86/clang-r510928" + export GCC_64_DIR="$GITHUB_WORKSPACE/toolchain/aarch64-linux-android-4.9" + export GCC_32_DIR="$GITHUB_WORKSPACE/toolchain/arm-linux-androideabi-4.9" + export PATH="$CLANG_DIR/bin:$PATH" + - name: Pull toolchain - run: | - mkdir clang && git clone -b clang-12.0 https://github.com/roniwae/RastaMod69-Clang.git clang --depth=1 - - name: Pull kernel source - run: | - git clone --depth=1 https://github.com/roniwae/MiuiKernel.git -b MiuiQ-ksu kernel-source - echo "KERNEL_VERSION="$(cat kernel-source/arch/arm64/configs/vendor/ginkgo-perf_defconfig | grep "CONFIG_LOCALVERSION\=" | sed -r 's/.*"(.+)".*/\1/' | sed 's/^.//')"" >> $GITHUB_ENV + run: | + if ! [ -d "${CLANG_DIR}" ]; then + echo "Clang not found! Cloning to ${TC_DIR}..." + if ! git clone --depth=1 https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86 ${TC_DIR}; then + echo "Cloning failed! Aborting..." + exit 1 + fi + fi + + if ! [ -d "${GCC_64_DIR}" ]; then + echo "gcc not found! Cloning to ${GCC_64_DIR}..." + if ! git clone --depth=1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 ${GCC_64_DIR}; then + echo "Cloning failed! Aborting..." + exit 1 + fi + fi + + if ! [ -d "${GCC_32_DIR}" ]; then + echo "gcc_32 not found! Cloning to ${GCC_32_DIR}..." + if ! git clone --depth=1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9 ${GCC_32_DIR}; then + echo "Cloning failed! Aborting..." + exit 1 + fi + fi - name: Build kernel run: | + curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash - export KBUILD_BUILD_USER="@roni_saja" export KBUILD_BUILD_HOST="AmateurMan" - export PATH=$GITHUB_WORKSPACE/clang/bin:${PATH} args=" ARCH=arm64 \ - O=../out \ - CC=clang - LD=ld.lld + O=out \ + CC=clang \ + LD=ld.lld\ + AR=llvm-ar \ + AS=llvm-as \ + NM=llvm-nm \ + OBJCOPY=llvm-objcopy \ + OBJDUMP=llvm-objdump \ + STRIP=llvm-strip \ CLANG_TRIPLE=aarch64-linux-gnu- \ - CROSS_COMPILE=$GITHUB_WORKSPACE/clang/bin/aarch64-linux-gnu- \ - CROSS_COMPILE_ARM32=$GITHUB_WORKSPACE/clang/bin/arm-linux-gnueabi- " - cd kernel-source - curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash - + CROSS_COMPILE=$GCC_64_DIR/bin/aarch64-linux-android- \ + CROSS_COMPILE_ARM32=$GCC_32_DIR/bin/arm-linux-androideabi- " make ${args} vendor/ginkgo-perf_defconfig make -j$(($(getconf _NPROCESSORS_ONLN) * 2)) ${args} - name: Package kernel run: | - git clone --depth=1 https://github.com/roniwae/AnyKernel3.git -b MIUI AnyKernel3 && rm -rf AnyKernel3/.git AnyKernel3/.github AnyKernel3/LICENSE AnyKernel3/README.md + git clone --depth=1 https://github.com/roniwae/AnyKernel3.git -b MIUI AnyKernel3 && rm -rf AnyKernel3/.git AnyKernel3/.github AnyKernel3/README.md if [[ -f out/arch/arm64/boot/Image.gz-dtb ]]; then cp out/arch/arm64/boot/Image.gz-dtb AnyKernel3/Image.gz-dtb elif [[ -f out/arch/arm64/boot/Image-dtb ]]; then @@ -57,5 +85,5 @@ jobs: - name: Upload kernel to artifact uses: actions/upload-artifact@v3 with: - name: Ryzen-MiuiQ-ksu-${{ env.BUILD_TIME }} + name: ${{ env.KERNEL_VERSION }}-${{ env.BUILD_TIME }} path: AnyKernel3/*