You are not logged in.

#1 2011-04-16 22:46:04

Ben9250
Member
From: Bath - England
Registered: 2010-06-10
Posts: 208
Website

Compiling a Kernel - First go

Hiya,

Recently, I was asking a question on making my machine more secure, and instead of opting for grsecurity, I went for TOMOYO (instead of SELinux too), mostly because I found it easier on the "newb" eyes, and I liked the look of the learning mode, one step at a time, maybe I'll delve into SELinux later down the line. Either way however I would have had to patch/compile a kernel. There are a couple of pre-done ones on the AUR for tomoyo so I'm going to use them for a start just to get used to tomoyo. Then however I got thinking, why not do a kernel to optimise for my laptop, as well as have things like tomoyo and - if it's possible - things like PaX from grsecurity on there too, in addition to optimise for my laptop, which has a nvidia graphics card (currently nouveau for gnome3) and the broadcom-wl driver requiring wireless card. I've read several wiki pages and googled this subject:

https://wiki.archlinux.org/index.php/Cu … n_with_ABS
https://wiki.archlinux.org/index.php/Ke … in_the_AUR
http://www.digitalhermit.com/linux/Kern … RACT-PATCH
https://wiki.archlinux.org/index.php/Ke … sers_Guide

And I want to make sure I've understood before I go ahead, and if anyone has any advice or can see me heading to disaster hopefully they can warn me. Once I've compiled a custom kernel, I'm assuming I have to keep the whole thing up to date with patches "the (according to my reading material) old school way", as opposed to how the mainstream kernel is updated, or is there a way the AUR and makepkg allows you to use the latest kernel version each time and re-patch it (for example with ccs) and use the old .config with the options already used. Perhaps even both is possible, in which case the appropriate question would be one of which is considered best to do. I'm thinking that most of the machine optimisation is achieved through the config process (I'll do with menuconfig or the x equivalent), in which case my best bet is to use the tomoyo kernel on the AUR, and then splay with the settings using menuconfig according to my process or and hardware from lspci. From some of the PKGBUILDS I've analysed to see how the manual from source steps are recorded in said file for makepkg to read I think I can see some people start at a base version number, and add patch sections each time one comes out that shoves the kernel version up, or some check that if the basekernel variable does not match with the pkgver variable, patches are downloaded from upstream and applied.
With these AUR kernels, I'm seeing that they come with .config files and such, and so if, say I use the AUR ccs patched kernel PKGBUILD, I suppose the .config files that come in it's tarball will already be optimised for that patch, and all I have to do then with menuconfig or the x equivalent is optimise to my hardware.

[EDIT] Having a go with the AUR kernel PKGBUILD and I'm configuring now, and selecting cpu family. I'v found my cpu info by going into /proc/cpuinfo, when it says cpu family 6, would that correspond to the 6th option from the menu (which happens to be Pentium-Pro? Mine says simply family 6, model 15, and Intel(R) Core(TM)2 Duo CPU. Or would I want the Core 2/newer Xeon option near the bottom?

Thanks,
Ben.

Last edited by Ben9250 (2011-04-16 23:48:53)


"In England we have come to rely upon a comfortable time-lag of fifty years or a century intervening between the perception that something ought to be done and a serious attempt to do it."
  - H. G. Wells

Offline

#2 2011-04-17 08:30:36

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Compiling a Kernel - First go

Trial and error. If it doesn't boot just boot to your old kernel and try again. There's various helpers available, but in the end good old-fashioned google helps the most.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2011-04-17 08:34:15

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Compiling a Kernel - First go

There is a package in the AUR for that kernel already.  Use it or use it as a learning model.  Post the ufll output of $ cat /proc/cpuinfo


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2011-04-17 08:50:13

jnguyen
Member
Registered: 2011-02-17
Posts: 139
Website

Re: Compiling a Kernel - First go

Ben9250 wrote:

[EDIT] Having a go with the AUR kernel PKGBUILD and I'm configuring now, and selecting cpu family. I'v found my cpu info by going into /proc/cpuinfo, when it says cpu family 6, would that correspond to the 6th option from the menu (which happens to be Pentium-Pro? Mine says simply family 6, model 15, and Intel(R) Core(TM)2 Duo CPU. Or would I want the Core 2/newer Xeon option near the bottom?

You will want the Core 2 option. The cpu family number is not a reference to the menu position. While it is fun and interesting to go through the kernel options, don't expect too much change in performance. I used to use a custom config, but I basically didn't notice any difference. The CK patchset will probably give you more noticable improvement. SystemD also looks very exciting and looks like it can dramatically improve boot time, though I haven't got around to trying it out yet.

PaX and grsecurity work best when all packages are compiled as Position Independent Executables and with stack smashing protection enabled. Allan will probably get around to doing this eventually, though from what I can see, PaX and grsecurity are only really useful if you have a multi-user environment or are giving remote users a shell account. If you are a single user on a desktop system with no web services running, then PaX and grsecurity may be more head ache than it's worth.

Last edited by jnguyen (2011-04-17 08:55:17)


TOMOYO Linux: Mandatory Access Control.
My AUR packages

Offline

#5 2011-04-18 03:03:10

admiralspark
Member
From: Alaska, USA
Registered: 2011-01-07
Posts: 87

Re: Compiling a Kernel - First go

One quick thing about compiling the kernel in general: you'll want to look into using 'make localmodconfig'--but make SURE all the modules you'll need (including HID for mouse, ntfs things for windows partitions, etc) are modprobed.


Team Ignition Kernel Developer
linux-ideapad developer/maintainer
Flame Kernel developer for Galaxy Nexus and Galaxy S3
Want a cheap, reliable VPS with AWESOME customer service?

Offline

#6 2011-04-18 13:33:33

Ben9250
Member
From: Bath - England
Registered: 2010-06-10
Posts: 208
Website

Re: Compiling a Kernel - First go

Thanks, that's really helpful, I see a ck-ccs version of kernel26 on the AUR, which is handy. The localmodconfig also looks like it will be a huge help to me, although I don't know what it will do when it comes to the broadcom-wl module I have from the AUR. Is there any scope for including the broadcom-wl driver and wl module in a kernel when I compile? I haven't seen it done before, and the site I get the source for the driver from makes no mention of it. It would be good just to install the kernel and then wireless work, rather than having to find a ethernet cable every time the kernel version changes and I upgrade, I suspect however there isn't a way around this.

Cheers,
Ben.


"In England we have come to rely upon a comfortable time-lag of fifty years or a century intervening between the perception that something ought to be done and a serious attempt to do it."
  - H. G. Wells

Offline

Board footer

Powered by FluxBB