Zen Kernel
Caveats:
See the wiki to get the nVidia drivers to work!
NOW ANNOUNCING buildZen version 2!
This script should now be compatible with any distro, although it currently is easiest on Debian based distros
buildZen is a bash script that guides you through the process of building the Zen kernel yourself. It makes it very, very easy! Just follow the prompts as you go along! It is not one time use, as you can run it again, when you are ready to update your source tree and build the kernel again. Just follow the instructions in the prompts, and you will be fine!
This is a beta, but it works. Please tell me of any issues you encounter. You can either download it by clicking
here, or you can copy and paste from below. Put it in a text file named buildZen, and chmod +x buildZen after that. Then, to run the script, use sudo sh buildZen and follow the directions. Note that xconfig or gconfig should be used first, as they are easier to use when you get to the configuration step. Note that if you exit the script, you can always leave off from where you left off. Hopefully, this script will be a crutch to teach you how to configure and compile, and you will eventually stop using it and doing it the normal way.
Good luck, and have fun! Make sure to leave one default Ubuntu kernel installed at all times, as a fallback! Don't forget the wiki article, as it will contain information regarding not only buildZen, but other topics, such as firmware for wireless drivers, and nVidia and ATI installation directions.
Fixes: permissions should now be automatically set, and if root isn't running the script, it exits. Furthermore, everything should go nicely.
READ THE DOCUMENTATION ON THE WIKI!
AND SEE THE OFFICIAL ZEN SITE!
ALWAYS KEEP ANOTHER KERNEL INSTALLED TO FALL BACK ON IN THE EVENT THIS ONE MAY FAIL!
Now updated,
buildZen v2 should work with pretty much any distro, now. It's easiest still with debian based distros, as for all others it checks to see if an automatic build system is in place like portage or abs, and if not, it uses the old fashioned make clean, make, make install, etc...I need people to help me put more checks in for any other build systems to make this really compatible with everything else...oh yeah...and I'll add color again eventually.
Code:
#!/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;
Bookmarks