Created
May 19, 2017 15:36
-
-
Save LinerSRT/edc46604734954f7d19c6c9aa9171d0b to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
export curdate=`date "+_%Y:%M"` | |
red=$(tput setaf 1) # red | |
grn=$(tput setaf 2) # green | |
cya=$(tput setaf 6) # cyan | |
txtbld=$(tput bold) # Bold | |
bldred=${txtbld}$(tput setaf 1) # red | |
bldgrn=${txtbld}$(tput setaf 2) # green | |
bldblu=${txtbld}$(tput setaf 4) # blue | |
bldcya=${txtbld}$(tput setaf 6) # cyan | |
txtrst=$(tput sgr0) # Resetz | |
read LAST_BUILD < <(cat ~/out/last_build.txt) | |
read ERR_COUNT < <(cat ~/out/error_count.txt) | |
read NUMBER < <(cat ~/out/build_num.txt) | |
read BUILD_DATE< <(date "+%Y/%m/%d/ %H:%M") | |
read SIZE_OUT < <(du -h ~/out | grep -o "[0-9]*[M,G,T,K]") | |
cd 5010 | |
VER=$(grep -o "VERSION = [0-9]" Makefile | grep -o "[0-9]") | |
PATCH=$(grep -o "PATCHLEVEL = [0-9]*" Makefile | grep -o "[0-9]*") | |
SUB=$(grep -o "SUBLEVEL = [0-9]*" Makefile | grep -o "[0-9]*") | |
read CPU < <(grep -o "MT[0-9]*" arch/arm/configs/pixi4_4_8g1g_defconfig | grep -o "[0-9]*") | |
cd | |
echo -e "${txtbld}**********************************************************************************************${txtrst}" | |
echo -e "${txtbld}* Start building${txtrst}${txtbld}${bldgrn} $VER.$PATCH.$SUB ${txtrst}${txtbld}kernel for${txtrst}${txtbld}${bldgrn} MT$CPU ${txtrst}${txtbld}, please wait and be patient!" | |
echo -e "${txtbld}**********************************************************************************************${txtrst}" | |
echo $BUILD_DATE > ~/out/last_build.txt | |
cd ~/5010 > /dev/null 2>&1 | |
export ARCH=arm > /dev/null 2>&1 | |
export CROSS_COMPILE=~/arm-eabi-4.8/bin/arm-eabi- > /dev/null 2>&1 | |
BUILD_START=$(date +"%s") | |
make pixi4_4_8g1g_defconfig O=out1 > /dev/null 2>&1 | |
make -j3 O=out1 &> ~/out/log.build | |
if [ $? -eq 0 ]; then | |
mv $PWD/out1/arch/arm/boot/zImage-dtb ~/CarlivImageKitchen64/tcl5022d_3_18/tcl5022d_3_18.img-kernel | |
cd ~/CarlivImageKitchen64 | |
./repack_img tcl5022d_3_18 > /dev/null 2>&1 | |
mv output/tcl5022d_3_18_repacked.img ~/out/tcl5022d_3_18_test$NUMBER.img | |
read SIZE_OUT < <(du -h ~/out | grep -o "[0-9]*[M,G,T,K]") | |
read CHECK_SIZE < <(echo $SIZE_OUT | grep -o "[0-9]*") | |
if (("$CHECK_SIZE" >= "500")); then | |
echo -e "${txtbld}**********************************************************************************************${txtrst}" | |
echo -e "${txtbld}* Size of ${bldcya}~/out${txtrst} ${bldred}reached maximum size${txtrst} ${bldgrn}500M${txtrst}${txtbld}, cleaning. ${txtrst}" | |
echo -e "${txtbld}**********************************************************************************************${txtrst}" | |
cd ~/out | |
rm -rf *.img | |
mv ~/CarlivImageKitchen64/output/tcl5022d_3_18_repacked.img ~/out/tcl5022d_3_18_test$NUMBER.img | |
fi | |
BUILD_END=$(date +"%s") | |
DIFF=$(($BUILD_END - $BUILD_START)) | |
let "NEW = $NUMBER + 1" | |
echo $NEW > ~/out/build_num.txt | |
cd .. | |
echo -e "${txtbld}**********************************************************************************************${txtrst}" | |
echo -e "${txtbld}* Firmware ${bldcya}~/out/tcl5022d_3_18_test$NUMBER.img${txtrst} ${txtbld} compiled and packed${txtrst}" | |
echo -e "${txtbld}* Compilation end with ${bldgrn}$(($DIFF / 60)):$(($DIFF % 60)) (mm:ss)${txtrst}" | |
echo -e "${txtbld}* Total size output folder: ${bldcya}~/out${txtrst} ${txtbld}is${txtrst} ${bldgrn}$SIZE_OUT ${txtrst}" | |
echo -e "${txtbld}* Last compilation maded in: ${txtrst}${bldgrn} $LAST_BUILD ${txtrst}" | |
echo -e "${txtbld}* Total error's count: ${txtrst}${bldred} #$ERR_COUNT ${txtrst}" | |
echo -e "${txtbld}* Total compilation's count: ${txtrst}${txtbld}${bldgrn} #$NUMBER ${txtrst}${txtbld}" | |
echo -e "${txtbld}* Platform: ${txtrst}${txtbld}${bldgrn} MT$CPU ${txtrst}${txtbld}" | |
echo -e "${txtbld}* Target kernel version is: ${txtrst}${txtbld}${bldgrn} $VER.$PATCH.$SUB ${txtrst}${txtbld}" | |
echo -e "${txtbld}**********************************************************************************************${txtrst}" | |
else | |
#######################Test feature. Open file with error on needed line | |
read FILENAME < <(cat ~/out/log.build | grep -o "[/,a-z,_, 0-9]*.[c,h]:[0-9]*:[0-9]*: error" | grep -o "[/,a-z,_, 0-9]*.[c,h]") | |
read LINE < <(cat ~/out/log.build | grep -o "[0-9,:]*: error" | grep -o "[0-9]*") | |
echo -e "${txtbld}${bldred}**********************************************************************************************${txtrst}" | |
echo -e "${txtbld}${bldred}*${txtrst}${txtbld} Warning! Compilation finished with ${bldred}ERROR! ${txtrst}" | |
echo -e "${txtbld}${bldred}*${txtrst}${txtbld} Error in file ${bldcya} $FILENAME ${txtrst}${bldred} on${bldgrn} $LINE ${bldred}line ${txtrst}" | |
echo -e "${txtbld}${bldred}**********************************************************************************************${txtrst}" | |
#gedit ~/android_kernel3.18_alcatel_5022d/build.log | |
read ERR_COUNT < <(cat ~/out/error_count.txt) | |
let "ERR_COUNT_NUM = $ERR_COUNT + 1" | |
echo $ERR_COUNT_NUM > ~/out/error_count.txt | |
gedit +$LINE ~/5010$FILENAME | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment