#!/bin/sh #This script is opensource under the GPL. Please attribute it and any part of it you use to Matt Parnell, and #http://www.mattparnell.com/zen/. To use, chmod +x the script, and then run it by either dropping it into your #/sbin/ dir, or ./buildZen to run it. It pretty well explains everything it's doing. To contact me, or give me #commentary or improvements, see http://www.mattparnell.com/, or email me at admin@mattparnell.com. echo -en " [INTRODUCTION] This script will aid you in building the Zen kernel, which you will be building from the git tree. Rerun this script whenever you want to rebuild or update the source tree. To continue, type zen to install the regular Zen kernel, zenrt to install the Zen realtime kernel, zenmm to install the Zenmm kernel, or zenps3 to build the Zen for Playstation 3 kernel. Otherwise, enter nothing to exit. Any other input will result in an error. "; read repo; if [ "x${repo}" == "x" ]; then exit; fi echo "[CHECKING FOR BUILD DEPENDENCIES]"; if [[ $(uname -a |grep buntu) != "" || $(uname -a |grep debian) != "" || $(uname -a |grep mint) != "" ]]; then echo "Installing dependencies"; apt-get update; apt-get -y install kernel-package libncurses5-dev git bzip2 wget; fi if [[ $(which git) == "" ||$(which gcc) == "" || $(which make) == "" || $(which autoconf) == "" || $(which automake) == "" ]]; then echo "It appears you do not have gcc, make, autoconf, or automake installed. Please install and rerun this script."; exit; fi echo "It appears you have all build dependencies. [CLONE THE SOURCE TREE] Now, we must clone the sources via git, using the command \"git clone\". The cloning process takes anywhere from 5 to 60 minutes, sometimes more. Go grab a coffee or surf the web. It's worth the wait. May I suggest browsing mattparnell.com ? "; cd /usr/src/; if [ -d /usr/src/"$repo" ]; then echo "We just need to update your current source. If any errors happen, and you can't fix them, delete the source folder and try again."; cd /usr/src/"$repo"; git pull; echo "Everthing's up to date, or git has timed out."; else echo "Cloning "$repo"..."; git clone http://git.zen-sources.org/kernel/"$repo".git; echo " The source is now cloned on your local drive." fi echo "[CHANGING CONFIGURATION OPTIONS] From here the options are all up to your discretion. It is suggested that you deselect any drivers, functions, or other options that you know you will not use. If in doubt, disable it. If something is broken or the kernel does not boot, just remove it, re-enable the option, and build. Make sure to take notes your first few tries, and remember to uninstall your old and broken Zen kernels. Always leave a default kernel installed to fall back on! Note that your configuration will be backed up to your home directory. To configure your kernel, we need to know what interface you wish to use. xconfig: 1 (Requires qt) gconfig: 2 (Requires gtk) menuconfig: 3 (Requires ncurses) oldconfig: 4 (Requires bash) When finished, save and close the interface you choose to continue on to the building process. Choice: " read I; cd /usr/src/"$repo"/; if [ "$I" = "1" ]; then make xconfig; elif [ "$I" = "2" ]; then make gconfig; elif [ "$I" = "3" ]; then make menuconfig; else make oldconfig; fi cp .config ~/kernel.config; echo " [BUILD THE KERNEL] Now that that is all over, we are finally ready to build your kernel. Ubuntu has a script that automates the process, in which it builds your kernel into a nice deb package. You can install that, I hope. All that is left is issuing the command to make that package. This will take some time, and will take all of your computing resources. This is a really good time to walk off for 30 minutes to an hour, and do something else. To continue, enter y. Otherwise, enter n to exit: "; read BD; cd /usr/src/"$repo"/; if [ "$BD" == "n" ]; then exit; fi if [ $(which make-kpkg) != "" ]; then INSTALL_MOD_STRIP=1 CONCURRENCY_LEVEL=2 make-kpkg --initrd kernel_image kernel_headers modules_image; echo "Done building, you should have a kernel and headers package to install in /usr/src, as well as a modules package if you opted to put any module source in /usr/src." elif [ $(which makepkg) != "" ]; then echo "D'oh. Don't you know there's a PKGBUILD in AUR for this? Go get it, and make sure to move your kernel source tree to the PKGBUILD's appropriate src directory. You may have to edit the git url, as it has changed, and the maintainer is a bit late on updating such things." else echo "Doing it the old fashioned way"; make clean; make; make bzImage; make modules; make modules_install; fi echo "Building done. You now need to follow your distro's specific procedures to create a cpio/initrd image, and edit your lilo.conf or /boot/grub/menu.lst file appropriately. See your respective wiki to figure this one out. [SUPPORT] Read the Zen Kernel entry in the Ubuntu wiki to learn how to install wireless firmware, and setup the TuxOnIce suspend features, among others. To install the nVidia drivers, you will need the nVidia installer, as well as a patch available at http://www.mattparnell.com/zen/PKGBUILD/nvidia/xen.patch.txt if it doesn't work. For live support, feel free to use IRC to connect to irc://irc.freenode.net and join the #zen-sources channel. You may want to see zen-sources.org, as well as the Zen thread on the Gentoo forums, which is linked to at mattparnell.com/zen.html. You can find further support in the Zen thread on Ubuntuforums."; exit;