[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: building 2.6.35



On Fri, 13 Aug 2010 15:12:02 -0400 (EDT), Angus Hedger wrote:
> 
> The two things that i use k-headers for myself are the nvidia blob,
> and the virtual-box km's
> 
> The only issues I ran into when building headers via make-kpkg where as follows,
> 
> Make sure you use the same "-append-to-version -stuff-here" line as
> you do when building your kernel, or they wont match up and it wont
> find the k-headers.
> 
> And, I have found that the packages made by make-kpkg are setting the
> wrong "/lib/modules/<kernel version>/build" symlink, pointing it to my
> the dir where i build the kernel rather than the correct
> /usr/src/<kernel headers> dir.
> 
> (I think i need to bug report the 2nd, but I don't know if its
> something I am doing wrong).

I don't think that this is a bug.  I think you're trying to mix and match
two different ways of doing things.  There are two basic ways of creating
an out-of-kernel-source-tree module from source: (1) install the kernel
headers and compile the out-of-kernel-source-tree module from source
using the kernel headers, and (2) if you have the whole kernel source tree
installed, compile using the kernel source.  What you're doing is creating
a kernel header package from the kernel source and then using method (1),
when you should be using method (2).  I spent the better part of the day
today playing around with this.  Perhaps the results of my experiment
will prove instructive in some way.

I have a computer, i386 architecture, which runs Debian Squeeze.  It has
an Nvidia video card with a RIVA TNT2 chipset.  It currently runs a stock
Debian kernel (linux-image-2.6.32-5-686, version 2.6.32-18) and it uses
the nv driver for X (xserver-xorg-video-nv, version 1:2.1.17-3).  I can't
use the nouveau driver, unfortunately, because interlaced video modes do
not work with the nouveau driver and my CRT monitor requires
interlaced video modes to operate at its maximum resolution due to
its low maximum pixel clock rate.)  I decided to build a custom
kernel and at the same time attempt to activate the proprietary nvidia
driver.  I really didn't need or want to do either one, but for the sake
of making my kernel-building web page more useful, I decided to do this
exercise.  Here is what I did.

The first step was to figure out which kernel source packages I needed.
For the kernel source code, that was easy: linux-source-2.6.32.  But for
the nvidia kernel module source package, that took a little research.
It turns out that for a video card with the RIVA TNT2 chipset,
the correct answer is nvidia-kernel-legacy-71xx-source.  I looked at the
bug reports for the corresponding Debian source package,
nvidia-graphics-drivers-legacy-71xx, and was disheartened.  Bug number
543248 looked like it was going to be a show stopper.  But for the sake
of the academic exercise, I pressed on.

The first problem is that nvidia-kernel-legacy-71xx-source exists only
in Sid.  And I run Squeeze.  So I had to update some apt files.  First,
I edited /etc/apt/sources.list.

----------

$ cd /etc/apt
$ su
# cat sources.list
deb ftp://ftp.uwsg.indiana.edu/linux/debian squeeze main non-free contrib
deb-src ftp://ftp.uwsg.indiana.edu/linux/debian squeeze main non-free contrib
deb http://security.debian.org/ squeeze/updates main non-free contrib
deb-src http://security.debian.org/ squeeze/updates main non-free contrib
# vi sources.list     [editing commands not shown]
# cat sources.list
deb ftp://ftp.uwsg.indiana.edu/linux/debian squeeze main non-free contrib
deb-src ftp://ftp.uwsg.indiana.edu/linux/debian squeeze main non-free contrib
deb http://security.debian.org/ squeeze/updates main non-free contrib
deb-src http://security.debian.org/ squeeze/updates main non-free contrib
deb ftp://ftp.uwsg.indiana.edu/linux/debian sid main non-free contrib
deb-src ftp://ftp.uwsg.indiana.edu/linux/debian sid main non-free contrib
# 

----------

As you can see, I added two lines to the end to define the sid release.
But I only wanted packages from sid that I explicitly ask for.  I
didn't want a massive update.  So I created a couple of extra files.
I will simply show you their contents.

----------

# cat apt.conf
APT::Default-Release "squeeze";
# cat preferences
Package: *
Pin: release a=sid
Pin-Priority: 1
#

----------

Note: I've heard that synaptic does not respect these files,
but I have no independent verification of that.  aptitude and
apt-get do honor it, however.  Anyway, moving on ...

----------

# aptitude update     [since sources.list, et al, were changed]
# aptitude install linux-source-2.6.32
# aptitude -t sid -R install nvidia-kernel-legacy-71xx-source
# aptitude install kernel-package fakeroot libncurses5-dev
# exit
$ cd /usr/src
$ tar -xjf linux-source-2.6.32.tar.bz2
$ rm linux-source-2.6.32.tar.bz2
$ tar -xzf nvidia-kernel-legacy-71xx-source.tar.gz
$ rm nvidia-kernel-legacy-71xx-source.tar.gz

----------

Note: the rm commands both give the following warning message:

   rm: remove write-protected regular file <file name>?

That's because both the owner name and the group name for these files
is root, and I'm issuing the rm command as a non-root user.  But
if I reply "y" to the prompts, it allows me to erase them anyway
because my non-root user is a member of group src and src is
the group owner of directory /usr/src and the group has both
read and write privileges to the directory.  Next I applied
the patch from bug number 450653 (nested fakeroot problem).
Now I was ready to build my custom kernel and the nvidia kernel
module.

----------

$ cd linux-source-2.6.32
$ cp /boot/config-2.6.32-5-686 .config
$ make menuconfig
$ make-kpkg --append-to-version -custom5-686 --revision 2.6.32-18 \
   --initrd --rootcmd fakeroot kernel_image modules_image
$ cd ..
$ su
# dpkg -i linux-image-2.6.32-custom5-686_2.6.32-18_i386.deb
# aptitude install nvidia-kernel-common
# dpkg -i nvidia-kernel-legacy-71xx-2.6.32-custom5-686_71.86.13-1+2.6.32-18_i386.deb
# dpkg-reconfigure linux-image-2.6.32-custom5-686     [not sure if needed, but ...]
# shutdown -r now;exit

----------

The system shut down and booted the new custom kernel.  Everything ran fine.
I was able to load the nvidia kernel module with

   # insmod /lib/modules/2.6.32-custom5-686/nvidia/nvidia.ko

and I was able to issue

   # modinfo /lib/modules/2.6.32-custom5-686/nvidia/nvidia.ko

and get meaningful output.  No problem.  Now for the moment of truth:

----------

# aptitude -t sid -R install nvidia-glx-legacy-71xx

----------

This step failed.  The user-space piece was incompatible with the
release of xorg installed on my squeeze system and wanted to
de-install all of my xorg-* packages.  (Bug number 543248, as feared.)
So I was not actually able to use the nvidia driver.  Maybe it would
have worked with Lenny and a 2.6.26 kernel, but not with Squeeze and
a 2.6.32 kernel.  Now if I had a newer graphics card with a newer
chipset that could have used at least the 96xx drivers, it probably
would have worked.  Nvidia hasn't updated the user-space 71xx legacy
drivers to support newer releases of xorg.  And Debian can't package what
Nvidia doesn't write.  Nevertheless, the kernel side of things appeared
to work just fine.

The moral of the story is that you don't need (or shouldn't need)
kernel header packages if you have the whole kernel source code
installed.  Note that I didn't use module-assistant or kernel headers.

-- 
  .''`.     Stephen Powell    
 : :'  :
 `. `'`
   `-


Reply to: