Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 202 lines (181 sloc) 5.972 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
#!/bin/bash
_CHOCO_KERNEL_FOLDER=""
_STOCK_KERNEL_FOLDER=""
_MANIPULATEBOOT_FOLDER=""
_ARM_CROSSCOMPILER="/path-to-crosscompiler/arm-2010.09/bin/arm-none-linux-gnueabi-"
_RAMDISK_FOLDER=""
choco_modules=("drivers/net/tun.ko" "drivers/net/wireless/bcm4325/dhd.ko" "drivers/staging/ramzswap/ramzswap.ko" "fs/cifs/cifs.ko" "fs/ext4/ext4.ko" "fs/ext3/ext3.ko" "fs/jbd2/jbd2.ko");
official_modules=("drivers/net/tun.ko" "drivers/net/wireless/bcm4325/dhd.ko" "fs/ext4/ext4.ko" "fs/ext3/ext3.ko");
_WORKSPACE=""

echo -en "\033[1m\nWelcome to gnufabio Acer Kernel compiling tool! :D\nType $0 --help to get help!\n\033[0m\n"

if [[ $@ =~ "--help" ]]; then
echo -e "\t --no-clean \t→ Not to clean kernel"
echo -e "\t --no-compile\t → Not to compile the kernel"
echo -e "\t --no-pack\t → Not to pack the kernel"
echo -e "\t --no-update\t → Not to make a update.zip file in the workspace"
echo -e "\t --download-kernel\t → To download the kernel in ~/"
echo -e "\t --download-ramdisk\t → To download the ramdisk in ~/"
echo -e "\t --download-stock\t → To download the stock kernel in ~/"
echo -e "\t --download-manipulate\t → To download the manipulate-boot scripts in ~/"
echo -e "\t --sync\t → To to syncronize the components"
echo -e "\t --stock\t → To compile the stock kernel"
exit
fi
export TOEXIT=false
if [[ $@ =~ "--download-kernel" ]]; then
if [[ -e /usr/bin/git ]]; then
cd ~/
git clone git://github.com/gnufabio/acer_liquid_chocolate.git
echo -en '\E[31m'"\033[1m\n[*] Kernel cloned in $PWD!\033[0m\n"
export TOEXIT=true
else
echo -en '\E[31m'"\033[1m\nPlease install git first! Please edit this script and add the path!\033[0m\n"
exit
fi
fi
if [[ $@ =~ "--download-stock" ]]; then
if [[ -e /usr/bin/git ]]; then
cd ~/
git clone git://github.com/gnufabio/acer_stock_kernel.git
echo -en '\E[31m'"\033[1m\n[*] Kernel cloned in $PWD!\033[0m\n"
export TOEXIT=true
else
echo -en '\E[31m'"\033[1m\nPlease install git first! Please edit this script and add the path!\033[0m\n"
exit
fi
fi
if [[ $@ =~ "--download-ramdisk" ]]; then
if [[ -e /usr/bin/git ]]; then
cd ~/
git clone git://github.com/gnufabio/acer_liquid_ramdisk.git
echo -en '\E[31m'"\033[1m\n[*] Ramdisk cloned in $PWD!\033[0m\n"
export TOEXIT=true
else
echo -en '\E[31m'"\033[1m\nPlease install git first! Please edit this script and add the path!\033[0m\n"
exit
fi
fi
if [[ $@ =~ "--download-manipulate" ]]; then
cd ~/
wget http://zephyrteam.hellospace.net/storage/manipulate-boot.zip
unzip manipulate-boot.zip -d manipulate-boot
rm manipulate-boot.zip
echo -en '\E[31m'"\033[1m\n[*] Manipulate-boot downloaded in $PWD! Please edit this script and add the path!\033[0m\n"
export TOEXIT=true
fi

if [ $TOEXIT = true ]; then
exit
fi
###############################################################################################################
if [[ $@ =~ "--sync" ]]; then
if [ -e $_CHOCO_KERNEL_FOLDER ]; then
cd $_CHOCO_KERNEL_FOLDER
git pull
fi
if [ -e $_STOCK_KERNEL_FOLDER ]; then
cd $_STOCK_KERNEL_FOLDER
git pull
fi
if [ -e $_RAMDISK_FOLDER ]; then
cd $_RAMDISK_FOLDER
git pull
fi
cd ~/
fi
###############################################################################################################
export _CLEAN=true
export _COMPILE=true
export _STOCK=false
export _KERNEL_FOLDER=$_CHOCO_KERNEL_FOLDER

