Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #4241

Open
wants to merge 4 commits into
base: begonia-r-oss
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions arch/arm64/configs/begonia_user_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
152 changes: 152 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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/Amit152505/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 STOCK/g" anykernel.sh
zip -r9 $MainPath/"XIAOMI-Stock-$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.git -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="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' )
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 -j8$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig
exec 2> >(tee -a out/error.log >&2)
make -j8$(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 -j8$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig
exec 2> >(tee -a out/error.log >&2)
make -j8$(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
}