From a8932a4ee54fa2526b56e97fd7edbf2a69cfed9d Mon Sep 17 00:00:00 2001 From: Amit152505 <134253885+Amit152505@users.noreply.github.com> Date: Sun, 11 Jun 2023 21:10:53 +0530 Subject: [PATCH 1/4] Add files via upload --- build.sh | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000000..4b0bcc96337b8 --- /dev/null +++ b/build.sh @@ -0,0 +1,152 @@ +#!/bin/bash + +# Defined path +MainPath="$(pwd)" +Proton="$(pwd)/../Proton" +Azure="$(pwd)/../Azure" +Any="$(pwd)/../Any" + +# Make flashable zip +MakeZip() { + if [ ! -d $Any ]; then + git clone https://github.com/Wahid7852/Anykernel.git $Any + cd $Any + else + cd $Any + git reset --hard + git checkout master + git fetch origin master + git reset --hard origin/master + fi + cp -af $MainPath/out/arch/arm64/boot/Image.gz-dtb $Any + sed -i "s/kernel.string=.*/kernel.string=$KERNEL_NAME by Abdul7852/g" anykernel.sh + zip -r9 $MainPath/"NoVA-Balance-$ZIP_KERNEL_VERSION.zip" * -x .git README.md *placeholder + cd $MainPath +} + +# Clone compiler + +Clone_Proton() { + + if [ ! -d $Proton ]; then + git clone --depth=1 https://github.com/kdrag0n/proton-clang -b master $Proton + else + cd $Proton + git fetch origin master + git checkout FETCH_HEAD + git branch -D master + git branch master && git checkout master + cd $MainPath + fi + Proton_Version="$($Proton/bin/clang --version | grep clang)" +} + +Clone_Azure() { + + if [ ! -d $Azure ]; then + git clone --depth=1 https://gitlab.com/Panchajanya1999/azure-clang.git -b main $Azure + else + cd $Azure + git fetch origin main + git checkout FETCH_HEAD + git branch -D main + git branch main && git checkout main + cd $MainPath + fi + Azure_Version="$($Azure/bin/clang --version | grep clang)" +} + +# Defined config +HeadCommit="$(git log --pretty=format:'%h' -1)" +export ARCH="arm64" +export SUBARCH="arm64" +export KBUILD_BUILD_USER="Abdul7852" +export KBUILD_BUILD_HOST="-Stable" +Defconfig="begonia_user_defconfig" +KERNEL_NAME=$(cat "$MainPath/arch/arm64/configs/$Defconfig" | grep "CONFIG_LOCALVERSION=" | sed 's/CONFIG_LOCALVERSION="-*//g' | sed 's/"*//g' ) +ZIP_KERNEL_VERSION="4.14.$(cat "$MainPath/Makefile" | grep "SUBLEVEL =" | sed 's/SUBLEVEL = *//g')" + +# Start building + +Build_Proton() { + Compiler=Proton + + rm -rf out + TIME=$(date +"%m%d%H%M") + BUILD_START=$(date +"%s") + + make -j$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig + exec 2> >(tee -a out/error.log >&2) + make -j$(nproc --all) O=out \ + PATH="$Proton/bin:/usr/bin:$PATH" \ + CC=clang \ + AS=llvm-as \ + NM=llvm-nm \ + OBJCOPY=llvm-objcopy \ + OBJDUMP=llvm-objdump \ + STRIP=llvm-strip \ + LD=ld.lld \ + CROSS_COMPILE=aarch64-linux-gnu- \ + CROSS_COMPILE_ARM32=arm-linux-gnueabi- +} + +Build_Azure() { + Compiler=Azure + + rm -rf out + TIME=$(date +"%m%d%H%M") + BUILD_START=$(date +"%s") + + make -j$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig + exec 2> >(tee -a out/error.log >&2) + make -j$(nproc --all) O=out \ + PATH="$Azure/bin:/usr/bin:$PATH" \ + CC=clang \ + LLVM=1 \ + LLVM_IAS=1 \ + AR=llvm-ar\ + NM=llvm-nm \ + OBJCOPY=llvm-objcopy \ + OBJDUMP=llvm-objdump \ + STRIP=llvm-strip \ + LD=ld.lld \ + CROSS_COMPILE=aarch64-linux-gnu- \ + CROSS_COMPILE_ARM32=arm-linux-gnueabi- +} + +# End with success or fail +End() { + if [ -e $MainPath/out/arch/arm64/boot/Image.gz-dtb ]; then + BUILD_END=$(date +"%s") + DIFF=$((BUILD_END - BUILD_START)) + MakeZip + ZIP=$(echo *$Compiler*$TIME*.zip) + + echo "Build success in : $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)" + + else + BUILD_END=$(date +"%s") + DIFF=$((BUILD_END - BUILD_START)) + + echo "Build fail in : $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)" + + fi +} + +Text="Start to build kernel" + +# Build choices + +Proton() { + + Clone_Proton + Build_Proton + End +} + +Azure() { + + Clone_Azure + Build_Azure + End +} \ No newline at end of file From 0b0a86441a94d00a3a594955c96b0ca3552f7a9e Mon Sep 17 00:00:00 2001 From: Amit152505 <134253885+Amit152505@users.noreply.github.com> Date: Sun, 11 Jun 2023 21:13:23 +0530 Subject: [PATCH 2/4] Update build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 4b0bcc96337b8..1162994106a9f 100644 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ MakeZip() { fi cp -af $MainPath/out/arch/arm64/boot/Image.gz-dtb $Any sed -i "s/kernel.string=.*/kernel.string=$KERNEL_NAME by Abdul7852/g" anykernel.sh - zip -r9 $MainPath/"NoVA-Balance-$ZIP_KERNEL_VERSION.zip" * -x .git README.md *placeholder + zip -r9 $MainPath/"Stock-Xiaomi-$ZIP_KERNEL_VERSION.zip" * -x .git README.md *placeholder cd $MainPath } @@ -149,4 +149,4 @@ Azure() { Clone_Azure Build_Azure End -} \ No newline at end of file +} From 94a49aab52381f3095834342fb73ba2b30a58e04 Mon Sep 17 00:00:00 2001 From: Amit152505 <134253885+Amit152505@users.noreply.github.com> Date: Sun, 11 Jun 2023 21:14:28 +0530 Subject: [PATCH 3/4] Update begonia_user_defconfig --- arch/arm64/configs/begonia_user_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/configs/begonia_user_defconfig b/arch/arm64/configs/begonia_user_defconfig index f239a51012376..a4e39ca86f833 100644 --- a/arch/arm64/configs/begonia_user_defconfig +++ b/arch/arm64/configs/begonia_user_defconfig @@ -481,3 +481,6 @@ CONFIG_MTK_GAMEPQ_SUPPORT=y CONFIG_BLK_WBT=y CONFIG_BLK_WBT_SQ=y CONFIG_BLK_WBT_MQ=n +CONFIG_KPROBES=y +CONFIG_HAVE_KPROBES=y +CONFIG_KPROBE_EVENTS=y From 64f9f24e2f841ae21aa65043c8c1f87b1d032afe Mon Sep 17 00:00:00 2001 From: Amit152505 <134253885+Amit152505@users.noreply.github.com> Date: Thu, 22 Jun 2023 08:32:50 +0530 Subject: [PATCH 4/4] Update build.sh --- build.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 1162994106a9f..2c4e202ad6964 100644 --- a/build.sh +++ b/build.sh @@ -9,7 +9,7 @@ Any="$(pwd)/../Any" # Make flashable zip MakeZip() { if [ ! -d $Any ]; then - git clone https://github.com/Wahid7852/Anykernel.git $Any + git clone https://github.com/Amit152505/AnyKernel.git $Any cd $Any else cd $Any @@ -19,8 +19,8 @@ MakeZip() { git reset --hard origin/master fi cp -af $MainPath/out/arch/arm64/boot/Image.gz-dtb $Any - sed -i "s/kernel.string=.*/kernel.string=$KERNEL_NAME by Abdul7852/g" anykernel.sh - zip -r9 $MainPath/"Stock-Xiaomi-$ZIP_KERNEL_VERSION.zip" * -x .git README.md *placeholder + sed -i "s/kernel.string=.*/kernel.string=$KERNEL_NAME by STOCK/g" anykernel.sh + zip -r9 $MainPath/"XIAOMI-Stock-$ZIP_KERNEL_VERSION.zip" * -x .git README.md *placeholder cd $MainPath } @@ -29,7 +29,7 @@ MakeZip() { Clone_Proton() { if [ ! -d $Proton ]; then - git clone --depth=1 https://github.com/kdrag0n/proton-clang -b master $Proton + git clone --depth=1 https://github.com/kdrag0n/proton-clang.git -b master $Proton else cd $Proton git fetch origin master @@ -60,7 +60,7 @@ Clone_Azure() { HeadCommit="$(git log --pretty=format:'%h' -1)" export ARCH="arm64" export SUBARCH="arm64" -export KBUILD_BUILD_USER="Abdul7852" +export KBUILD_BUILD_USER="AmitBN" export KBUILD_BUILD_HOST="-Stable" Defconfig="begonia_user_defconfig" KERNEL_NAME=$(cat "$MainPath/arch/arm64/configs/$Defconfig" | grep "CONFIG_LOCALVERSION=" | sed 's/CONFIG_LOCALVERSION="-*//g' | sed 's/"*//g' ) @@ -75,9 +75,9 @@ Build_Proton() { TIME=$(date +"%m%d%H%M") BUILD_START=$(date +"%s") - make -j$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig + make -j8$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig exec 2> >(tee -a out/error.log >&2) - make -j$(nproc --all) O=out \ + make -j8$(nproc --all) O=out \ PATH="$Proton/bin:/usr/bin:$PATH" \ CC=clang \ AS=llvm-as \ @@ -97,9 +97,9 @@ Build_Azure() { TIME=$(date +"%m%d%H%M") BUILD_START=$(date +"%s") - make -j$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig + make -j8$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig exec 2> >(tee -a out/error.log >&2) - make -j$(nproc --all) O=out \ + make -j8$(nproc --all) O=out \ PATH="$Azure/bin:/usr/bin:$PATH" \ CC=clang \ LLVM=1 \