Kernel compilation menu script

Latest version:

#!/bin/bash

function msg {
echo -e 'E[37;44m'"33[1m$welcome33[0m"
}

function pushmin {
echo "Last kernel pack with no mods:"
echo "$lastminpack"
echo
read -p "Push to SD card?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
adb push $lastminpack /sdcard/
fi
}

function backup_menuconfig {
echo
if [ -e $kstartpath/.config ]
then
date_str=`date '+%d%m%y_%H%M%S'`
nname="config_$mnameflag_$date_str.txt"
echo "Your menuconfig information resides in .config"
echo "It will be backed up as $nname"
echo "You can change the name to config_[yournametag]_$date_str"
echo
read -p "Change the name?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo
read -p "Enter new nametag:"
mnameflag=$REPLY
nname="config_"$mnameflag"_"$date_str".txt"
echo "New name will be $nname"
echo
read -p "Hit a key to continue.."
fi
echo
cp $kstartpath/.config $kstartpath/$nname
if [ -e $kstartpath/$nname ]
then
echo "Current menuconfig info successfully backed up as $kstartpath/$nname"
echo
else
echo "Warning! An error occured while trying to backup .config"
echo "Read Only filesystems/permissions error?"
echo
fi
else
echo
echo "No .config information found at $kstartpath"
echo "Are you in the kernel source root directory? "
echo "Rerun script from correct location...Aborting!"
echo
fi
read -p "Hit a key to continue.."
menu
}

function pushmax {
echo "Last kernel pack with mods: "
echo "$lastmaxpack"
echo
read -p "Push to SD card?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
adb push $lastmaxpack /sdcard/
fi

}

function openlast {
echo
if [ ! "$lastfolder" = "" ]
then
echo "Last output folder is $lastfolder"
echo
read -p "Open it in file manager?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
if [ -e /usr/bin/dolphin ]
then
echo "Opening output folder in Dolphon"
dolphin $lastfolder
elif [ -e /usr/bin/nautilus ]
then
echo "Opening output folder in Nautilus"
nautilus $lastfolder
elif [ -e /usr/local/bin/mc ]
then
echo "Opening output folder in Midnight Commander"
mc $lastfolder
else
echo "No compatible file managers found. Aborting.."
fi
fi
else
echo "There is no logged last output folder!"
echo "Compile a kernel/create flashable zips before choosing this option!!"
fi
echo
read -p "Hit a key to continue.."
menu
}

function pushzip {
echo
echo "Push last packed zips to sdcard"
echo "==============================="

if [ "$lastminpack" = "" ] && [ "$lastmaxpack" = "" ]
then
echo "Generate a zip pack before trying to push it!"
read -p "Hit a key to continue.."
menu
elif [ "$lastminpack" = "" ]
then
pushmax
elif [ "$lastmaxpack" = "" ]
then
pushmin
else
pushmin
pushmax
fi

#menu
}

function disp_kfiles {
echo
echo "Display compiled files in Kernel directory"
echo "=========================================="
echo "Current Kernel path is : $kstartpath"
cd $kstartpath
echo
echo "Locating zImage:"
echo
find . -name 'zImage' -exec echo '{}' ;
echo
echo "Locating Modules:"
echo
find . -name '*.ko' -exec echo '{}' ;
read -p "Hit a key to continue.."
menu
}

