SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#26 2013-01-26 18:06:45

dhave
Member
Registered: 2012-11-05
Posts: 24

Re: How To: Compile the Newest (or any other) Kernel

dura wrote:

You can use smxi to remove old kernels, but it's good practice to keep one in case things go bad, perhaps. Not sure about removing them manually- but I bodged building the newest kernel for Arch the other night, and it seemed I was able to remove it by deleting the specific kernel from /etc/boot, and from /lib/modules, and then updating grub.

@dhave: to return to the stock kernel, all you have to do is choose it from grub at boot up. If you want to specify the 3.2.0.4 or whatever it is that #! comes with, then just specify that in /etc/grub putting the number of the kernel in your list as default. Check at boot- the first kernel line begins at 0.

They're also suggesting over on the Arch wiki that it is perhaps bad practice to compile kernel in /usr/src, and that instead the kernel should just be saved and compiled as normal user in your home directory.

@tlilja: the script that strips out uneccessary stuff is: sudo make localmodconfig

Thanks for this helpful info, dura.

Offline

Be excellent to each other!

#27 2013-01-26 18:19:53

Yannbane
Member
Registered: 2013-01-26
Posts: 13
Website

Re: How To: Compile the Newest (or any other) Kernel

I'm sorry to post again in such a short interval, but I have some questions...

As I've said, I have successfuly configured and compiled the kernel.

Now, I have installed it.

However, two things: the installation didn't replace my other kernel, so I now have 4 boot options in GRUB. This is quite annoying. How can I remove the 3.2 kernel? Edit: I simply used the Synaptic Package Manager and removed linux-image-3.2*.

And, my mouse simply stopped working. The trackpad still works though. What should I do?

hwinfo --mouse says:

32: USB 00.0: 10503 USB Mouse
  [Created at usb.122]
  Unique ID: R8DB.wcOF6I1xUK7
  Parent ID: FKGF.4Nx_qoDfSd7
  SysFS ID: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0
  SysFS BusID: 2-1.1:1.0
  Hardware Class: mouse
  Model: "Logitech USB Optical Mouse"
  Hotplug: USB
  Vendor: usb 0x046d "Logitech, Inc."
  Device: usb 0xc077 "USB Optical Mouse"
  Revision: "72.00"
  Compatible to: int 0x0200 0x0001 "Generic USB Mouse"
  Driver: "usbhid"
  Driver Modules: "usbhid"
  Speed: 1.5 Mbps
  Module Alias: "usb:v046DpC077d7200dc00dsc00dp00ic03isc01ip02in00"
  Driver Info #0:
    XFree86 Protocol: explorerps/2
    GPM Protocol: exps2
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #40 (Hub)

Last edited by Yannbane (2013-01-26 19:06:53)

Offline

#28 2013-01-27 10:37:29

tlilja
Member
Registered: 2012-08-20
Posts: 10

Re: How To: Compile the Newest (or any other) Kernel

dura wrote:

@tlilja: the script that strips out uneccessary stuff is: sudo make localmodconfig

Thanks, managed to figure it out myself a while ago, forgot to post that.. compiling with the .config it generated resulted in quite a lean, mean kernel image but for some reason my Atheros Wireless module (ath9k) wouldn't work on every boot, so I went back to Liquorix.

Offline

#29 2013-01-31 18:33:58

bigbenaugust
#! Junkie
From: the 919
Registered: 2009-03-04
Posts: 341

Re: How To: Compile the Newest (or any other) Kernel

The fun part will be once 3.7.5 gets done compiling on my machine and I get to make the OpenAFS modules work. I have never gotten the Debian OpenAFS modules to work with any other kernel than the stock one. So I may have to compile those from source, too. So much for DKMS taking care of this for me.


--Ben
Debian: II   Arch: II   openSUSE: I

Offline

#30 2013-01-31 19:15:33

bigbenaugust
#! Junkie
From: the 919
Registered: 2009-03-04
Posts: 341

Re: How To: Compile the Newest (or any other) Kernel

My USB devices disappeared also, and somewhere in importing the old kernel config, most of the USB controllers and devices were disabled. So in either make menuconfig or make xconfig...

Device Drivers > USB Support

and go in and turn everything on (modules are fine) and rebuild.

EDIT: I see I was beaten to this... sorry.

Last edited by bigbenaugust (2013-01-31 20:33:15)


--Ben
Debian: II   Arch: II   openSUSE: I

Offline

#31 2013-02-04 11:20:41

Dozy Van
Member
Registered: 2013-02-03
Posts: 32

Re: How To: Compile the Newest (or any other) Kernel

Thanks for the tutorial man. Since I have moved to crunchbang I have been getting a lot more technical with my usage of Operating Systems.

Thanks for this and with it I'm now on the 3.7.6 kernal. Thank you very much ^_^

Offline

#32 2013-02-05 23:58:00

kristaps
Member
From: Glasgow
Registered: 2013-01-04
Posts: 17

Re: How To: Compile the Newest (or any other) Kernel

I think someone else already mentioned this but yeah, don't go around using sudo unless you need it. The kernel can easily be built in the home directory.

Also, I believe the ncsurses package is now called

libncurses5-dev

Not a shred of evidence exists in favor of the idea that life is serious.

/Brendan Gill/

Offline

#33 2013-05-30 14:45:25

iann
#! Die Hard
Registered: 2010-09-10
Posts: 720

Re: How To: Compile the Newest (or any other) Kernel

Does anyone else prefer the xconfig tool?  I know you need a ton of qt4 garbage to make it, but for anything other than a single-pass trawl through the options it seems essential.  So many of them are dependent on so many others.

I've got custom 3.2.41 (same version as Waldorf comes with) and 3.9.4 kernels now.  All my hardware works straight off with the 3.2.41 kernel.  I don't see a lot of difference other than 3.9.4 is a bit bigger.  There are some new features in 3.9.4 (frontswap, ext4 extras, etc.), but nothing I can't live without.  3.9 has a much faster LZO decompresser which I backported into 3.2.41.  I use LZO for kernel and initrd compression, which knocks about half a second off the boot time lol

Other than just wanting to, what are people looking for when they compile their own kernels?  A newer version?  To support brand new hardware?  Performance?  Lightweight?

I optimise the build for my machine (CPUs, memory config, etc), build in all the modules needed to boot to my desktop (then strip down initrd from 10MB to 1MB because it needs no modules!), throw away drivers I'll just *never* need (saves compile time and disk space), and tweak in a few goodies (eg. cleancache).  Boot is faster and memory use is a little lower, but it is hard to see much difference other than that.  It is theoretically quite a bit faster, but very few userspace programs hit the kernel hard enough to matter.

Offline

#34 2013-12-18 01:17:24

storge
Member
Registered: 2012-12-20
Posts: 17

Re: How To: Compile the Newest (or any other) Kernel

this is the process i've been using, it works just fine but i'm interested in having other eyes look at it for critique.
first, plug in any external devices that might need kernel driver module support, then perform the following sequence.
i prepended a $ or # at the start of each line to indicate user or superuser command.

# apt-get install ccache           <-- to shorten subsequent builds
$ cd /path/to/your/kernel-buildy-place
$ wget -c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.12.X.tar.xz
$ tar xvf linux-3.12.X.tar.xz
$ cd linux-3.12.X
$ make clean
$ cp /boot/config-$(uname –r) .config
$ make localmodconfig           <-- reads lsmod and adjusts config
   if localmodconfig fails:
        a) remove out-of-tree modules, then rerun localmodconfig
                or
        b) run perl scripts
                $ chmod +x scripts/kconfig/streamline_config.pl
                $ ./scripts/kconfig/streamline_config.pl > .config
$ make menuconfig               <-- just to check config and remove any cruft
$ export CC="ccache gcc"
$ export CONCURRENCY_LEVEL=4    <-- i have a tri-core and i read that i should use number of cores +1
$ make-kpkg clean
$ fakeroot make-kpkg --append-to-version "-custom" --revision "1" --initrd kernel_image kernel_headers
$ cd ..
# dpkg -i linux-image-3.12.X-custom_1_i386.deb linux-headers-3.12.X-custom_1_i386.deb
# update-grub                   <-- do this if not already done by dpkg -i or for your paranoia
# shutdown -r now

note: '3.12.X' is whatever version, currently 3.12 series.
note: 'custom' is obviously whatever you choose to prepend to the version.

any thoughts?

Last edited by storge (2013-12-20 10:02:33)


scary times are never dull.

Offline

#35 2014-03-02 05:29:13

Alad
Software Satan
Registered: 2014-02-20
Posts: 1,512

Re: How To: Compile the Newest (or any other) Kernel

#34: Bit of a late reply but a few things

  • ccache is a great idea

  • localmodconfig is risky business and bound to cause trouble, unless you know exactly what you're doing.
    https://wiki.archlinux.org/index.php/Localmodconfig

  • I don't do fakeroot in kernel compiles. Root in /usr/src. I got the hint after the compiler explicitely warned me I should compile the kernel as root.

  • copying the current .config shouldn't be necessary, I believe make menuconfig loads it.


For those who asked how to apply patches:

patch -p1 < yourpatch.patch

in the source dir. A few popular patchsets:

https://pf.natalenko.name/
http://users.on.net/~ckolivas/kernel/
http://grsecurity.net/

Last edited by Alad (2014-03-02 05:31:25)

Offline

#36 2014-12-24 07:37:49

Viomi
Member
Registered: 2014-12-24
Posts: 48
Website

Re: How To: Compile the Newest (or any other) Kernel

So uh, I installed a kernel I don't want anymore.

Any "How to: Remove a kernel" guides?

Offline

#37 2014-12-24 09:23:32

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: How To: Compile the Newest (or any other) Kernel

Assuming you installed it via APT:

sudo apt-get purge linux-image-[whichever-kernel.version]

Offline

#38 2014-12-24 13:08:23

Viomi
Member
Registered: 2014-12-24
Posts: 48
Website

Re: How To: Compile the Newest (or any other) Kernel

pvsage wrote:

Assuming you installed it via APT:

sudo apt-get purge linux-image-[whichever-kernel.version]

Ah, sadly I didn't. I didn't have internet, so I downloaded the source on another machine and transferred it by USB. Then I compiled it and installed it that way through dpkg -i

Offline

#39 2014-12-24 13:18:45

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: How To: Compile the Newest (or any other) Kernel

Well, from the dpkg man page:

       -r, --remove, -P, --purge package...|-a|--pending
              Remove  an  installed  package. -r or --remove remove everything
              except conffiles. This may avoid having to reconfigure the pack‐
              age  if  it  is  reinstalled later. (Conffiles are configuration
              files that are listed in the DEBIAN/conffiles control file).  -P
              or  --purge  removes  everything,  including conffiles. If -a or
              --pending is given instead of a package name, then all  packages
              unpacked,   but   marked   to  be  removed  or  purged  in  file
              /var/lib/dpkg/status, are removed or purged, respectively. Note:
              some  configuration  files might be unknown to dpkg because they
              are created and handled  separately  through  the  configuration
              scripts. In that case, dpkg won't remove them by itself, but the
              package's postrm script (which is called by dpkg), has  to  take
              care of their removal during purge. Of course, this only applies
              to files in system directories, not configuration files  written
              to individual users' home directories.

Offline

#40 2014-12-24 14:50:49

Viomi
Member
Registered: 2014-12-24
Posts: 48
Website

Re: How To: Compile the Newest (or any other) Kernel

pvsage wrote:

Well, from the dpkg man page:

       -r, --remove, -P, --purge package...|-a|--pending
              Remove  an  installed  package. -r or --remove remove everything
              except conffiles. This may avoid having to reconfigure the pack‐
              age  if  it  is  reinstalled later. (Conffiles are configuration
              files that are listed in the DEBIAN/conffiles control file).  -P
              or  --purge  removes  everything,  including conffiles. If -a or
              --pending is given instead of a package name, then all  packages
              unpacked,   but   marked   to  be  removed  or  purged  in  file
              /var/lib/dpkg/status, are removed or purged, respectively. Note:
              some  configuration  files might be unknown to dpkg because they
              are created and handled  separately  through  the  configuration
              scripts. In that case, dpkg won't remove them by itself, but the
              package's postrm script (which is called by dpkg), has  to  take
              care of their removal during purge. Of course, this only applies
              to files in system directories, not configuration files  written
              to individual users' home directories.

I know how to use dpkg -r, however dpkg -l "linux*" and other searches I've done haven't found the packages at all. Going by the exact .deb name doesn't work either.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo