A link to our build script: https://github.com/GlitchKernel/Glitch/blob/V13/cappy.sh
mv /usr/bin/kmen.txt /usr/bin/kmen
chmod +x /usr/bin/kmen
kmen
#!/bin/bash
function msg {
echo -e '\E[37;44m'"\033[1m$welcome\033[0m" ; tput sgr0
}
function msg_blue {
echo -e '\E[37;44m'"\033[1m$welcome\033[0m" ; tput sgr0
}
function msg_green {
echo -e '\E[38;42m'"\033[1m$welcome\033[0m" ; tput sgr0
}
function msg_green_wait {
echo -ne '\E[38;42m'"\033[1m$welcome\033[0m" ; tput sgr0
}
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
echo
read -p "Hit a key to continue.."
menu
}
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
echo
read -p "Hit a key to continue.."
menu
}
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 '{}' \; to temp
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 -e '\E[38;42mThis prints in blue.'; tput sgr0
welcome="Creating a flashable zip in temporary location..."
msg_green
#echo "Creating a flashable zip in temporary location..."
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"
echo
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/
err=$?
if [ ! $err -eq 0 ]
then
echo "An error occured while copying zImage!"
echo "A flashable zip cannot be created!"
echo
read -p "Hit a key to continue!"
menu
else
echo " zImage copied"
fi
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
else
echo " Network driver (bcm4329.ko) copied"
fi
date_str=`date '+%d%m%y_%H%M%S'`
dirname="kernel_$nameflag_$date_str"
echo
echo "Current kernel output 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
echo
welcome="Created flashable zip: $pckdir/$zipname"
msg_green
read -p "Push to sdcard(N/y)?" -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
lastminpack=$pckdir"/"$zipname
adb push $pckdir/$zipname /sdcard/
fi
#welcome="Make Package with Additional Modules (N/y)?"
#msg_green_wait
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 findcompilestatus {
echo
welcome="Post compilation status"
msg_blue
welcome="Generated the following files:"
msg_green
cd $ksource
find . -name 'zImage' -exec echo '{}' \;
find . -name '*.ko' -exec echo '{}' \;
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 "\007"
fi
findcompilestatus
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=""
anykdir=/home/droidzone/flasher/AnyKernel
ksource=$kstartpath
outdir=~/kernel_flashable
packagedir=/home/droidzone/flasher/outdir
tempdir=~/kernel_flashable
mnameflag=""
#Main menu
menu
exit 0
I'v read 3 instructions with the same subject before...none of them were this much clear and usefull...tnx a lot
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
}
im on work now and cant test your script, but i found this function in your source:
Code: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 }
is this only a workaround for kubuntu? - because im working on mint (ubuntu)
I know that it is stupid question, but how flash kernel ??? Just via CWM (install zip from sdcard > choose zip from sdcard > zip file of kernel )or any other way ??
I'll be delighted if noobs start building kernels with this info!
ok
after i must make this
sudo apt-get install ncurses-dev
i get the options menu before i get a error
with kind regards
sudo apt-get install libncurses5-dev
cd ~/
mkdir -p ~/android/kernel
tar -xvf ~/android/kernel/bravo_2.6.35_gb-mr.tar.gz
cd ~/android/kernel/bravo_2.6.35_gb-mr
mkdir -p ~/android/ndk
cp [sourcefile] [destination]
tar -jvxf android-ndk-r7-linux-x86.tar.bz2
gedit ~/.bashrc
PATH=$PATH:~/android/ndk/android-ndk-r7-linux-x86/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
CROSS_COMPILE=arm-linux-androideabi-
cd ~/android/kernel/bravo_2.6.35_gb-mr
make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- bravo_defconfig
cd ~/android/kernel/bravo_2.6.35_gb-mr
adb pull /proc/config.gz
zcat config.gz > .config
make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- menuconfig
|-- kernel
| |-- dump_image
| |-- mkbootimg
| |-- mkbootimg.sh
| |-- unpackbootimg
| `-- zImage
|-- META-INF
| |-- CERT.RSA
| |-- CERT.SF
| |-- com
| | `-- google
| | `-- android
| | |-- update-binary
| | `-- updater-script
| `-- MANIFEST.MF
`-- system
`-- lib
`-- modules
`-- bcm4329.ko
8 directories, 11 files
cd ~/
tar -jvxf kernel_flashable.tar.bz2.zip
cp arch/arm/boot/zImage ~/kernel_flashable
find . -name '*ko' -exec cp '{}' ~/kernel_flashable/system/lib/modules/ \;
cd ~/kernel_flashable
zip -r mykernel ./
KBUILD_CFLAGS += -w
KBUILD_CFLAGS += -Wno-error=unused-but-set-variable
drivers/net/wireless/bcm4329_204/wl_iw.c: In function 'wl_iw_set_pmksa':
drivers/net/wireless/bcm4329_204/wl_iw.c:5075:5: error: array subscript is above array bounds [-Werror=array-bounds]
drivers/net/wireless/bcm4329_204/wl_iw.c:5078:5: error: array subscript is above array bounds [-Werror=array-bounds]
DHDCFLAGS = -DLINUX -DBCMDRIVER -DBCMDONGLEHOST -DDHDTHREAD -DBCMWPA2 \
-DUNRELEASEDCHIP -Dlinux -DDHD_SDALIGN=64 -DMAX_HDR_READ=64 \
-DDHD_FIRSTREAD=64 -DDHD_GPL -DDHD_SCHED -DBDC -DTOE -DDHD_BCMEVENTS \
-DSHOW_EVENTS -DBCMSDIO -DDHD_GPL -DBCMLXSDMMC -DBCMPLATFORM_BUS \
-Wall -Wstrict-prototypes -Werror -DOOB_INTR_ONLY -DCUSTOMER_HW2 \
-DDHD_USE_STATIC_BUF -DMMC_SDIO_ABORT -DWLAN_PFN -DWLAN_PROTECT \
-DBCMWAPI_WPI \
diff -rupN -X /home/droidzone/android/kernel/exclude.opts bravo_2.6.35_gb-mr/drivers/power/ds2784_battery.c bravo_2.6.35_gb-mr.main//drivers/power/ds2784_battery.c
--- bravo_2.6.35_gb-mr/drivers/power/ds2784_battery.c 2011-08-25 13:16:53.000000000 +0530
+++ bravo_2.6.35_gb-mr.main//drivers/power/ds2784_battery.c 2011-11-06 16:43:21.544317342 +0530
@@ -118,8 +118,11 @@ PS. 0 or other battery ID use the same p
/* Battery ID = 1: HT-E/Formosa 1400mAh */
#define BATT_ID_A 1
#define BATT_FULL_MAH_A 1400
-
#define BATT_FULL_MAH_DEFAULT 1500
+#define BATT_FULL_MAH_CAMERONSINO 2400
+#define BATT_ID_CAMERONSINO
+#define BATT_TYPE 0
+
diff -rupN -X /home/droidzone/android/kernel/exclude.opts bravo_2.6.35_gb-mr/drivers/power/ds2784_battery.c bravo_2.6.35_gb-mr.main//drivers/power/ds2784_battery.c
patch -p1<extended_battfix.patch
patch -p2<extended_battfix.patch