Skip to content

Commit

Permalink
scripts: refactor for new enviroment
Browse files Browse the repository at this point in the history
- boi has a VM now

Signed-off-by: UtsavBalar1231 <[email protected]>
  • Loading branch information
UtsavBalar1231 committed Sep 1, 2020
1 parent c7a1370 commit d3cac4b
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 83 deletions.
75 changes: 75 additions & 0 deletions build-lld
Original file line number Diff line number Diff line change
@@ -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"
75 changes: 75 additions & 0 deletions build-lto
Original file line number Diff line number Diff line change
@@ -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"
43 changes: 0 additions & 43 deletions build-lto.sh

This file was deleted.

40 changes: 0 additions & 40 deletions build.sh

This file was deleted.

0 comments on commit d3cac4b

Please sign in to comment.