#!/bin/bash ################################################################################### # This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License. # http://creativecommons.org/licenses/by-nc/3.0/deed.es_ES # Created by Paulo Lira Gutierrez (enriquelira948@gmail.com) # Updated by lighta (lightaisme@gmail.com) # Permission is granted to copy, distribute and / or modify this program always # And you cite the author and source of http://kernel-netbook.blogspot.com # And under the terms of the GNU General Public License, Version 3 or any # Later version published by the Free Software Foundation. # Usage: # If you want to perform the step of downloading the Github repository, you need to download the config file settings located at: # Https://github.com/dieghen89/kernel-netbook/blob/master/config and copy in a new folder called kernel-netbook inside the folder. # In addition, shall have downloaded the source code of the kernel version will commpilar (in a folder called Programs within the folder), must match the version of the configuration file. YELLOW="\033[1;33m" ENDCOLOR="\033[0m" RED="\033[0;31m" if [ $USER != root ]; then echo -e $RED"Error: need to be root, Quitting...."$ENDCOLOR exit 0 fi echo -e $YELLOW"Test Internet Connection..."$ENDCOLOR ping www.google.com -c 3 >/dev/null 2>&1 if [ $? = 0 ]; then echo -e $YELLOW"Connection established"$ENDCOLOR else echo -e $RED"Connection test couldn't succed, please verify configuration (trying to reach google.com)"$ENDCOLOR exit fi #downloading/install pkg requirement sudo apt-get install git w3m zenity #cheking deb file and install it if not LATEST_DEB=3.9.2 DEB_INST=$(dpkg -l | grep linux-headers-${LATEST_DEB}-netbook) if [[ -z "$DEB_INST" ]]; then FILENAME=linux-headers-${LATEST_DEB}-netbook_${LATEST_DEB}_i386.deb echo -e "Attempt installing $FILENAME" if [ ! -e $FILENAME ]; then wget http://downloads.sourceforge.net/project/kernelnetbook/${LATEST_DEB}/$FILENAME; fi sudo dpkg -i $FILENAME fi DEB_INST2=$(dpkg -l | grep linux-image-${LATEST_DEB}-netbook) if [[ -z "$DEB_INST2" ]]; then FILENAME=linux-image-${LATEST_DEB}-netbook_${LATEST_DEB}_i386.deb echo -e "Atempt installing $FILENAME" if [ ! -e $FILENAME ]; then wget http://downloads.sourceforge.net/project/kernelnetbook/${LATEST_DEB}/$FILENAME; fi sudo dpkg -i $FILENAME fi echo -e $YELLOW"Updating kernel-netbook directory"$ENDCOLOR if [ -d $HOME/kernel-netbook ]; then cd ~/kernel-netbook git pull https://github.com/dieghen89/kernel-netbook.git else echo -e $YELLOW"\tDebug, Creating dir kernel-netbook"$ENDCOLOR git clone https://github.com/dieghen89/kernel-netbook.git $HOME/kernel-netbook cd $HOME/kernel-netbook fi sleep 5 VERSION_CONFIG=$(cat $HOME/kernel-netbook/config | head -3 |tail -1 | grep -o '[0123456789.]*' | head -3 |tail -1) echo -e $YELLOW"Configuration version of archive kernel-netbook/config is $VERSION_CONFIG"$ENDCOLOR sleep 4 if [ ! -d $HOME/Programas ]; then echo-e $YELLOW "\ TDebug, Creating Programmes dir" $ENDCOLOR mkdir $HOME/Programas; fi cd ~/Programas LISTAR=$(ls *.tar.bz2) if [ -z $LISTAR ]; then echo -e $RED"No *tar.bz2 found, exiting..."$ENDCOLOR # exit 0 fi VERSION=${LATEST_DEB} #not supported yet #VERSION=$(w3m -dump http://kernel.org/kdist/finger_banner | head -1 |tail -1 | awk '{ print $11 }') LINUX_VERSION_TAR=linux-$VERSION.tar.bz2 LINUX_VERSION=linux-$VERSION VERSION_LISTADO=${VERSION_CONFIG} #VERSION_LISTADO=$(ls *.tar.bz2 | grep -o '[0123456789.]*'| head -1 | sed 's/.$//g') if [ -z $VERSION_CONFIG ] || [ -z $VERSION_LISTADO ] || [ $VERSION_CONFIG != $VERSION_LISTADO ]; then echo -e $RED"Chk found different version vers_conf=$VERSION_CONFIG, vers_list=$VERSION_LISTADO, exiting..."$ENDCOLOR # exit 0 fi echo -e $YELLOW"Installing dependencies for compilation.."$ENDCOLOR sudo apt-get install build-essential gcc libncurses5-dev sleep 3 sudo cp ~/Programas/$LISTAR /usr/src/$LISTAR cd /usr/src echo -e $YELLOW"Listing .tar.bz2 in Programas..."$ENDCOLOR echo $LISTAR if [ $? = 0 ]; then echo -e "Kernel src found" else echo -e $RED"Kernel src not found"$ENDCOLOR exit fi sleep 1 sudo rm -rf /usr/src/linux-$VERSION_LISTADO echo -e $YELLOW"Deflate src in /usr/src/linux-$VERSION_LISTADO..."$ENDCOLOR sleep 2 sudo tar -xjvf $LISTAR echo -e $YELLOW"Deleting archives $LISTAR..."$ENDCOLOR sudo rm $LISTAR sleep 2 echo -e $YELLOW"Creating symlink for linux-$VERSION_LISTADO..."$ENDCOLOR sudo rm -rf linux sudo ln -s linux-$VERSION_LISTADO linux sleep 2 cd /usr/src/linux ################################################################################################ # PATCHES # # TAKEN FROM SOME PARTS OF DIEGUEN89 PKGBUILD #https://github.com/dieghen89/kernel-netbook/blob/master/PKGBUILD TUX_ON_ICE="n" BROADCOM_WL="n" UKSM="y" LOCALMODCONFIG="n" GCONFIG="n" INSTALL="n" ### HOW-TO: # ## >> Details for: TUX_ON_ICE # Set it to "No" you you do not want the Tux On Ice support # ## >> Details for: BROADCOM_WL # September is to "and" if you need the iw module for your wireless card # # # P. S. this supports the graysky's PKGBUILD modprobe_db package # # ## >> Details for: UKSM # Set it to "and" to enable the testing uKSM patch, you more info here: # Http://kerneldedup.org # ## >> The previous BFQ_IO_SCHEDULER is useless, read the wiki page in google code # ########## DIR_FUENTE=/usr/src/linux _basekernel=3.9 pkgver=${_basekernel}.2 pkgrel=1 #Broadcom-wl: broadcom_ver=5.100.82.112 broadcom="hybrid-portsrc_x86_32-v${broadcom_ver//./_}" #BFS: - http://users.on.net/~ckolivas/kernel/ - _ckpatchversion=1 _ckpatchname="patch-${_basekernel}-ck${_ckpatchversion}" #BFQ: - http://algo.ing.unimo.it/people/paolo/disk_sched/ - _bfqpath="http://www.algogroup.unimo.it/people/paolo/disk_sched/patches/3.9.0-v6r1" #TuxOnIce: #New official patch #_toipatch="tuxonice-for-linux-3.8.0-2013-02-24.patch" _toipatch="$HOME/kernel-netbook/toi-3.9.patch" #uKSM: _uksm="http://kerneldedup.org/download/uksm/0.1.2.2" _uksm_name="uksm-0.1.2.2-for-v3.9.ge.1" echo-e $YELLOW "Downloading patch BFS ..." $ENDCOLOR FILENAME=${_basekernel}-ck${_ckpatchversion}/${_ckpatchname}.bz2 if [ ! -e $FILENAME ]; then wget http://ck.kolivas.org/patches/3.0/3.9/$FILENAME; fi echo -e $YELLOW"Downloading patch uKSM ..."$ENDCOLOR FILENAME=${_uksm_name}.patch if [ ! -e $FILENAME ]; then wget ${_uksm}/$FILENAME; fi echo -e $YELLOW"BFQ patch Downloading ..."$ENDCOLOR FILENAME="0001-block-cgroups-kconfig-build-bits-for-BFQ-v6r1-3.9.patch" if [ ! -e $FILENAME ]; then wget ${_bfqpath}/$FILENAME; fi FILENAME="0002-block-introduce-the-BFQ-v6r1-I-O-sched-for-3.9.patch" if [ ! -e $FILENAME ]; then wget ${_bfqpath}/$FILENAME; fi FILENAME="0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v6r1-for-3.9.0.patch" if [ ! -e $FILENAME ]; then wget ${_bfqpath}/$FILENAME; fi echo -e $YELLOW"Downloading patch Broadcom ..."$ENDCOLOR FILENAME=${broadcom}.tar.gz if [ ! -e $FILENAME ]; then wget http://www.broadcom.com/docs/linux_sta/$FILENAME; fi if [ ! -d $DIR_FUENTE ]; then mkdir $DIR_FUENTE; fi cp $_toipatch $DIR_FUENTE cp $HOME/kernel-netbook/linux-recent.patch linux-recent.patch cp $HOME/kernel-netbook/license.patch license.patch cp $HOME/kernel-netbook/user-ioctl.patch user-ioctl.patch echo -e $YELLOW"Depending on your configuration, apply patches BFS, BFQ, uKSM and TuxOnIce"$ENDCOLOR # --> BFS #Adjust localversion bzip2 -d patch-${_basekernel}-ck1.bz2 DIR=$(pwd) echo "we re here $DIR" sed -i -e "s/-ck${_ckpatchversion}//g" $DIR_FUENTE/${_ckpatchname} patch -Np1 -i $DIR_FUENTE/patch-${_basekernel}-ck1 exit if [ $? = 0 ]; then if [ $TUX_ON_ICE = "y" ] ; then # --> TOI patch -Np1 -i ${_toipatch} if [ $? = 0 ]; then # --> BFQ for patch in $(ls $DIR_FUENTE/000*BFQ*.patch) ; do patch -Np1 -i $patch done if [ $? = 0 ]; then # --> uKSM if [ $UKSM = "y" ] ; then patch -Np1 -i $DIR_FUENTE/${_uksm_name}.patch fi fi fi fi else zenity --error --text="There was an error in applying patches" exit fi ##Section: Broadcom-wl if [ "${BROADCOM_WL}" == "y" ] ; then zenity --info --text="Compiling module Broadcom" cp -ar src/wl src/wl_orig patch -p1 -N -i linux-recent.patch patch -p1 -N -i license.patch patch -p1 -N -i user-ioctl.patch make -C $DIR_FUENTE/linux-$_basekernel M=`pwd` install -D -m 755 wl.ko ${pkgdir}/lib/modules/${_extramodules}/wl.ko rm -r src/wl mv src/wl_orig src/wl fi sleep 3 echo -e $YELLOW"If there is an error, press Ctrl+C"$ENDCOLOR sleep 7 echo -e $YELLOW"Cleaning the source directory tree ..."$ENDCOLOR sudo make mrproper # END PATCH # ################################################################################################ echo-e $ YELLOW "Copying file as kernel-netbook/config like. config" $ ENDCOLOR sudo cp $HOME/kernel-netbook/config /usr/src/linux/.config sleep 6 if [ $GCONFIG = "y" ] ; then echo -e $YELLOW"Starting gconfig"$ENDCOLOR sudo make gconfig fi echo -e $YELLOW"Cleaning the kernel ..."$ENDCOLOR sleep 3 sudo make-kpkg clean sleep 3 if [ $LOCALMODCONFIG = "y" ] ; then echo -e $YELLOW"That They are including modules are running at this time"$ENDCOLOR sleep 3 zenity --warning --text="Please connect the necessary peripherals" sleep 10 sudo make localmodconfig echo -e $YELLOW"You can unplug peripherals Have Been added to The Necessary modules to the configuration file"$ENDCOLOR sleep 3 fi echo -e $YELLOW"Make sure the file is added. config"$ENDCOLOR cat /usr/src/linux/.config | grep CONFIG_MATOM sleep 3 echo -e $YELLOW"Copying. config file to Ubuntu One"$ENDCOLOR sudo cp /usr/src/linux/.config $HOME/"Ubuntu One"/kernel-netbook/kernel-netbook-$VERSION_LISTADO echo -e $YELLOW"Compiling the kernel ..."$ENDCOLOR rm ~/Programas/linux*.deb sudo make-kpkg -j2 --initrd linux_headers linux_image sleep 3 echo -e $YELLOW"Plays a beep"$ENDCOLOR play /usr/share/sounds/Sentinella/Bip-bip.ogg echo -e $YELLOW"Moving files. Programs deb"$ENDCOLOR sudo mv /usr/src/linux*.deb $HOME/Programas sleep 5 #######################CHANGE PACKAGE DESCRIPTION LINUX-IMAGE#################### cd $HOME/Programas echo -e $YELLOW"Changing owner ..."$ENDCOLOR sudo chown paulo $HOME/Programas/linux*.deb mkdir linux-image-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386 dpkg -x linux-image-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386.deb linux-image-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386 dpkg -e linux-image-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386.deb linux-image-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386/DEBIAN cd linux-image-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386/DEBIAN sed '17,26d' control > $$.tmp && mv $$.tmp control sleep 2 sed "12a Homepage: code.google.com/p/kernel-netbook" control > $$.tmp && mv $$.tmp control echo -e " Static kernel for netbooks with Intel Atom N270/N280/N450/N550/N570 such as eeepc with the add-on of external firmware (broadcom-wl) and patchset (BFS + TOI + BFQ optional) - Only Intel GPU - Give more power to your netbook!.\n ." >> control echo -e $YELLOW"Building file modified package linux-image control"$ENDCOLOR cd $HOME/Programas fakeroot dpkg -b linux-image-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386 sleep 3 #######################CHANGE PACKAGE DESCRIPTION LINUX-HEADERS#################### mkdir linux-headers-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386 dpkg -x linux-headers-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386.deb linux-headers-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386 dpkg -e linux-headers-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386.deb linux-headers-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386/DEBIAN cd linux-headers-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386/DEBIAN sed '16,21d' control > $$.tmp && mv $$.tmp control sleep 2 sed "12a Homepage: code.google.com/p/kernel-netbook" control > $$.tmp && mv $$.tmp control echo -e " Static kernel for netbooks with Intel Atom N270/N280/N450/N550/N570 such as eeepc with the add-on of external firmware (broadcom-wl) and patchset (BFS + TOI + BFQ optional) - Only Intel GPU - Give more power to your netbook!.\n ." >> control echo -e $YELLOW"Building modified package control file linux-headers"$ENDCOLOR cd $HOME/Programas fakeroot dpkg -b linux-headers-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386 sleep 3 echo -e $YELLOW"Removing unnecessary files .."$ENDCOLOR sudo rm -rf linux-image-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386 sudo rm -rf linux-headers-"$VERSION_CONFIG"-netbook_"$VERSION_CONFIG"_i386 sudo rm control *.tmp ########################################################################################################## if [ $INSTALL = "y" ] ; then echo -e $YELLOW"Installing linux-image and linux_headers ..."$ENDCOLOR sudo dpkg -i linux-image-$VERSION_CONFIG-netbook_"$VERSION_CONFIG"_i386.deb linux-headers-$VERSION_CONFIG-netbook_"$VERSION_CONFIG"_i386.deb fi echo -e $YELLOW"Going up linux-image and linux-headers at 4shared ..."$ENDCOLOR cadaver --rcfile=$HOME/.4shared-kernel sleep 5 sudo rm -rf /usr/src/linux-$VERSION_LISTADO sleep 3