if [[ $@ =~ "--stock" ]]; then
_STOCK=true
export _KERNEL_FOLDER=$_STOCK_KERNEL_FOLDER
fi

cd $_KERNEL_FOLDER

if [[ $@ =~ "--no-clean" ]]; then
_CLEAN=false
fi

if [ $_CLEAN = true ]; then
make clean
fi

if [[ $@ =~ "--no-compile" ]]; then
_COMPILE=false
fi

if [ $_COMPILE = true ]; then
export ARCH=arm
export CROSS_COMPILE=$_ARM_CROSSCOMPILER
echo -e "\n[?] How many core has your CPU?"
read CPU
let "CPU=CPU*2"
echo -e "[~] Started to compile kernel with -j$CPU\n"
make -j$CPU
fi;

echo -en "\033[1m[ ] Moving drivers to manipulate-boot folder...\033[0m\n"


if [ $_STOCK = false ]; then
for (( i=0; i<${#choco_modules[@]}; i++ )); do
if [ -e ${choco_modules[$i]} ]; then
cp ${choco_modules[$i]} $_MANIPULATEBOOT_FOLDER
fi
ST_ERR=$?
if [ $ST_ERR -ne 0 ]; then
echo -e "[X] Error $ST_ERR while coping file $PWD/${modules[i]}: exiting..\n"
exit
fi
done
else
for (( i=0; i<${#stock_modules[@]}; i++ )); do
if [ -e ${stock_modules[$i]} ]; then
cp ${stock_modules[$i]} $_MANIPULATEBOOT_FOLDER
fi
ST_ERR=$?
if [ $ST_ERR -ne 0 ]; then
echo -e "[X] Error $ST_ERR while coping file $PWD/${modules[i]}: exiting..\n"
exit
fi
done
fi

cp arch/arm/boot/zImage $_MANIPULATEBOOT_FOLDER

echo -en "\033[1m[ ] Copied zImage\033[0m\n"

if [[ $@ =~ "--no-pack" ]]; then
echo -e "[*] Kernel not packed in Boot.img. zImage copied in $_MANIPULATEBOOT_FOLDER\n"
exit
fi

export _RAMDISK_TMP="$__RAMDISK_FOLDER"_tmp
cp -rf $_RAMDISK_FOLDER $_RAMDISK_TMP
cd $_RAMDISK_TMP
rm -rf .git
find . | cpio -o -H newc | gzip > ../acer_ramdisk.cpio.gz
echo -en "\033[1m[*] Ramdisk written\033[0m\n"
mv ../acer_ramdisk.cpio.gz $_MANIPULATEBOOT_FOLDER
cd ..
rm -rf $_RAMDISK_TMP
cd $_MANIPULATEBOOT_FOLDER
./liquidmkbootimg --deploy 0 --kernel zImage --ramdisk acer_ramdisk.cpio.gz --output acerboot0.img
echo -en '\033[1m**[OUTPUT]** '$PWD'/acerboot0.img\033[0m\n'

if [[ $@ =~ "--no-update" ]]; then
exit
fi

if [ ! -e $_WORKSPACE ]; then
mkdir $_WORKSPACE
fi
mv acerboot0.img $_WORKSPACE
mv *.ko $_WORKSPACE
cd $_WORKSPACE
if [ ! -e .update.zip ]; then
wget http://zephyrteam.hellospace.net/storage/update.zip -O .update.zip > /dev/null
fi
unzip .update.zip -d temp
mv acerboot0.img temp/
mv dhd.ko temp/system/etc/wifi/
mv *.ko temp/system/lib/modules/

if [ $_STOCK = true ]; then
export ZIPNAME="stock-acer-kernel-`date +%y%m%d`-`date +%k%M`.zip"
else
export ZIPNAME="choco-acer-kernel-`date +%y%m%d`-`date +%k%M`.zip"
fi

cd temp
zip -qr0 $ZIPNAME *
mv $ZIPNAME ..
cd ..
rm -rf temp
echo -en '\E[31m'"\033[1m\n[*] Built $ZIPNAME in $PWD!\033[0m\n"
Something went wrong with that request. Please try again.