function lflashery {
clear

if [ ! -d $ksource/arch ]
then
echo "The kernel location could not be located. Please re-run script from within kernel source root."
echo "Script will now terminate!"
exit 1
fi

echo " =============================================="
welcome=" FLASHABLE ZIP MAKER 1.0 by Droidzone "
msg
#echo " FLASHABLE ZIP MAKER 1.0 by Droidzone"
echo " =============================================="
echo "Output dir is " $outdir/home/droidzone/kernel_flashable
echo "Anykernel source is at " $anykdir
echo "Kernel source is at " $ksource
echo " "
echo "Creating target directories"

if [ ! -d $outdir ]; then mkdir $outdir; fi
if [ ! -d $packagedir ]; then mkdir $packagedir; fi
if [ ! -d $tempdir ]; then mkdir $tempdir; fi
#Copying the new kernel files

if [ ls $outdir/*.zip > /dev/null 2>&1 ]
then
rm $outdir/*.zip
fi

if [ ls $tempdir/README > /dev/null 2>&1 ]
then
rm $tempdir/README
fi

echo "Working in temporary directory: $tempdir"
cp -a $anykdir/* $tempdir/

sync

echo "Cleaning up remnants..."
if [ -e $outdir/kernel/zImage ]; then rm $outdir/kernel/zImage; fi

if [ ls $outdir/system/lib/modules/* > /dev/null 2>&1 ]
then
rm $outdir/system/lib/modules/*
fi

if [ -d $ksource ]
then
if [ ! -e $ksource/arch/arm/boot/zImage ]
then
echo "Kernel source location: $ksource/arch/arm/boot/zImage"

echo "zImage was not located at kernel location. Please re-run script from within kernel source root."
echo "Script will now terminate!"
exit 1
else
echo "Copying zImage..."
cp $ksource/arch/arm/boot/zImage $outdir/kernel/
fi
else
echo "Kernel source folder: $ksource"

echo "Kernel source folder not found! Please re-run script from within kernel source root."
echo "Script will now terminate!"
exit 1
fi
cd $outdir
echo "At temp location: $(pwd)...About to cleanup!"
read -p "Hit a key to continue!"

#Precleaning temp folder
find . -name '*.ko' -exec rm '{}' ;
find . -name '*~' -exec rm '{}' ;
find . -name 'README*' -exec rm '{}' ;

echo
echo "Cleaned up the temp directory."
echo "Temp directory contains the following modules:"
find . -name '*.ko' -exec echo '{}' ;
read -p "Hit a key to continue!"

cd $ksource

#find . -name '*.ko' -exec cp '{}' $outdir/system/lib/modules/ ;
echo "Adding Network Driver..."
find . -name 'bcm4329.ko' -exec cp '{}' $outdir/system/lib/modules/ ;
if [ ! -e $outdir/system/lib/modules/bcm4329.ko ]
then
echo "WARNING! Wifi module was not compiled. Aborting.."
exit 1
fi

date_str=`date '+%d%m%y_%H%M%S'`
dirname="kernel_$nameflag_$date_str"
echo
echo "Current dir name is $dirname"
echo "You can change the name to kernel_[yourname]_$date_str"
echo
read -p "Change the name?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
read -p "Enter new name:"
#echo "Repy is " $REPLY
nameflag=$REPLY
dirname="kernel_"$nameflag"_"$date_str
echo "New name will be $dirname"
echo
read -p "Hit a key to continue.."
fi

pckdir="$packagedir/$dirname"
mkdir $pckdir

lastfolder=$pckdir
cd $outdir/
echo
zipnoname="kbase_"$nameflag"_"$date_str
zipaddnoname="kmods_"$nameflag"_"$date_str
zipname=$zipnoname".zip"
zipaddname=$zipaddnoname".zip"
echo "Creating $zipname from $(pwd)"
zip -r $zipnoname ./
mv $zipname $pckdir/
#echo $packagedir
welcome="Created flashable zip: $pckdir/$zipname"
msg

read -p "Push to sdcard(N/y)?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
lastminpack=$pckdir"/"$zipname
adb push $pckdir/$zipname /sdcard/
fi

read -p 'Make Package with Additional Modules (N/y)?' -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo
cd $ksource
echo "Kernel source is at $ksource"

#find . -name '*.ko' -exec cp '{}' $outdir/system/lib/modules/ ;
echo "Adding Additional Modules (if any)..."
echo
echo "Found the following modules:"
find . -name '*.ko' -exec echo '{}' ;
echo
read -p "Hit a key to continue!"
find . -name '*.ko' -exec cp '{}' $outdir/system/lib/modules/ ;
read -p "Copying over. Hit a key to continue!"
cd $outdir/

echo "Creating $zipaddname from $(pwd)"
zip -r $zipaddnoname ./
mv $zipaddname $pckdir/
###############################

welcome="Created a Full flashable package at $pckdir/$zipaddname"
msg
echo

read -p "Push to sdcard(N/y)?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
lastmaxpack=$pckdir"/"$zipname
adb push $pckdir/$zipaddname /sdcard/
fi
fi

read -p "Open Output folder in Dolphin (N/y)?" -n 1
echo
if [[ $REPLY =~ ^[Nn]$ ]]
then
menu
exit 0
else
dolphin $pckdir &
exit 0
fi
menu
exit 0
}

function menuconf {
cd $kstartpath
echo
echo "Entering Menuconfig..."
#Working on Kubuntu
#make ARCH=arm CC="arm-linux-gcc" LD="arm-linux-ld" AR="arm-linux-ar" RANLIB="arm-linux-ranlib" AS="arm-linux-as" -j10 -i all
if [ ! -e ./Makefile ]
then
echo "This script should be executed from within the root directory of kernel"
echo "Makefile could not be located in your current location. Aborting..."
exit 1
fi
make ARCH=arm CROSS_COMPILE=$toolchain menuconfig
menu
}

function defconf {
cd $kstartpath
echo
echo "Generating defconfig"
make ARCH=arm CROSS_COMPILE=$toolchain bravo_defconfig
echo "Entering Menuconfig..."
#Working on Kubuntu
#make ARCH=arm CC="arm-linux-gcc" LD="arm-linux-ld" AR="arm-linux-ar" RANLIB="arm-linux-ranlib" AS="arm-linux-as" -j10 -i all
if [ ! -e ./Makefile ]
then
echo "This script should be executed from within the root directory of kernel"
echo "Makefile could not be located in your current location. Aborting..."
exit 1
fi
make ARCH=arm CROSS_COMPILE=$toolchain menuconfig
menu
}

function cleanup {
echo
echo "Cleaning up.."
make ARCH=arm CROSS_COMPILE=$toolchain clean
read -p "Hit a key to continue.."
menu
}

function toolch {
echo
echo "Current toolchain prefix is:$toolchain"
echo "Note that script will not add paths for you. Do it manually!"
echo
read -p "Enter new toolchain (including the -):"
tempchain=$REPLY
echo
echo "New toolchain will be set as $tempchain"
read -p "Confirm (y/N)?" -n 1
if [[ $REPLY =~ ^[Yy]$ ]]
then
toolchain=$tempchain
echo
echo "New toolchain prefix is now :$toolchain"
else
echo
echo "Ok, Nothing will be modified!"
fi
read -p "Hit a key to continue.."
menu
}

function disp_path () {
echo
echo "Current PATH is :"
echo "$PATH"
echo
read -p "Hit a key to continue.."
menu
}

function comp () {
echo
echo "Compiling Kernel..."
if [ ! -e ./Makefile ]
then
echo "This script should be executed from within the root directory of kernel"
echo "Makefile could not be located in your current location. Aborting..."
exit 1
fi
make ARCH=arm CROSS_COMPILE=$toolchain -j$jobs
if [ ! -e arch/arm/boot/zImage ]
then
echo "ERROR: An error occured. Kernel was not compiled."
exit 1
else
echo "Making Modules..."
echo
make ARCH=arm CROSS_COMPILE="arm-bravo-" modules
echo -en "07"
fi
read -p "Hit a key to continue.."
menu
}

function menu () {
clear
echo
echo " ======================================================="
welcome=" Kernel Compilation Script by Droidzone 01-11-2011 "
msg
echo " ======================================================="
echo
echo " (D)efault config"
echo " (E)rase - Make Clean"
echo " (M)enuconfig"
echo " (C)ompile now"
echo " (F)lashable zip maker"
echo " (P)ush last zip to sdcard"
echo " (O)pen last output folder"
echo
echo " (Q)uit"
echo
echo " Advanced Compilation Options"
echo " ----------------------------"
echo " 1. Change Toolchain prefix (Current : $toolchain )"
echo " 2. Pick a Toolchain from menu"
echo " 3. Change Number of simultaneous jobs (Current : $jobs )"
echo " 4. Display Current path"
echo " 5. Display Kernel Files"
echo " 6. Backup Menuconfig/.config"
echo
read -p " Choose an option :" -n 1
if [[ $REPLY =~ ^[1]$ ]]
then
echo
toolch
elif [[ $REPLY =~ ^[2]$ ]]
then
echo
tcmenu
elif [[ $REPLY =~ ^[4]$ ]]
then
echo
disp_path
elif [[ $REPLY =~ ^[5]$ ]]
then
echo
disp_kfiles
elif [[ $REPLY =~ ^[6]$ ]]
then
echo
backup_menuconfig
elif [[ $REPLY =~ ^[Dd]$ ]]
then
echo
defconf
elif [[ $REPLY =~ ^[Ee]$ ]]
then
echo
cleanup
elif [[ $REPLY =~ ^[Mm]$ ]]
then
echo
menuconf
elif [[ $REPLY =~ ^[Cc]$ ]]
then
echo
comp
elif [[ $REPLY =~ ^[Ff]$ ]]
then
echo
lflashery
elif [[ $REPLY =~ ^[Pp]$ ]]
then
echo
pushzip
elif [[ $REPLY =~ ^[Oo]$ ]]
then
echo
openlast
elif [[ $REPLY =~ ^[Qq]$ ]]
then
echo
exit 0
else
menu
fi
}

function additional () {
ksource=$(pwd)
read -p "Configure Menuconfig?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
menuconf
fi

if [ ! -d $outdir ]; then mkdir $outdir; fi
if [ ! -d $packagedir ]; then mkdir $packagedir; fi
if [ ! -d $tempdir ]; then mkdir $tempdir; fi
#Copying the new kernel files>

if ls $outdir/*.zip > /dev/null 2>&1
then
rm $outdir/*.zip
fi

if ls $tempdir/README > /dev/null 2>&1
then
rm $tem
fi
read -p "Compile Kernel now?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
comp
fi

echo
echo "Kernel compilation is over.."
welcome="Generated the following files:"
msgMm
find . -name 'zImage' -exec echo '{}' ;
find . -name '*.ko' -exec echo '{}' ;
echo ""
read -p "Make Flashable zip now?" -n 1
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]
then
lflashery
fi
menu
exit 0
}

function tcmenu () {
echo
echo "Available Toolchains"
echo "===================="
echo "1. arm-bravo-"
echo "2. NDK Toolchain: arm-linux-androideabi-"
echo
echo "Currently selected toolchain: $toolchain"
echo
read -p "Pick your toolchain:" -n 1
echo
if [[ $REPLY =~ ^[1]$ ]]
then
toolchain="arm-bravo-"
elif [[ $REPLY =~ ^[2]$ ]]
then
toolchain="arm-linux-androideabi-"
else
echo "Invalid choice!"
fi
echo
echo "Currently set as toolchain :$toolchain"
echo
read -p "Hit a key to continue.."
menu
}

#Compiled toolchain:
#toolchain="arm-bravo-"

#NDK
toolchain="arm-linux-androideabi-"
jobs=50
kstartpath=$(pwd)
lastfolder=""
nameflag="zImage"
anykdir=/home/droidzone/flasher/AnyKernel
ksource=$kstartpath
outdir=~/kernel_flashable
packagedir=/home/droidzone/flasher/outdir
tempdir=~/kernel_flashablezImage
mnameflag=""

#Main menu
menu
exit 0
[/code]

Older version follows:

#!/bin/bash

function msg {
echo -e 'E[37;44m'"33[1m$welcome33[0m"
}

function pushmin {
echo "Last kernel pack with no mods:"
echo "$lastminpack"
echo
read -p "Push to SD card?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
adb push $lastminpack /sdcard/
fi
}

function pushmax {
echo "Last kernel pack with mods: "
echo "$lastmaxpack"
echo
read -p "Push to SD card?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
adb push $lastmaxpack /sdcard/
fi

}

function pushzip {
echo
echo "Push last packed zips to sdcard"
echo "==============================="

if [ "$lastminpack" = "" ] && [ "$lastmaxpack" = "" ]
then
echo "Generate a zip pack before trying to push it!"
read -p "Hit a key to continue.."
menu
elif [ "$lastminpack" = "" ]
then
pushmax
elif [ "$lastmaxpack" = "" ]
then
pushmin
else
pushmin
pushmax
fi

#menu
}

function lflashery {
nameflag=""
clear
anykdir=/home/droidzone/flasher/AnyKernel
if [ ! -d $(pwd)/arch ]
then
echo "The kernel location could not be located. Please re-run script from within kernel source root."
echo "Script will now terminate!"
exit 1
fi
ksource=$(pwd)
outdir=~/kernel_flashable
packagedir=/home/droidzone/flasher/outdir
tempdir=~/kernel_flashable

echo " =============================================="
welcome=" FLASHABLE ZIP MAKER 1.0 by Droidzone "
msg
#echo " FLASHABLE ZIP MAKER 1.0 by Droidzone"
echo " =============================================="
echo "Output dir is " $outdir/home/droidzone/kernel_flashable
echo "Anykernel source is at " $anykdir
echo "Kernel source is at " $ksource
echo " "
echo "Creating target directories"

if [ ! -d $outdir ]; then mkdir $outdir; fi
if [ ! -d $packagedir ]; then mkdir $packagedir; fi
if [ ! -d $tempdir ]; then mkdir $tempdir; fi
#Copying the new kernel files

if [ ls $outdir/*.zip > /dev/null 2>&1 ]
then
rm $outdir/*.zip
fi

if [ ls $tempdir/README > /dev/null 2>&1 ]
then
rm $tempdir/README
fi

echo "Working in temporary directory: $tempdir"
cp -a $anykdir/* $tempdir/

sync

echo "Cleaning up remnants..."
if [ -e $outdir/kernel/zImage ]; then rm $outdir/kernel/zImage; fi

if [ ls $outdir/system/lib/modules/* > /dev/null 2>&1 ]
then
rm $outdir/system/lib/modules/*
fi

if [ -d $ksource ]
then
if [ ! -e $ksource/arch/arm/boot/zImage ]
then
echo "Kernel source location: $ksource/arch/arm/boot/zImage"

echo "zImage was not located at kernel location. Please re-run script from within kernel source root."
echo "Script will now terminate!"
exit 1
else
echo "Copying zImage..."
cp $ksource/arch/arm/boot/zImage $outdir/kernel/
fi
else
echo "Kernel source folder: $ksource"

echo "Kernel source folder not found! Please re-run script from within kernel source root."
echo "Script will now terminate!"
exit 1
fi
find . -name '*~' -exec rm '{}' ;
find . -name 'README*' -exec rm '{}' ;
#Precleaning temp folder
find . -name '*.ko' -exec rm '{}' ;

cd $ksource

#find . -name '*.ko' -exec cp '{}' $outdir/system/lib/modules/ ;
echo "Adding Network Driver..."
find . -name 'bcm4329.ko' -exec cp '{}' $outdir/system/lib/modules/ ;
if [ ! -e $outdir/system/lib/modules/bcm4329.ko ]
then
echo "WARNING! Wifi module was not compiled. Aborting.."
exit 1
fi

date_str=`date '+%d%m%y_%H%M%S'`
dirname="kernel_$nameflag_$date_str"

echo "Current dir name is $dirname"
echo "You can change the name to kernel_[yourname]_$date_str"
echo
read -p "Change the name?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
read -p "Enter new name:"
#echo "Repy is " $REPLY
nameflag=$REPLY
dirname="kernel_"$nameflag"_"$date_str
echo "New name will be $dirname"
echo
read -p "Hit a key to continue.."
fi

pckdir="$packagedir/$dirname"
mkdir $pckdir

cd $outdir/
echo
zipnoname="kbase_"$nameflag"_"$date_str
zipaddnoname="kmods_"$nameflag"_"$date_str
zipname=$zipnoname".zip"
zipaddname=$zipaddnoname".zip"
echo "Creating $zipname from $(pwd)"
zip -r $zipnoname ./
mv $zipname $pckdir/
#echo $packagedir
welcome="Created flashable zip: $pckdir/$zipname"
msg

read -p "Push to sdcard(N/y)?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
lastminpack=$pckdir"/"$zipname
adb push $pckdir/$zipname /sdcard/
fi

read -p 'Make Package with Additional Modules (N/y)?' -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo
cd $ksource

#find . -name '*.ko' -exec cp '{}' $outdir/system/lib/modules/ ;
echo "Adding Additional Modules (if any)..."
find . -name '*.ko' -exec cp '{}' $outdir/system/lib/modules/ ;

cd $outdir/

echo "Creating $zipaddname from $(pwd)"
zip -r $zipaddnoname ./
mv $zipaddname $pckdir/
###############################

welcome="Created a Full flashable package at $pckdir/$zipaddname"
msg
echo

read -p "Push to sdcard(N/y)?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
lastmaxpack=$pckdir"/"$zipname
adb push $pckdir/$zipaddname /sdcard/
fi
fi

read -p "Open Output folder in Dolphin (N/y)?" -n 1
echo
if [[ $REPLY =~ ^[Nn]$ ]]
then
menu
exit 0
else
dolphin $pckdir &
exit 0
fi
menu
exit 0
}

function menuconf {
echo
echo "Entering Menuconfig..."
#Working on Kubuntu
#make ARCH=arm CC="arm-linux-gcc" LD="arm-linux-ld" AR="arm-linux-ar" RANLIB="arm-linux-ranlib" AS="arm-linux-as" -j10 -i all
if [ ! -e ./Makefile ]
then
echo "This script should be executed from within the root directory of kernel"
echo "Makefile could not be located in your current location. Aborting..."
exit 1
fi
make ARCH=arm CROSS_COMPILE=$toolchain menuconfig
menu
}

function defconf {
echo
echo "Generating defconfig"
make ARCH=arm CROSS_COMPILE=$toolchain bravo_defconfig
echo "Entering Menuconfig..."
#Working on Kubuntu
#make ARCH=arm CC="arm-linux-gcc" LD="arm-linux-ld" AR="arm-linux-ar" RANLIB="arm-linux-ranlib" AS="arm-linux-as" -j10 -i all
if [ ! -e ./Makefile ]
then
echo "This script should be executed from within the root directory of kernel"
echo "Makefile could not be located in your current location. Aborting..."
exit 1
fi
make ARCH=arm CROSS_COMPILE=$toolchain menuconfig
menu
}

function cleanup {
echo
echo "Cleaning up.."
make ARCH=arm CROSS_COMPILE=$toolchain clean
read -p "Hit a key to continue.."
menu
}

function comp () {
echo
echo "Compiling Kernel..."
if [ ! -e ./Makefile ]
then
echo "This script should be executed from within the root directory of kernel"
echo "Makefile could not be located in your current location. Aborting..."
exit 1
fi
make ARCH=arm CROSS_COMPILE=$toolchain -j$jobs
if [ ! -e arch/arm/boot/zImage ]
then
echo "ERROR: An error occured. Kernel was not compiled."
exit 1
else
echo "Making Modules..."
echo
make ARCH=arm CROSS_COMPILE="arm-bravo-" modules
echo -en "07"
fi
read -p "Hit a key to continue.."
menu
}

function menu () {
clear
echo
echo "======================================================="
welcome="Kernel Compilation Script by Droidzone 01-11-2011"
msg
echo "======================================================="
echo
echo " (D)efault config"
echo " (E)rase - Make Clean"
echo " (M)enuconfig"
echo " (C)ompile now"
echo " (F)lashable zip maker"
echo " (P)ush last zip to sdcard"
echo " (Q)uit"
echo
echo " Advanced Compilation Options"
echo " ----------------------------"
echo " Change Toolchain prefix (Current : $toolchain )"
echo " Change Number of simultaneous jobs (Current : $jobs )"
echo
read -p "Choose an option :" -n 1
if [[ $REPLY =~ ^[Dd]$ ]]
then
echo
defconf
elif [[ $REPLY =~ ^[Ee]$ ]]
then
echo
cleanup
elif [[ $REPLY =~ ^[Mm]$ ]]
then
echo
menuconf
elif [[ $REPLY =~ ^[Cc]$ ]]
then
echo
comp
elif [[ $REPLY =~ ^[Ff]$ ]]
then
echo
lflashery
elif [[ $REPLY =~ ^[Pp]$ ]]
then
echo
pushzip
elif [[ $REPLY =~ ^[Qq]$ ]]
then
echo
exit 0
else
menu
fi
}

function additional () {
ksource=$(pwd)
read -p "Configure Menuconfig?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
menuconf
fi

if [ ! -d $outdir ]; then mkdir $outdir; fi
if [ ! -d $packagedir ]; then mkdir $packagedir; fi
if [ ! -d $tempdir ]; then mkdir $tempdir; fi
#Copying the new kernel files>

if ls $outdir/*.zip > /dev/null 2>&1
then
rm $outdir/*.zip
fi

if ls $tempdir/README > /dev/null 2>&1
then
rm $tem
fi
read -p "Compile Kernel now?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
comp
fi

echo
echo "Kernel compilation is over.."
welcome="Generated the following files:"
msgMm
find . -name 'zImage' -exec echo '{}' ;
find . -name '*.ko' -exec echo '{}' ;
echo ""
read -p "Make Flashable zip now?" -n 1
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]
then
lflashery
fi
menu
exit 0
}

toolchain="arm-bravo-"
jobs=50
#Main menu
menu
exit 0
[/code]