Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old November 26th, 2007   #1
ilikenwf
Way Too Much Ubuntu
 
ilikenwf's Avatar
 
Join Date: Feb 2005
Beans: 253
Send a message via AIM to ilikenwf Send a message via MSN to ilikenwf Send a message via Yahoo to ilikenwf
Lightbulb 2.6.24-rc4-zen1 - Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

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;
__________________
Official Zen Kernel Maintainer for Ubuntu/Debian distros. Get it here.
3 Simple Steps to Font Perfection in Linux- Matt Parnell's Brain: Plugged In!
Free Stuff Daily

Last edited by ilikenwf; September 10th, 2008 at 01:36 PM..
ilikenwf is offline   Reply With Quote
Old November 27th, 2007   #2
drdabbles
Spilled the Beans
 
Join Date: Aug 2005
Location: Manchester, NH, USA
Beans: 14
Hardy Heron (Ubuntu Development)
Send a message via ICQ to drdabbles Send a message via AIM to drdabbles Send a message via MSN to drdabbles Send a message via Yahoo to drdabbles
Talking Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

Cross compiling is, to put it lightly, a real pain. It's not impossible, and for a great example of how to do it, I would suggest you take a peek at the Buildroot project linked to from the uClibc webpages.

Having said that, are you including any of the nVidia graphics drivers, or are you leaving it to the user to manually install those whenever they upgrade to your latest build?
drdabbles is offline   Reply With Quote
Old November 27th, 2007   #3
reclusivemonkey
Dark Roasted Ubuntu
 
reclusivemonkey's Avatar
 
Join Date: May 2006
Location: Triangle, West Yorks, UK
Beans: 978
Ubuntu 7.10 Gutsy Gibbon
Send a message via ICQ to reclusivemonkey Send a message via AIM to reclusivemonkey Send a message via MSN to reclusivemonkey Send a message via Yahoo to reclusivemonkey
Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

Damn I wish this had appeared a couple of days ago. I just downgraded to Feisty on my laptop as I was sick of not having a working kernel for my laptop on Gutsy. Will this work on Feisty?
__________________
"The superior man understands what is right; the inferior man understands what will sell"
--Confucius
reclusivemonkey is offline   Reply With Quote
Old November 27th, 2007   #4
ilikenwf
Way Too Much Ubuntu
 
ilikenwf's Avatar
 
Join Date: Feb 2005
Beans: 253
Send a message via AIM to ilikenwf Send a message via MSN to ilikenwf Send a message via Yahoo to ilikenwf
Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

This should work with Feisty, and no, the nvidia and ATI drivers aren't included. To use them, edit your /etc/X11/xorg.conf and find the section that mentions using the "nvidia" (or ATI) driver. change it to nv or vesa, save, restart X, and then install and run Envy ( http://www.albertomilone.com/nvidia_scripts1.html ) Then either allow Envy to (I suggest doing it yourself) or change yourself the X11 file back to the way it was...Envy is nice because it does all of the dirty work.

Note: The kernel image itself is 1.6mb
__________________
Official Zen Kernel Maintainer for Ubuntu/Debian distros. Get it here.
3 Simple Steps to Font Perfection in Linux- Matt Parnell's Brain: Plugged In!
Free Stuff Daily
ilikenwf is offline   Reply With Quote
Old November 27th, 2007   #5
coolphoenix
First Cup of Ubuntu
 
Join Date: Nov 2007
Beans: 6
Ubuntu 7.10 Gutsy Gibbon
Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

nice work, as kernel installs fine! but unfortunately i've got two problems after installing the image, headers and sources:

first regarding nvidia (envy): the build of kernel module (i think) fails, and "/var/cache/modass/nvidia-new-kernel-source.buildlog.2.6.24-rc3-zen3-ubuntu-x64.1196197707" says:
Code:
[...]
## Main Make ##
IGNORE_CC_MISMATCH=1 CC="gcc-4.1"  /usr/bin/make -C /usr/src/modules/nvidia-new-kernel/nv -f Makefile SYSSRC=/usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64   KBUILD_PARAMS="-C /usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64 SUBDIRS=/usr/src/modules/nvidia-new-kernel/nv" module;
make[2]: Entering directory `/usr/src/modules/nvidia-new-kernel/nv'

NVIDIA: calling KBUILD...
make CC=gcc-4.1 -C /usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64 SUBDIRS=/usr/src/modules/nvidia-new-kernel/nv modules
make[3]: Entering directory `/usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64'
/usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64/arch/x86/Makefile:16: /usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64/arch/x86/Makefile_64: No such file or directory
echo \#define NV_COMPILER \"`gcc-4.1 -v 2>&1 | tail -n 1`\" > /usr/src/modules/nvidia-new-kernel/nv/nv_compiler.h
  CC [M]  /usr/src/modules/nvidia-new-kernel/nv/nv.o
