Created
August 18, 2018 15:08
-
-
Save VRanger/dd2da6956fe1acd9d52d8c4d4dfc48e9 to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env bash | |
| export KERNELDIR=${HOME}/Kernel | |
| export CONFIG_FILE="santoni_defconfig" | |
| export ARCH=arm64 | |
| export SUBARCH=arm64 | |
| export KBUILD_BUILD_USER="Gabriel" | |
| export KBUILD_BUILD_HOST="root" | |
| #export ARM64GCC="${KERNELDIR}/toolchains/aarch64-linux-gnu/bin/aarch64-linux-gnu-" | |
| export ARM64GCC="$HOME/gcc/bin/aarch64-opt-linux-android-" | |
| export CLANG_TCHAIN="$HOME/clang/bin/clang" | |
| export CLANG_LD_PATH="${CLANG_TCHAIN}/lib64" | |
| export OUTDIR="${KERNELDIR}/out/" | |
| export builddir="${KERNELDIR}/Builds" | |
| export DTBTOOL="${KERNELDIR}/Dtbtool" | |
| export ANY_KERNEL2_DIR="${KERNELDIR}/AnyKernel2" | |
| export ZIP_NAME="Gabriel-Clang_$(git rev-parse --abbrev-ref HEAD).zip" | |
| export IMAGE="${OUTDIR}arch/arm64/boot/Image.gz"; | |
| export BOT_API_KEY=605544093:AAGss2_5K8qIi97CW5sJ6XWjT1DomYQUh08 | |
| export CHAT_ID=@rexkn | |
| CLANG_VERSION=$(${CLANG_TCHAIN} --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g' -e 's/[[:space:]]*$//') | |
| JOBS="-j$(($(nproc --all) + 1))" | |
| cd $KERNELDIR | |
| make_a_fucking_defconfig() { | |
| make O=${OUTDIR} $CONFIG_FILE | |
| } | |
| compile() { | |
| LD_LIBRARY_PATH="${CLANG_LD_PATH}:${LD_LIBARY_PATH}" make \ | |
| O="${OUTDIR}" \ | |
| CC="${CLANG_TCHAIN}" \ | |
| CROSS_COMPILE="${ARM64GCC}" \ | |
| HOSTCC="${CLANG_TCHAIN}" \ | |
| KBUILD_COMPILER_STRING="${CLANG_VERSION}" \ | |
| "${JOBS}" | |
| } | |
| zipit () { | |
| if [[ ! -f "${IMAGE}" ]]; then | |
| echo -e "Build failed :P"; | |
| exit 1; | |
| else | |
| echo -e "Build Succesful!"; | |
| fi | |
| echo "**** Copying zImage ****" | |
| cp ${OUTDIR}arch/arm64/boot/Image.gz ${ANY_KERNEL2_DIR}/ | |
| echo "**** Copying dtb ****" | |
| cp ${OUTDIR}arch/arm64/boot/dtb ${ANY_KERNEL2_DIR}/ | |
| cd ${ANY_KERNEL2_DIR}/ | |
| zip -r9 ${ZIP_NAME} * -x README ${ZIP_NAME} | |
| rm -rf ${KERNELDIR}/Builds/${ZIP_NAME} | |
| cp ${ANY_KERNEL2_DIR}/${ZIP_NAME} ${KERNELDIR}/Builds/${ZIP_NAME} | |
| } | |
| deploy() { | |
| curl -s -X POST https://api.telegram.org/bot$BOT_API_KEY/sendMessage -d text="Informations:" -d chat_id=$CHAT_ID | |
| curl -s -X POST https://api.telegram.org/bot$BOT_API_KEY/sendMessage -d text="Device: Potter" -d chat_id=$CHAT_ID | |
| curl -s -X POST https://api.telegram.org/bot$BOT_API_KEY/sendMessage -d text="Branch: $(git rev-parse --abbrev-ref HEAD)" -d chat_id=$CHAT_ID | |
| curl -s -X POST https://api.telegram.org/bot$BOT_API_KEY/sendMessage -d text="Commit: $(git log --pretty=format:'%h : %s' -1)" -d chat_id=$CHAT_ID | |
| curl -s -X POST https://api.telegram.org/bot$BOT_API_KEY/sendMessage -d text="Download:" -d chat_id=$CHAT_ID | |
| curl -F chat_id="$CHAT_ID" -F document=@"$PWD/$ZIP_NAME" https://api.telegram.org/bot$BOT_API_KEY/sendDocument | |
| } | |
| make_a_fucking_defconfig | |
| compile | |
| zipit | |
| deploy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment