FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 09-29-2012, 03:09 PM
Xelsior
 
Default What is the procedure for patching the Debian kernel ?

Hello,

I been following http://kernel-handbook.alioth.debian.org and
http://wiki.debian.org/HowToRebuildAnOfficialDebianKernelPackage

I did successfully build an real time kernel on Wheezy using
"test-patches" but a package update resulted in the breaking of the
Nvidia DKMS driver build. This may be due to a bug or possibly the way
I originally built my rt kernel (bug:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688567 ). By the look
of it the problem could be due to a conflict between the versions
"3.2.23-1a~test" and "3.2.23-1", but I could be wrong about that.

I did start to apply the extra patches to the Debian kernel another
way as test-patches is not recommended if you are making config
changes (following
http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s4.2.3
).

Added patches into linux-3.2.23/debian/patches/bugfix/x86.

Added patch entries to "series" file in linux-3.2.23/debian/patches.

Added "CONFIG_HZ_1000=y" and "CONFIG_HZ=1000" lines to
linux-3.2.23/debian/config/featureset-rt/config.

Then did "fakeroot debian/rules source".

Then "fakeroot make -f debian/rules.gen binary-arch_i386_rt_686-pae"
(how do I do this with multiple CPU cores?).

However this did not actually patch the correct files in the
debian/source directory.

What is the procedure to correctly apply my patches (in order to get a
piece of music hardware working sound/usb) ? Plus how do I manage the
resulting package so that package updates don't break my system such
as has happened with the Nvidia driver ?

Any help appreciated.

============ CLI MESSAGES

djbarney@djbarney-osiris:~$ uname -a
Linux djbarney-osiris 3.2.0-3-rt-686-pae #1 SMP PREEMPT RT Sun Aug 19
14:49:13 BST 2012 i686 GNU/Linux

djbarney@djbarney-osiris:~/Build$ sudo apt-get install --reinstall
nvidia-kernel-dkms
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 27 not upgraded.
Need to get 0 B/6,865 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 271515 files and directories currently installed.)
Preparing to replace nvidia-kernel-dkms 304.48-1 (using
.../nvidia-kernel-dkms_304.48-1_i386.deb) ...

------------------------------
Deleting module version: 304.48
completely from the DKMS tree.
------------------------------
Done.
Unpacking replacement nvidia-kernel-dkms ...
Setting up nvidia-kernel-dkms (304.48-1) ...
Loading new nvidia-304.48 DKMS files...
Building only for 3.2.0-3-rt-686-pae
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.

djbarney@djbarney-osiris:~/Build$ sudo dpkg --install
linux-headers-3.2.0-3-rt-686-pae_3.2.23-1a~test_i386.deb
(Reading database ... 277340 files and directories currently installed.)
Preparing to replace linux-headers-3.2.0-3-rt-686-pae 3.2.23-1a~test
(using linux-headers-3.2.0-3-rt-686-pae_3.2.23-1a~test_i386.deb) ...
Unpacking replacement linux-headers-3.2.0-3-rt-686-pae ...
dpkg: dependency problems prevent configuration of
linux-headers-3.2.0-3-rt-686-pae:
linux-headers-3.2.0-3-rt-686-pae depends on linux-headers-3.2.0-3-common-rt (=
3.2.23-1a~test); however:
Version of linux-headers-3.2.0-3-common-rt on system is 3.2.23-1.

dpkg: error processing linux-headers-3.2.0-3-rt-686-pae (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-headers-3.2.0-3-rt-686-pae

--
~~~
http://djbarney.org
~~~


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/CADMQe-m7n8XT3nEkg2KwOTcHoL3Nrv0_=JirYL6dDBGnhb9A+g@mail. gmail.com
 
Old 09-29-2012, 09:19 PM
Stephen Powell
 
Default What is the procedure for patching the Debian kernel ?

On Sat, 29 Sep 2012 11:09:46 -0400 (EDT), Xelsior wrote:
> ...
> I did start to apply the extra patches to the Debian kernel another
> way as test-patches is not recommended if you are making config
> changes (following
> http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s4.2.3
> ).
> ...
> Then did "fakeroot debian/rules source".
>
> Then "fakeroot make -f debian/rules.gen binary-arch_i386_rt_686-pae"
> (how do I do this with multiple CPU cores?).
>
> However this did not actually patch the correct files in the
> debian/source directory.
>
> What is the procedure to correctly apply my patches
> ...
> Any help appreciated.

I'm not sure if this will help or not, but you might want to take
a look at

http://users.wowway.com/~zlinuxman/Kernel.htm

It might answer some of your questions. The above is an unofficial
kernel building web page which does talk about applying patches,
using multiple CPUs, etc.

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


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1758089097.179265.1348953552532.JavaMail.root@md01 .wow.synacor.com">http://lists.debian.org/1758089097.179265.1348953552532.JavaMail.root@md01 .wow.synacor.com
 
Old 09-30-2012, 01:26 PM
Xelsior
 
Default What is the procedure for patching the Debian kernel ?

Stephen Powell,

Thanks. That looks great ! So I'm not the only one ...

"I have found that the documentation for kernel building in Debian is
spread out over several different sources. Some of these documents
are out of date. Furthermore, there are a number of small but
important steps that are often left out."

So I'll study your document and get back to the list if I have further problems.

BTW, if you are interested, I started my own guide here -
http://stargate.djbarney.org/node/188
Currently it's in an unfinished state but I hope to bring it up to a
standard that is useful to ordinary users such as myself. I am a
musician who needed to patch the kernel in order to get a piece of
music hardware working.

I also intend to lobby Debian to improve their official kernel build
documentation as it looks like it has been left in a non-updated state
and needs (I'd say fairly urgent) review.

Barney Holmes

On 29 September 2012 22:19, Stephen Powell <zlinuxman@wowway.com> wrote:
> On Sat, 29 Sep 2012 11:09:46 -0400 (EDT), Xelsior wrote:
>> ...
>> I did start to apply the extra patches to the Debian kernel another
>> way as test-patches is not recommended if you are making config
>> changes (following
>> http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s4.2.3
>> ).
>> ...
>> Then did "fakeroot debian/rules source".
>>
>> Then "fakeroot make -f debian/rules.gen binary-arch_i386_rt_686-pae"
>> (how do I do this with multiple CPU cores?).
>>
>> However this did not actually patch the correct files in the
>> debian/source directory.
>>
>> What is the procedure to correctly apply my patches
>> ...
>> Any help appreciated.
>
> I'm not sure if this will help or not, but you might want to take
> a look at
>
> http://users.wowway.com/~zlinuxman/Kernel.htm
>
> It might answer some of your questions. The above is an unofficial
> kernel building web page which does talk about applying patches,
> using multiple CPUs, etc.
>
> --
> .'`. Stephen Powell
> : :' :
> `. `'`
> `-
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: http://lists.debian.org/1758089097.179265.1348953552532.JavaMail.root@md01 .wow.synacor.com
>



--
~~~
http://djbarney.org
~~~


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/CADMQe-kQxefEmdN8U35J=7yKa0=EoPUd08zuq9q+GP+MHLv=QA@mail. gmail.com
 
Old 09-30-2012, 10:17 PM
Xelsior
 
Default What is the procedure for patching the Debian kernel ?

So, interesting document.

I actually found an RT kernel in the repository ... the one linked
from here - http://wiki.debian.org/DebianMultimedia#Realtime_kernel

However that does not have the patches applied to usb/audio for the
Electrix Ebox44. It also does not have ...

CONFIG_HZ_1000=y
CONFIG_HZ=1000

Is there a SIMPLE procedure here to build this kernel image (or the
stock one that downloads the rt patch in a separate archive).

All I need to do is build everything as it is out of the box ACCEPT
for a couple of patches to usb/audio AND the two config options. Of
course the revision string must be right otherwise there are conflicts
with linux-headers and DKMS.

Barney Holmes

--
~~~
http://djbarney.org
~~~


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/CADMQe-kc6mXHsPDS5cuk-kBYWvqsP2NW+cCM_CcaGmA=pS4srw@mail.gmail.com
 
Old 10-01-2012, 01:39 AM
Stephen Powell
 
Default What is the procedure for patching the Debian kernel ?

On Sun, 30 Sep 2012 18:17:36 -0400 (EDT), Xelsior wrote:
>
> So, interesting document.
>
> I actually found an RT kernel in the repository ... the one linked
> from here - http://wiki.debian.org/DebianMultimedia#Realtime_kernel
>
> However that does not have the patches applied to usb/audio for the
> Electrix Ebox44. It also does not have ...
>
> CONFIG_HZ_1000=y
> CONFIG_HZ=1000
>
> Is there a SIMPLE procedure here to build this kernel image (or the
> stock one that downloads the rt patch in a separate archive).
>
> All I need to do is build everything as it is out of the box ACCEPT
> for a couple of patches to usb/audio AND the two config options. Of
> course the revision string must be right otherwise there are conflicts
> with linux-headers and DKMS.

Building a custom kernel is not a simple procedure. Period.
Of course, the more changes you make, the more complicated the
procedure is. But even making a simple change involves doing
a lot of things. If you have out-of-kernel-source-tree modules
you need to build, and there is no Debian source package for it
that is designed to work with kernel-package, then you will
probably need to build custom headers, as well as a custom kernel.
The document to which I referred explains how to do this, but
the short answer is to use the kernel_headers target in addition
to the kernel_image target. For example:

fakeroot make-kpkg ... kernel_image kernel_headers

Note that when building a headers package you must run the entire
make-kpkg command under fakeroot: you can't use the --rootcmd fakeroot
option in this case.

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


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 925925381.194221.1349055542693.JavaMail.root@md01. wow.synacor.com">http://lists.debian.org/925925381.194221.1349055542693.JavaMail.root@md01. wow.synacor.com
 
Old 10-01-2012, 01:39 PM
Tom H
 
Default What is the procedure for patching the Debian kernel ?

On Sat, Sep 29, 2012 at 11:09 AM, Xelsior <xelsior24@gmail.com> wrote:
>
> I been following http://kernel-handbook.alioth.debian.org and
> http://wiki.debian.org/HowToRebuildAnOfficialDebianKernelPackage
>
> I did successfully build an real time kernel on Wheezy using
> "test-patches" but a package update resulted in the breaking of the
> Nvidia DKMS driver build. This may be due to a bug or possibly the way
> I originally built my rt kernel (bug:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688567 ). By the look
> of it the problem could be due to a conflict between the versions
> "3.2.23-1a~test" and "3.2.23-1", but I could be wrong about that.
>
> I did start to apply the extra patches to the Debian kernel another
> way as test-patches is not recommended if you are making config
> changes (following
> http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s4.2.3
> ).
>
> Added patches into linux-3.2.23/debian/patches/bugfix/x86.
>
> Added patch entries to "series" file in linux-3.2.23/debian/patches.
>
> Added "CONFIG_HZ_1000=y" and "CONFIG_HZ=1000" lines to
> linux-3.2.23/debian/config/featureset-rt/config.
>
> Then did "fakeroot debian/rules source".
>
> Then "fakeroot make -f debian/rules.gen binary-arch_i386_rt_686-pae"
> (how do I do this with multiple CPU cores?).
>
> However this did not actually patch the correct files in the
> debian/source directory.
>
> What is the procedure to correctly apply my patches (in order to get a
> piece of music hardware working sound/usb)?

I tried once to get "debian/rules ..." to apply a patch and failed so
I just ran the patch manually and then ran "debian/rules ...". I
remember from the documentation that I googled that after you drop a
patch into "debian/patches", you have to do something with quilt. I
remember the howto writer using the term "debianized" or "debian-only"
patch.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SwEqyo=j=YDWWMJos_+=P9iP4D5HnndsSWaHgVxRP8-aw@mail.gmail.com
 
Old 10-02-2012, 05:12 PM
Xelsior
 
Default What is the procedure for patching the Debian kernel ?

Soon after writing this message and after studying your document I
realised I'd forgotten something. As I found there are complexities
such as the revision string that need to be known about, as are
covered in your document, and your document will certainly come in
useful for any future problems !

The thing I forgot is that I originally used test-patches (in
debian/bin). I had the problem with the conflict of revision strings;
test-patches adds "a~test". So I thought, "why not remove this string"
? I ended up editing test-patches ...

# Append 'a~test' to Debian version; this should be less than any official
# successor and easily recognisable
# version="$(dpkg-parsechangelog | sed 's/^Version: //; t; d')"
# if [ "${version%a~test}" = "$version" ]; then
# version="$version"a~test
# dch -v "$version" --distribution UNRELEASED "Testing patches $*"
#fi

I commented out lines 50 to 56. Now test-patches builds the kernel
without the revision string mismatch. I proceeded to install Nvidia
DKMS without any problems (therefore fixing my original problem).

sudo apt-get source linux
cd linux-3.2.23
sudo chown -R djbarney.djbarney *
sudo chown -R djbarney.djbarney .*
Config options added to debian/config/featureset-rt/config
bash debian/bin/test-patches -f 686-pae -s rt -j 4
../alsa-snd-usb-audio-Replace-mixer-for-Electrix-Ebox-44.patch
../alsa-snd-usb-audio-Skip-un-parseable-mixer-units.patch

This builds ...

linux-headers-3.2.0-3-rt-686-pae_3.2.23-1_i386.deb
linux-image-3.2.0-3-rt-686-pae_3.2.23-1_i386.deb
linux-image-3.2.0-3-rt-686-pae-dbg_3.2.23-1_i386.deb

After installing the RT kernel and booting on it I run ...

sudo apt-get install --reinstall nvidia-kernel-dkms

I know this actually creates (I think) a revision string conflict with
official packages. But I can live with that. I just need to reinstall
after any future updates.

Testing currently shows qjackctl (Jack Audio) reporting a working
real-time system, with my external USB audio hardware (the patches for
ebox) with ZERO X-Runs and a 10.7ms latency.

So I seem to have stumbled upon a method that seems to be reserved by
Debian kernel developers for testing patches that actually makes this
process pretty painless. Of course some of this may be dependent on
the current state of Wheezy testing and other Debian kernel policies
that seem to be in flux. Hopefully what I've discovered here can help
other people who need to patch the kernel (to get hardware working,
etc) and encourage the development and documentation of procedures to
make all this a relatively painless process.

Barney Holmes

On 1 October 2012 02:39, Stephen Powell <zlinuxman@wowway.com> wrote:
> On Sun, 30 Sep 2012 18:17:36 -0400 (EDT), Xelsior wrote:
>>
>> So, interesting document.
>>
>> I actually found an RT kernel in the repository ... the one linked
>> from here - http://wiki.debian.org/DebianMultimedia#Realtime_kernel
>>
>> However that does not have the patches applied to usb/audio for the
>> Electrix Ebox44. It also does not have ...
>>
>> CONFIG_HZ_1000=y
>> CONFIG_HZ=1000
>>
>> Is there a SIMPLE procedure here to build this kernel image (or the
>> stock one that downloads the rt patch in a separate archive).
>>
>> All I need to do is build everything as it is out of the box ACCEPT
>> for a couple of patches to usb/audio AND the two config options. Of
>> course the revision string must be right otherwise there are conflicts
>> with linux-headers and DKMS.
>
> Building a custom kernel is not a simple procedure. Period.
> Of course, the more changes you make, the more complicated the
> procedure is. But even making a simple change involves doing
> a lot of things. If you have out-of-kernel-source-tree modules
> you need to build, and there is no Debian source package for it
> that is designed to work with kernel-package, then you will
> probably need to build custom headers, as well as a custom kernel.
> The document to which I referred explains how to do this, but
> the short answer is to use the kernel_headers target in addition
> to the kernel_image target. For example:
>
> fakeroot make-kpkg ... kernel_image kernel_headers
>
> Note that when building a headers package you must run the entire
> make-kpkg command under fakeroot: you can't use the --rootcmd fakeroot
> option in this case.
>
> --
> .'`. Stephen Powell
> : :' :
> `. `'`
> `-
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: http://lists.debian.org/925925381.194221.1349055542693.JavaMail.root@md01. wow.synacor.com
>



--
~~~
http://djbarney.org
~~~


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CADMQe-mVgE1wAfHTAO77sPxj-LQNetX6GqbhT8d7Zf_E1nyWag@mail.gmail.com">http://lists.debian.org/CADMQe-mVgE1wAfHTAO77sPxj-LQNetX6GqbhT8d7Zf_E1nyWag@mail.gmail.com
 
Old 10-03-2012, 07:02 AM
Ralf Mardorf
 
Default What is the procedure for patching the Debian kernel ?

> On 1 October 2012 02:39, Stephen Powell <zlinuxman@wowway.com> wrote:
> > On Sun, 30 Sep 2012 18:17:36 -0400 (EDT), Xelsior wrote:
> >>
> > Note that when building a headers package you must run the entire
> > make-kpkg command under fakeroot: you can't use the --rootcmd fakeroot
> > option in this case.

I always run

make oldconfig
make-kpkg clean
make-kpkg --rootcmd fakeroot --initrd kernel-image kernel-headers
make-kpkg clean
dpkg -i ../linux-image-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
dpkg -i ../linux-headers-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb

by a script. It does work, but I run the script as root, so I guess I
could remove --rootcmd fakeroot , OTOH I suspect I used those lines as
user, before I build kernels by scripts as root.

Regards,
Ralf


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/1349247740.1150.8.camel@localhost.localdomain
 
Old 10-04-2012, 12:02 AM
Stephen Powell
 
Default What is the procedure for patching the Debian kernel ?

On Wed, 03 Oct 2012 03:02:20 -0400 (EDT), Ralf Mardorf wrote:
> On Sun, 30 Sep 2012 21:39:02 -0400 (EDT), Stephen Powell wrote:
>> Note that when building a headers package you must run the entire
>> make-kpkg command under fakeroot: you can't use the --rootcmd fakeroot
>> option in this case.
>
> I always run
>
> make oldconfig
> make-kpkg clean
> make-kpkg --rootcmd fakeroot --initrd kernel-image kernel-headers
> make-kpkg clean
> dpkg -i ../linux-image-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
> dpkg -i ../linux-headers-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
>
> by a script. It does work, but I run the script as root, so I guess I
> could remove --rootcmd fakeroot , OTOH I suspect I used those lines as
> user, before I build kernels by scripts as root.

Yes, it does work as root, with or without the --rootcmd fakeroot option. ;-)
And it works as a non-root user too, if you leave off the kernel_headers
target. But I tested this specific scenario before I wrote what I wrote,
and the --rootcmd fakeroot option does not work with the kernel_headers
target if invoked by a non-root user. You must leave off the
--rootcmd fakeroot option (to avoid nested invocations of fakeroot) and
run the entire make-kpkg command under fakeroot if you use the kernel_headers
target.

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


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1965044950.259258.1349308929486.JavaMail.root@md01 .wow.synacor.com">http://lists.debian.org/1965044950.259258.1349308929486.JavaMail.root@md01 .wow.synacor.com
 

Thread Tools




All times are GMT. The time now is 07:25 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org