In file included from include/linux/utsname.h:35,
                 from /usr/src/modules/nvidia-new-kernel/nv/nv-linux.h:19,
                 from /usr/src/modules/nvidia-new-kernel/nv/nv.c:14:
include/linux/sched.h:53:36: error: asm/param.h: No such file or directory
In file included from include/linux/types.h:11,
                 from include/linux/capability.h:16,
                 from include/linux/sched.h:55,
                 from include/linux/utsname.h:35,
                 from /usr/src/modules/nvidia-new-kernel/nv/nv-linux.h:19,
                 from /usr/src/modules/nvidia-new-kernel/nv/nv.c:14:
include/linux/posix_types.h:47:29: error: asm/posix_types.h: No such file or directory
In file included from include/linux/capability.h:16,
                 from include/linux/sched.h:55,
                 from include/linux/utsname.h:35,
                 from /usr/src/modules/nvidia-new-kernel/nv/nv-linux.h:19,
                 from /usr/src/modules/nvidia-new-kernel/nv/nv.c:14:
include/linux/types.h:12:23: error: asm/types.h: No such file or directory
In file included from include/linux/capability.h:16,
                 from include/linux/sched.h:55,
                 from include/linux/utsname.h:35,
                 from /usr/src/modules/nvidia-new-kernel/nv/nv-linux.h:19,
                 from /usr/src/modules/nvidia-new-kernel/nv/nv.c:14:
