From d3cac4b5ffffeabaa45971bee8730672dd451682 Mon Sep 17 00:00:00 2001 From: UtsavBalar1231 Date: Sun, 30 Aug 2020 00:33:03 +0530 Subject: [PATCH] scripts: refactor for new enviroment - boi has a VM now Signed-off-by: UtsavBalar1231 --- build-lld | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ build-lto | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ build-lto.sh | 43 ------------------------------ build.sh | 40 ---------------------------- 4 files changed, 150 insertions(+), 83 deletions(-) create mode 100755 build-lld create mode 100755 build-lto delete mode 100644 build-lto.sh delete mode 100644 build.sh diff --git a/build-lld b/build-lld new file mode 100755 index 000000000000..bd3edac05912 --- /dev/null +++ b/build-lld @@ -0,0 +1,75 @@ +#!/bin/bash + +# HOME path +HOME=/home/utsavthecunt +# Kernel Output +OUT_DIR=out/ + +DATE=$(date +"%d.%m.%y") +ZIPNAME=IMMENSiTY-AUTO-RAPHAEL-LOSFOD-${DATE}.zip + +make ARCH=arm64 \ + O=${OUT_DIR} \ + raphael_defconfig \ + -j6 + +# Enable LLD +scripts/config --file ${OUT_DIR}/.config \ + -d LTO \ + -d LTO_CLANG \ + -e SHADOW_CALL_STACK \ + -e TOOLS_SUPPORT_RELR \ + -e LD_LLD + +# Make olddefconfig +cd ${OUT_DIR} +make O=${OUT_DIR} \ + ARCH=arm64 \ + olddefconfig +cd ../ + +# Set compiler PATH +PATH=${HOME}/proton-clang/bin/:$PATH + +# Let's build +START=$(date +"%s") + +make ARCH=arm64 \ + O=${OUT_DIR} \ + CC="ccache clang" \ + LD="ld.lld" \ + AR="llvm-ar" \ + NM="llvm-nm" \ + OBJCOPY="llvm-objcopy" \ + OBJDUMP="llvm-objdump" \ + STRIP="llvm-strip" \ + CLANG_TRIPLE="aarch64-linux-gnu-" \ + CROSS_COMPILE="aarch64-linux-gnu-" \ + CROSS_COMPILE_ARM32="arm-linux-gnueabi-" \ + -j6 + +# Import Anykernel3 folder +cp -r ${HOME}/anykernel $(pwd)/ +cp $(pwd)/${OUT_DIR}/arch/arm64/boot/Image.gz-dtb $(pwd)/anykernel/ +cp $(pwd)/${OUT_DIR}/arch/arm64/boot/dtbo.img $(pwd)/anykernel/ + +cd anykernel +zip -r9 ${ZIPNAME} * +CHECKER=$(ls -l ${ZIPNAME} | awk '{print $5}') +if (($((CHECKER / 1048576)) > 5)); then + gdrive upload ${ZIPNAME} +else + echo -e '\033[01;31m' "kernel compilation unsuccesfull" + exit 1; +fi +cd ../ + +# Cleanup +rm -fr anykernel/ +rm ${OUT_DIR}/.version +rm ${OUT_DIR}/arch/arm64/boot/Image.gz-dtb +rm ${OUT_DIR}/arch/arm64/boot/dtbo.img + +END=$(date +"%s") +DIFF=$(( END - START)) +echo -e '\033[01;32m' "Kernel compiled successfully in $((DIFF / 60)) minute(s) and $((DIFF % 60)) seconds" diff --git a/build-lto b/build-lto new file mode 100755 index 000000000000..3a403541270c --- /dev/null +++ b/build-lto @@ -0,0 +1,75 @@ +#!/bin/bash + +# HOME path +HOME=/home/utsavthecunt +# Kernel Output +OUT_DIR=out/ + +DATE=$(date +"%d.%m.%y") +ZIPNAME=IMMENSiTY-AUTO-RAPHAEL-LOSFOD-${DATE}.zip + +make ARCH=arm64 \ + O=${OUT_DIR} \ + raphael_defconfig \ + -j6 + +# Enable LLD + LTO +scripts/config --file ${OUT_DIR}/.config \ + -e LTO \ + -e LTO_CLANG \ + -e SHADOW_CALL_STACK \ + -e TOOLS_SUPPORT_RELR \ + -e LD_LLD + +# Make olddefconfig +cd ${OUT_DIR} +make O=${OUT_DIR} \ + ARCH=arm64 \ + olddefconfig +cd ../ + +# Set compiler PATH +PATH=${HOME}/proton-clang/bin/:$PATH + +# Let's build +START=$(date +"%s") + +make ARCH=arm64 \ + O=${OUT_DIR} \ + CC="ccache clang" \ + LD="ld.lld" \ + AR="llvm-ar" \ + NM="llvm-nm" \ + OBJCOPY="llvm-objcopy" \ + OBJDUMP="llvm-objdump" \ + STRIP="llvm-strip" \ + CLANG_TRIPLE="aarch64-linux-gnu-" \ + CROSS_COMPILE="aarch64-linux-gnu-" \ + CROSS_COMPILE_ARM32="arm-linux-gnueabi-" \ + -j6 + +# Import Anykernel3 folder +cp -r ${HOME}/anykernel $(pwd)/ +cp $(pwd)/${OUT_DIR}/arch/arm64/boot/Image.gz-dtb $(pwd)/anykernel/ +cp $(pwd)/${OUT_DIR}/arch/arm64/boot/dtbo.img $(pwd)/anykernel/ + +cd anykernel +zip -r9 ${ZIPNAME} * +CHECKER=$(ls -l ${ZIPNAME} | awk '{print $5}') +if (($((CHECKER / 1048576)) > 5)); then + gdrive upload ${ZIPNAME} +else + echo -e '\033[01;31m' "kernel compilation unsuccesfull" + exit 1; +fi +cd ../ + +# Cleanup +rm -fr anykernel/ +rm ${OUT_DIR}/.version +rm ${OUT_DIR}/arch/arm64/boot/Image.gz-dtb +rm ${OUT_DIR}/arch/arm64/boot/dtbo.img + +END=$(date +"%s") +DIFF=$(( END - START)) +echo -e '\033[01;32m' "Kernel compiled successfully in $((DIFF / 60)) minute(s) and $((DIFF % 60)) seconds" diff --git a/build-lto.sh b/build-lto.sh deleted file mode 100644 index 2b4268b4de10..000000000000 --- a/build-lto.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -OUT_DIR=out/ - -export KBUILD_BUILD_HOST=CuntsSpace - -make ARCH=arm64 \ - O=${OUT_DIR} \ - raphael_defconfig \ - -j8 - -scripts/config --file ${OUT_DIR}/.config \ - -e LTO \ - -e LTO_CLANG \ - -e SHADOW_CALL_STACK \ - -e TOOLS_SUPPORT_RELR \ - -e LD_LLD - -cd ${OUT_DIR} -make O=${OUT_DIR} \ - ARCH=arm64 \ - olddefconfig -cd ../ - -PATH=/home/utsavthecunt/proton-clang/bin/:$PATH - -make ARCH=arm64 \ - O=${OUT_DIR} \ - CC="ccache clang" \ - LLVM_IAS=1 \ - LD="ld.lld" \ - AR="llvm-ar" \ - NM="llvm-nm" \ - OBJCOPY="llvm-objcopy" \ - OBJDUMP="llvm-objdump" \ - OBJSIZE="llvm-size" \ - READELF="llvm-readelf" \ - STRIP="llvm-strip" \ - CLANG_TRIPLE="aarch64-linux-gnu-" \ - CROSS_COMPILE="aarch64-linux-gnu-" \ - CROSS_COMPILE_ARM32="arm-linux-gnueabi-" \ - -j8 - -rm ${OUT_DIR}/.version diff --git a/build.sh b/build.sh deleted file mode 100644 index 0ddef5fe0729..000000000000 --- a/build.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -OUT_DIR=out/ - -export KBUILD_BUILD_HOST=CuntsSpace - -make ARCH=arm64 \ - O=${OUT_DIR} \ - raphael_defconfig \ - -j8 - -scripts/config --file ${OUT_DIR}/.config \ - -d LTO \ - -d LTO_CLANG \ - -e SHADOW_CALL_STACK \ - -e TOOLS_SUPPORT_RELR \ - -e LD_LLD - -cd ${OUT_DIR} -make O=${OUT_DIR} \ - ARCH=arm64 \ - olddefconfig -cd ../ - -PATH=/home/utsavthecunt/proton-clang/bin/:$PATH - -make ARCH=arm64 \ - O=${OUT_DIR} \ - CC="ccache clang" \ - LD="ld.lld" \ - AR="llvm-ar" \ - NM="llvm-nm" \ - OBJCOPY="llvm-objcopy" \ - OBJDUMP="llvm-objdump" \ - STRIP="llvm-strip" \ - CLANG_TRIPLE="aarch64-linux-gnu-" \ - CROSS_COMPILE="aarch64-linux-gnu-" \ - CROSS_COMPILE_ARM32="arm-linux-gnueabi-" \ - -j8 - -rm ${OUT_DIR}/.version