Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Guide: Compile Custom Kernel for Ubuntu.
New Posts  All Forums:Forum Nav:

Guide: Compile Custom Kernel for Ubuntu.

post #1 of 13
Thread Starter 
Was going thru my bookmarks today and started reading all the ones I've bookmarked over the years on how to compile a kernel for various distro's, including ubuntu.

One thing I noticed, they have things in common, but are wildly different in their steps and execution.

For a noob, compiling a kernel is an already daunting task, so to try to minimize the frustration, I will attempt to create my own guide, with the minimal amount of steps required with as much detail as needed.


Step 1: Getting your system ready.

Open up a terminal, you will need to install a few packages.
Code:
sudo apt-get update
sudo apt-get install build-essential kernel-package libncurses5-dev fakeroot wget bzip2
Quote:
Originally Posted by chemicalfan;15432027 


Edit: If you issue
Code:
export CFLAGS="-march=native -O2 -pipe"
export CXXFLAGS="-march=native -O2 -pipe"


Step 2: Getting Kernel Source code.

There are several ways to do this. You can get it from GIT, kernel.org or you can grab the source for it from apt-get. I will cover how to get it from apt-get and from kernel.org (getting it from GIT would require extra steps injected into this guide and this guide isn't meant to be that advanced.)

You will have to decide which kernel you want. you can go to kernel.org to find out which ones are available, I highly recomend staying within the stable branch, or even with the version that ubuntu comes with. I will be using kernel 3.0 in this example (as it is the version that comes with ubuntu 11.10).

You can acquire the source using wget (you will need to open a terminal):
Code:
cd /usr/src
sudo wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.bz2

or you can go to kernel.org, and download it directly from there and then move the source. Once downloaded, open a terminal.
Code:
cd Downloads
sudo mv linux-3.0.tar.bz3 /usr/src

The other way i mentioned, you can grab current source of the ubuntu kernel from apt-get. Open up a terminal:
Code:
sudo apt-get install linux-source

This will download and place the source tarball in /usr/src. (note this source will include ubuntu patches, which some might need. I will however not explain how to patch the vanilla kernel from kernel.org, so if you need something that is patched into the ubuntu kernel source, then i advise you sticking with this method of acquiring the source code.


Step 3: Unpacking The Source.

If you Followed the steps above, then the source tarball should already be in /usr/src, if not, you will need to move it there. Open up a terminal:
Code:
cd /usr/src
sudo tar -xjf linux-*.tar.bz2

Step 4: The Fun

Now we will need to enter the the directory of the unzipped tarball.
Code:
cd /usr/src/linux-3.0

or for apt-get source

cd /usr/src/linux-source-3.0.0



I typically use the existing configuration of the running kernel, you can skip this step if you want to use a different one.
Code:
sudo cp /boot/config-`uname -r` ./.config

This will copy over the current running kernels configuration to the source. Now you need to make sure this config file is compatible with the source:

Code:
sudo make oldconfig

This command can produce a bunch of questions, on how you want to handle the new modules or even new features of new kernels, answer the best of your ability. Once that is done, we can now configure the kernel.

or you can do this:
Quote:
Originally Posted by gonX;15441416 
Try doing a 'make localmodconfig' before starting the actual configuration progress - it empties out your config file from currently set up but unloaded modules - make sure all hardware is plugged in and working before doing this though, as otherwise the unplugged hardware may not work when you need it next time, or at least not without a kernel recompile.

The only real advantage to doing that is to reduce the kernel compile time, though. The most important performance gains you can get is definitely not from removing unused modules, though, as the only performance penalty you can get when the modules are not loaded are the extra symbols that MIGHT have been compiled into the full kernel, which in the end do not show up even on synthetic benchmarks in my experience.

and then move onto:
Code:
sudo make menuconfig

First thing to do, is go down, an locate:
Code:
Load an Alternate configuration File

load the .config.

It is best at this stage, to know what you are doing or wanting to do. If you don't understand what something is, Either trust the almighty google or highlight the option and hit H, to read the notes.

Here are some suggestions about once inside the configuration to make:
Quote:
Originally Posted by lloyd mcclendon;15440535 
nice guide. regarding the config, a couple things

I am a huge fan of turning on General setup > kernel.config support > enable access to .config through /proc/config.gz (CONFIG_IKCONFIG_PROC).

So you always have access to the right config ... zcat /proc/config.gz > /usr/src/linux/.config ... for some reason a lot of distros don't turn this on (because distro configs always all suck). no guarantee i haven't somehow screwed up the static file in /boot inadvertently, i know /proc is correct.

In a lot of ways it's more productive to start from scratch as opposed to taking the terrible kernel you have and trimming it down.. Even better, this guy always posts some good practically empty seeds to start with http://kernel-seeds.org/seeds/64_bit/ .. start there but you still want to spend a few hours reading every option and make sure you are enabling things your system needs.

Don't be frustrated if it doesn't fully boot the first few tries.. it's pretty easy to resolve anything with google. Try to avoid kernel patches you do not understand or are unstable.

Where the whole deb thing is not available, to build

# make && make modules_install && make install && $EDITOR /boot/grub/grub.conf (or menu.lst)


Once you are done with the configuration, save the changes.
Code:
sudo CONCURRENCY_LEVEL=[COLOR="red"]#ofthreads[/COLOR] fakeroot make-kpkg --initrd --append-to-version=[COLOR="red"]-Custom-Name[/COLOR] kernel_image kernel_headers

The first Red section, is how many threads/cores you want to use to compile a kernel. if you have a dual core, put 2 here, if you have a quadcore, put 4 here. (if you want to completely max it out, add core+1. dual core place 3, quadcore, place 5, quadcore+HT, place 9.)

The secon red section, is what you want to call the custom kernel you have built, it needs to start with a - and must not contain any whitespaces.

Once you are done with setting up this string, run it. Set back, it can take awhile depending on how many cores and cpu speed. Once it is done, in /usr/src, it will create 2 new packages, one are the header files, the other is the kernel image. you can now install them.
Code:
cd /usr/src
ls -l
sudo dpkg -i dpkg -i linux-image-3.0.0-custom_3.0.0-custom-10.00.Custom_amd64.deb
sudo dpkg -i linux-headers-3.0.0-custom_3.0.0-custom-10.00.Custom_amd64.deb

^you will of course need to alter the name of the deb files to match your version of the kernel and the custom name you used.
Code:
sudo update-grub

Once done, you should be able to restart, and now be able to choose your custom kernel from the grub menu list at the boot loader. (if not, you will need to manual add it.)

Step 5: Why would I want to do this?

Well Ubuntu ships with what they call a Generic kernel. which is bloated with all sorts of options, kernel drivers, and patches you might not need. or it doesn't include something you want it to include. There are a lot of reasons why one would want to compile their own custom kernel.

One of the biggest benefits to a custom kernel, is the optimization you can make to it to match your cpu and your system. It could improve performance of your ubuntu install greatly.

The other reason, you might have a non-standard configuration of hardware, that you need ubuntu to use correctly and the only way to do that is to setup a customized kernel.

And the Greatest reason behind doing this, the knowledge you can walk away with, how often have you been given a chance to see on the most basic level, how a computer runs, and then make the decisions that can effect the way it does smile.gif.
Edited by Transhour - 10/25/11 at 5:43am
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
post #2 of 13
Nice guide. Getting the latest kernel though is as simple as going to github and downloading the tarball, as kernel.org and git.kernel.org are outdated because of the breach. It is the 3.1 rc10 however.
Arcadius
(8 items)
 
Cyrillus
(7 items)
 
 
CPUMotherboardGraphicsRAM
Intel i5-3570k ASUS P8Z77-V LE MSI Geforce GTX 660 Ti Corsair Vengeance Blue 
Hard DriveOSPowerCase
WD Caviar Blue Arch Linux (XFCE) Corsair GS600 Corsair Carbide 300R 
CPUMotherboardGraphicsRAM
i5-3317U Proprietary HD Graphics 4000 Proprietary 
Hard DriveOSCase
520 Series FreeBSD (GNOME) Zenbook Prime UX31A-DH51 
  hide details  
Reply
Arcadius
(8 items)
 
Cyrillus
(7 items)
 
 
CPUMotherboardGraphicsRAM
Intel i5-3570k ASUS P8Z77-V LE MSI Geforce GTX 660 Ti Corsair Vengeance Blue 
Hard DriveOSPowerCase
WD Caviar Blue Arch Linux (XFCE) Corsair GS600 Corsair Carbide 300R 
CPUMotherboardGraphicsRAM
i5-3317U Proprietary HD Graphics 4000 Proprietary 
Hard DriveOSCase
520 Series FreeBSD (GNOME) Zenbook Prime UX31A-DH51 
  hide details  
Reply
post #3 of 13
Thread Starter 
yeah people can use any means available to them to get the source for the kernel. I was just covering the basics that I personally use.
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
post #4 of 13
Err, if you run with the existing Ubuntu config, it'll be just as bloated as your started (albeit a newer version). Surely it's better to config the kernel yourself, removing the drivers you don't need (or at least modularising them)? It's not as easy, but it's the old addage (do you want something done fast, or do you want something done right?).

It'd be handy if there was an equivalent of the AUR for Ubuntu, maybe there is and I just don't know it. Hell, a custom Arch kernel might even work on Ubuntu, there's a real hack!

Edit: If you issue
Code:
export CFLAGS="-march=native -O2 -pipe"
export CXXFLAGS="-march=native -O2 -pipe"
before you start, that should compile more optimised code (assuming the makefile is built that way - I always use the AUR so I'm not 100% sure on that)
Edited by chemicalfan - 10/24/11 at 5:38am
Little Beast
(12 items)
 
Black 'n' blue II
(15 items)
 
 
CPUGraphicsRAMHard Drive
Intel Core i7-4710MQ Nvidia Geforce GTX860M 2GB 16GB Kingston DDR3 1600MHz 240Gb Silicon Power S55/S60 SSD 
Hard DriveOSOSMonitor
1Tb Toshiba HDD 5400rpm Windows 8.1 Linux Mint 18 17.3" LED 1920x1080 
CaseMouseMouse PadAudio
PCSpecialist Optimus V ST17-860 Logitech MX518 Steelseries QcK Creative HS800 Fatal1ty 
CPUMotherboardGraphicsRAM
Core i7 860 @ 1.25V MSI P55-GD65 Xpertvision Radeon HD4850 4GB G.Skill Ripjaw 
Hard DriveOptical DriveCoolingOS
150Gb Velociraptor & 1Tb WD Caviar Black Opticon Lightscribe DVD-RW DL Noctua NH-U12P SE2 Vista Home Premium x64 
MonitorKeyboardPowerCase
Hyundai BlueH H224W 22" LCD Saitek Eclipse II Thermaltake Purepower RX 550 Galaxy III 
Mouse
Patuoxun optical gaming mouse 3200dpi 
  hide details  
Reply
Little Beast
(12 items)
 
Black 'n' blue II
(15 items)
 
 
CPUGraphicsRAMHard Drive
Intel Core i7-4710MQ Nvidia Geforce GTX860M 2GB 16GB Kingston DDR3 1600MHz 240Gb Silicon Power S55/S60 SSD 
Hard DriveOSOSMonitor
1Tb Toshiba HDD 5400rpm Windows 8.1 Linux Mint 18 17.3" LED 1920x1080 
CaseMouseMouse PadAudio
PCSpecialist Optimus V ST17-860 Logitech MX518 Steelseries QcK Creative HS800 Fatal1ty 
CPUMotherboardGraphicsRAM
Core i7 860 @ 1.25V MSI P55-GD65 Xpertvision Radeon HD4850 4GB G.Skill Ripjaw 
Hard DriveOptical DriveCoolingOS
150Gb Velociraptor & 1Tb WD Caviar Black Opticon Lightscribe DVD-RW DL Noctua NH-U12P SE2 Vista Home Premium x64 
MonitorKeyboardPowerCase
Hyundai BlueH H224W 22" LCD Saitek Eclipse II Thermaltake Purepower RX 550 Galaxy III 
Mouse
Patuoxun optical gaming mouse 3200dpi 
  hide details  
Reply
post #5 of 13
Thread Starter 
Quote:
Originally Posted by chemicalfan;15432027 
Err, if you run with the existing Ubuntu config, it'll be just as bloated as your started (albeit a newer version). Surely it's better to config the kernel yourself, removing the drivers you don't need (or at least modularising them)? It's not as easy, but it's the old addage (do you want something done fast, or do you want something done right?).

It'd be handy if there was an equivalent of the AUR for Ubuntu, maybe there is and I just don't know it. Hell, a custom Arch kernel might even work on Ubuntu, there's a real hack!

Edit: If you issue
Code:
export CFLAGS="-march=native -O2 -pipe"
export CXXFLAGS="-march=native -O2 -pipe"
before you start, that should compile more optimised code (assuming the makefile is built that way - I always use the AUR so I'm not 100% sure on that)

You can use the existing config as a base, then optimize off that, I have a configuration file i've been using since 8.04, that I just run oldconfig on each time a new release launches. I'll go thru and tidy it up here and there as well.

debian has a source repo, works a lot like the AUR that is maintained by the debian maintainers, and ubuntu does as well. Pretty simple to use:


sudo apt-get build-dep

^this grabs all the dependencies required to build it.


sudo apt-get -b source

^this will grab the source and compile it, leaving you a nice little .deb file to install (been awhile since I used it, might even install it after it is done compiling.). I myself, maintain scripts that are similar to slackbuilds that will grab source/dependencies (some of them will compile dependencies as well, but most of the time it just grabs the binary ones.), that will build them as packages, install, and then save the package on a backup drive. In the event I ever need it again, I can install it, or build it from source.

as for if you can run a arch kernel in ubuntu, the answer is yes. I've run slackware/fedora and non-initramfs kernels in ubuntu before. You have to manual install them of course smile.gif, you could also take the .config from another distro, and build a kernel into a package using this guide smile.gif.
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
post #6 of 13
nice guide. regarding the config, a couple things

I am a huge fan of turning on General setup > kernel.config support > enable access to .config through /proc/config.gz (CONFIG_IKCONFIG_PROC).

So you always have access to the right config ... zcat /proc/config.gz > /usr/src/linux/.config ... for some reason a lot of distros don't turn this on (because distro configs always all suck). no guarantee i haven't somehow screwed up the static file in /boot inadvertently, i know /proc is correct.

In a lot of ways it's more productive to start from scratch as opposed to taking the terrible kernel you have and trimming it down.. Even better, this guy always posts some good practically empty seeds to start with http://kernel-seeds.org/seeds/64_bit/ .. start there but you still want to spend a few hours reading every option and make sure you are enabling things your system needs.

Don't be frustrated if it doesn't fully boot the first few tries.. it's pretty easy to resolve anything with google. Try to avoid kernel patches you do not understand or are unstable.

Where the whole deb thing is not available, to build

# make && make modules_install && make install && $EDITOR /boot/grub/grub.conf (or menu.lst)
Edited by lloyd mcclendon - 10/24/11 at 5:43pm
stable again
(25 items)
 
  
CPUCPUMotherboardGraphics
E5-2687W E5-2687W ASUS Z9PED8-WS EVGA GTX 570 (Linux host) 
GraphicsRAMHard DriveHard Drive
EVGA GTX 970 FTW (win7 guest) 64GB G.SKILL 2133 2x Crucial M4 256GB raid1 4x 3TB raid 10 
CoolingCoolingCoolingCooling
2x Apogee HD  2x RX 480 2x MCP 655 RP-452x2 rev2 (new) 
CoolingCoolingOSOS
16x Cougar Turbine CFT12SB4 (new) EK FC 580 Gentoo (host) Gentoo (x23 guests) 
OSMonitorMonitorPower
windows 7 (guest w/ vfio-pci) Viewsonic 23" 1080P Viewsonic 19" Antec HCP Platinum 1000 (new) 
CaseOtherOther
Case Labs TH10 (still the best ever) 2x Lamptron FC-5 IOGEAR 2 way DVI KVM Switch 
  hide details  
Reply
stable again
(25 items)
 
  
CPUCPUMotherboardGraphics
E5-2687W E5-2687W ASUS Z9PED8-WS EVGA GTX 570 (Linux host) 
GraphicsRAMHard DriveHard Drive
EVGA GTX 970 FTW (win7 guest) 64GB G.SKILL 2133 2x Crucial M4 256GB raid1 4x 3TB raid 10 
CoolingCoolingCoolingCooling
2x Apogee HD  2x RX 480 2x MCP 655 RP-452x2 rev2 (new) 
CoolingCoolingOSOS
16x Cougar Turbine CFT12SB4 (new) EK FC 580 Gentoo (host) Gentoo (x23 guests) 
OSMonitorMonitorPower
windows 7 (guest w/ vfio-pci) Viewsonic 23" 1080P Viewsonic 19" Antec HCP Platinum 1000 (new) 
CaseOtherOther
Case Labs TH10 (still the best ever) 2x Lamptron FC-5 IOGEAR 2 way DVI KVM Switch 
  hide details  
Reply
post #7 of 13
Every time I've tried to compile my own kernel it usually ends up being MORE bloated then the original one, so I just stopped trying. tongue.gif And yes I do disable everything I don't need.
Arcadius
(8 items)
 
Cyrillus
(7 items)
 
 
CPUMotherboardGraphicsRAM
Intel i5-3570k ASUS P8Z77-V LE MSI Geforce GTX 660 Ti Corsair Vengeance Blue 
Hard DriveOSPowerCase
WD Caviar Blue Arch Linux (XFCE) Corsair GS600 Corsair Carbide 300R 
CPUMotherboardGraphicsRAM
i5-3317U Proprietary HD Graphics 4000 Proprietary 
Hard DriveOSCase
520 Series FreeBSD (GNOME) Zenbook Prime UX31A-DH51 
  hide details  
Reply
Arcadius
(8 items)
 
Cyrillus
(7 items)
 
 
CPUMotherboardGraphicsRAM
Intel i5-3570k ASUS P8Z77-V LE MSI Geforce GTX 660 Ti Corsair Vengeance Blue 
Hard DriveOSPowerCase
WD Caviar Blue Arch Linux (XFCE) Corsair GS600 Corsair Carbide 300R 
CPUMotherboardGraphicsRAM
i5-3317U Proprietary HD Graphics 4000 Proprietary 
Hard DriveOSCase
520 Series FreeBSD (GNOME) Zenbook Prime UX31A-DH51 
  hide details  
Reply
post #8 of 13
Try doing a 'make localmodconfig' before starting the actual configuration progress - it empties out your config file from currently set up but unloaded modules - make sure all hardware is plugged in and working before doing this though, as otherwise the unplugged hardware may not work when you need it next time, or at least not without a kernel recompile.

The only real advantage to doing that is to reduce the kernel compile time, though. The most important performance gains you can get is definitely not from removing unused modules, though, as the only performance penalty you can get when the modules are not loaded are the extra symbols that MIGHT have been compiled into the full kernel, which in the end do not show up even on synthetic benchmarks in my experience.
#well
(19 items)
 
Lenovo L530
(8 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i7 4770k Gigabyte Z87X-UD4H XFX Radeon HD 6950 Corsair CMX8GX3M2A2000C9 
Hard DriveHard DriveOptical DriveCooling
Samsung EVO 840 Hitachi HDS722020ALA330 Generic DVD±RW Burner Noctua NH-D14 
OSMonitorMonitorKeyboard
Windows 8.1 Dell U2711 LG W2453 Ducky DK9008 Overclock.net Edition, Cherry MX B... 
PowerCaseMouseMouse Pad
Corsair TX850 Antec Three Hundred Corsair Raptor M40 QPAD HeatoN M 
AudioAudioAudio
E-MU Tracker|pre Beyerdynamic DT-770 250 Ohm AntLion ModMIc 
CPUGraphicsRAMRAM
Intel Ivy Bridge 3210M Intel HD 4000 Graphics Soldered Corsair Vengeance  
Hard DriveOptical DriveOSMonitor
500GB DVD-+RW Windows 7 Professional 1600x900 
  hide details  
Reply
#well
(19 items)
 
Lenovo L530
(8 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i7 4770k Gigabyte Z87X-UD4H XFX Radeon HD 6950 Corsair CMX8GX3M2A2000C9 
Hard DriveHard DriveOptical DriveCooling
Samsung EVO 840 Hitachi HDS722020ALA330 Generic DVD±RW Burner Noctua NH-D14 
OSMonitorMonitorKeyboard
Windows 8.1 Dell U2711 LG W2453 Ducky DK9008 Overclock.net Edition, Cherry MX B... 
PowerCaseMouseMouse Pad
Corsair TX850 Antec Three Hundred Corsair Raptor M40 QPAD HeatoN M 
AudioAudioAudio
E-MU Tracker|pre Beyerdynamic DT-770 250 Ohm AntLion ModMIc 
CPUGraphicsRAMRAM
Intel Ivy Bridge 3210M Intel HD 4000 Graphics Soldered Corsair Vengeance  
Hard DriveOptical DriveOSMonitor
500GB DVD-+RW Windows 7 Professional 1600x900 
  hide details  
Reply
post #9 of 13
^ Yeah, removing them shortens compile time and the module folder size (less modules obviously!). I will say that compile time on a quad core with 2G ram should be about 5-10 minutes, so your really not in that bad of a position. At least, I swear it's around that time but might go as high as 15 min. I doubt that, it should be real quick if you do make with threading.
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
post #10 of 13
Thread Starter 
Quote:
Originally Posted by chemicalfan;15432027 
Err, if you run with the existing Ubuntu config, it'll be just as bloated as your started (albeit a newer version). Surely it's better to config the kernel yourself, removing the drivers you don't need (or at least modularising them)? It's not as easy, but it's the old addage (do you want something done fast, or do you want something done right?).

It'd be handy if there was an equivalent of the AUR for Ubuntu, maybe there is and I just don't know it. Hell, a custom Arch kernel might even work on Ubuntu, there's a real hack!

Edit: If you issue
Code:
export CFLAGS="-march=native -O2 -pipe"
export CXXFLAGS="-march=native -O2 -pipe"
before you start, that should compile more optimised code (assuming the makefile is built that way - I always use the AUR so I'm not 100% sure on that)
Quote:
Originally Posted by lloyd mcclendon;15440535 
nice guide. regarding the config, a couple things

I am a huge fan of turning on General setup > kernel.config support > enable access to .config through /proc/config.gz (CONFIG_IKCONFIG_PROC).

So you always have access to the right config ... zcat /proc/config.gz > /usr/src/linux/.config ... for some reason a lot of distros don't turn this on (because distro configs always all suck). no guarantee i haven't somehow screwed up the static file in /boot inadvertently, i know /proc is correct.

In a lot of ways it's more productive to start from scratch as opposed to taking the terrible kernel you have and trimming it down.. Even better, this guy always posts some good practically empty seeds to start with http://kernel-seeds.org/seeds/64_bit/ .. start there but you still want to spend a few hours reading every option and make sure you are enabling things your system needs.

Don't be frustrated if it doesn't fully boot the first few tries.. it's pretty easy to resolve anything with google. Try to avoid kernel patches you do not understand or are unstable.

Where the whole deb thing is not available, to build

# make && make modules_install && make install && $EDITOR /boot/grub/grub.conf (or menu.lst)
Quote:
Originally Posted by gonX;15441416 
Try doing a 'make localmodconfig' before starting the actual configuration progress - it empties out your config file from currently set up but unloaded modules - make sure all hardware is plugged in and working before doing this though, as otherwise the unplugged hardware may not work when you need it next time, or at least not without a kernel recompile.

The only real advantage to doing that is to reduce the kernel compile time, though. The most important performance gains you can get is definitely not from removing unused modules, though, as the only performance penalty you can get when the modules are not loaded are the extra symbols that MIGHT have been compiled into the full kernel, which in the end do not show up even on synthetic benchmarks in my experience.


I've added these suggestions into the OP where they are most relevant too. Thanks guys smile.gif
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Guide: Compile Custom Kernel for Ubuntu.