include/linux/types.h:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__kernel_dev_t’
include/linux/types.h:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dev_t’
include/linux/types.h:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ino_t’
include/linux/types.h:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mode_t’
[...]
make[4]: *** [/usr/src/modules/nvidia-new-kernel/nv/nv.o] Error 1
make[3]: *** [_module_/usr/src/modules/nvidia-new-kernel/nv] Error 2
make[3]: Leaving directory `/usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
make[2]: *** [module] Error 1
make[2]: Leaving directory `/usr/src/modules/nvidia-new-kernel/nv'
make[1]: *** [build-stamp] Error 2
make[1]: Leaving directory `/usr/src/modules/nvidia-new-kernel'
make: *** [kdist_image] Error 2
and the second regarding truecrypt (truecrypt.org): upon building it calls
Code:
make -C /usr/src/zen-sources modules
(zen-sources is the place i extractet your kernel-sources) which runs fine for some time but then quits with the following (it only displays the errors):
Code:
Building internal kernel modules (may take a long time)... 
fs/cifs/dir.c: In function ‘cifs_ci_compare’:
fs/cifs/dir.c:596: warning: passing argument 1 of ‘__memcpy’ discards qualifiers from pointer target type
fs/cifs/dir.c:596: warning: passing argument 1 of ‘__builtin_memcpy’ discards qualifiers from pointer target type
drivers/usb/mon/mon_dma.c:22:1: warning: "phys_to_page" redefined
In file included from include/asm/page.h:5,
                 from include/asm/processor_64.h:11,
                 from include/asm/processor.h:4,
                 from include/linux/prefetch.h:14,
                 from include/linux/list.h:8,
                 from drivers/usb/mon/mon_dma.c:9:
include/asm/page_64.h:129:1: warning: this is the location of the previous definition
net/ipv4/netfilter/ipt_ecn.c:20:42: error: linux/netfilter_ipv4/ipt_ECN.h: No such file or directory
net/ipv4/netfilter/ipt_ecn.c:29: warning: ‘struct ipt_ECN_info’ declared inside parameter list
net/ipv4/netfilter/ipt_ecn.c:29: warning: its scope is only this definition or declaration, which is probably not what you want
net/ipv4/netfilter/ipt_ecn.c: In function ‘set_ect_ip’:
net/ipv4/netfilter/ipt_ecn.c:33: error: ‘IPT_ECN_IP_MASK’ undeclared (first use in this function)
net/ipv4/netfilter/ipt_ecn.c:33: error: (Each undeclared identifier is reported only once
net/ipv4/netfilter/ipt_ecn.c:33: error: for each function it appears in.)
[...]
make[3]: *** [net/ipv4/netfilter/ipt_ecn.o] Error 1
make[2]: *** [net/ipv4/netfilter] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
i'd really like to use your kernel, maybe you can help me?

Last edited by coolphoenix; November 27th, 2007 at 05:24 PM..
coolphoenix is offline   Reply With Quote
Old November 27th, 2007   #6
ilikenwf
Way Too Much Ubuntu
 
ilikenwf's Avatar
 
Join Date: Feb 2005
Beans: 253
Send a message via AIM to ilikenwf Send a message via MSN to ilikenwf Send a message via Yahoo to ilikenwf
Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

I think that the first error may be because you don't have gcc 4.1 installed. Try doing that, and try both again. Also, have you tried compiling the "Ubuntu Way" (make-kpkg modules_image)? That makes a nice deb package...

As for the other bug/errors, I will pass it along to the zen devs to be safe. I think Waninkoko has an account here.
__________________
Official Zen Kernel Maintainer for Ubuntu/Debian distros. Get it here.
3 Simple Steps to Font Perfection in Linux- Matt Parnell's Brain: Plugged In!
Free Stuff Daily

Last edited by ilikenwf; November 27th, 2007 at 05:35 PM..
ilikenwf is offline   Reply With Quote
Old November 27th, 2007   #7
Waninkoko
First Cup of Ubuntu
 
Join Date: May 2007
Beans: 5
Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

Try this:

ln -s /usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64/include/asm-x86 /usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64/asm

About truecrypt, it doesn't work because of ABI changes.

Last edited by Waninkoko; November 27th, 2007 at 06:14 PM..
Waninkoko is offline   Reply With Quote
Old November 27th, 2007   #8
coolphoenix
First Cup of Ubuntu
 
Join Date: Nov 2007
Beans: 6
Ubuntu 7.10 Gutsy Gibbon
Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

thanks for looking into it

i've got gcc 4.1 installed (and reinstalled it - no change), but i found something other in the error message of compiling nvidia, the lines:

Code:
/usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64/arch/x86/Makefile:16: /usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64/arch/x86/Makefile_64: No such file or directory
include/linux/sched.h:53:36: error: asm/param.h: No such file or directory
include/linux/posix_types.h:47:29: error: asm/posix_types.h: No such file or directory
...
it seems there are files missing it needs but does not find


and "make-kpkg modules_image" did only work after a "make-kpkg debian" - but then the first quits with error regarding nvidia after complaining about alsa... and no change to the problems

and regarding truecrypt it seems the same:
Code:
net/ipv4/netfilter/ipt_ecn.c:20:42: error: linux/netfilter_ipv4/ipt_ECN.h: No such file or directory
i found the file in the linux-headers directory of the zen kernel, copied them to the destination it was looking for, the same error appeared with different files, same procedere (with the files located in)
Code:
linux-headers-2.6.24-rc3-zen3-ubuntu-x64/include/linux/netfilter/xt_DSCP.h
linux-headers-2.6.24-rc3-zen3-ubuntu-x64/include/linux/netfilter_ipv4/ipt_DSCP.h
linux-headers-2.6.24-rc3-zen3-ubuntu-x64/include/linux/netfilter_ipv4/ipt_ECN.h
- now it quits with this error
Code:
Building internal kernel modules (may take a long time)...
net/ipv4/netfilter/ipt_ecn.c: In function ‘set_ect_ip’:
net/ipv4/netfilter/ipt_ecn.c:33: error: ‘IPT_DSCP_MASK’ undeclared (first use in this function)
net/ipv4/netfilter/ipt_ecn.c:33: error: (Each undeclared identifier is reported only once
net/ipv4/netfilter/ipt_ecn.c:33: error: for each function it appears in.)
net/ipv4/netfilter/ipt_ecn.c: In function ‘checkentry’:
net/ipv4/netfilter/ipt_ecn.c:116: error: ‘IPT_DSCP_MASK’ undeclared (first use in this function)
make[3]: *** [net/ipv4/netfilter/ipt_ecn.o] Error 1
make[2]: *** [net/ipv4/netfilter] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
if i can do something else to find the problem, just let me know!
coolphoenix is offline   Reply With Quote
Old November 27th, 2007   #9
ilikenwf
Way Too Much Ubuntu
 
ilikenwf's Avatar
 
Join Date: Feb 2005
Beans: 253
Send a message via AIM to ilikenwf Send a message via MSN to ilikenwf Send a message via Yahoo to ilikenwf
Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

I will look into it here in a bit...looks like the files are either missing, or more symlinks are needed.
__________________
Official Zen Kernel Maintainer for Ubuntu/Debian distros. Get it here.
3 Simple Steps to Font Perfection in Linux- Matt Parnell's Brain: Plugged In!
Free Stuff Daily
ilikenwf is offline   Reply With Quote
Old November 27th, 2007   #10
coolphoenix
First Cup of Ubuntu
 
Join Date: Nov 2007
Beans: 6
Ubuntu 7.10 Gutsy Gibbon
Re: 2.6.24 Zen Ubuntu Kernel - Faster, Stable, More Hardware Support

Quote:
Originally Posted by Waninkoko View Post
Try this:

ln -s /usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64/include/asm-x86 /usr/src/linux-headers-2.6.24-rc3-zen3-ubuntu-x64/asm

About truecrypt, it doesn't work because of ABI changes.
well, envy still complains about the same error on building (but the files in the asm/ - dir are definitely there now) - but i just installed the driver downloaded from nvidia directly, it works fine!

so it seems to be a problem with envy, maybe you can change the first post referring to that


and about truecrypt: as far as i see it does not even start to compile truecrypt but it tries to compile the (general?) kernel-modules - so this error is not regarding truecrypt i think, or am i wrong?

Last edited by coolphoenix; November 27th, 2007 at 06:34 PM..
coolphoenix is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:55 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry