You are not logged in.

#1 2008-09-09 03:48:50

The Avatar of Time
Member
Registered: 2008-01-11
Posts: 226

Advice on Kernel Compilation

Hell all,

I am planning to compile my own kernel and would like some opinions on the matter. I am wanting to get it customized just for my hardware.

For instance is it faster and/or better to have features built-in or modularized?

I see that there is an option to set the maximum number of CPUs, is there any advantage to setting it to just the amount that I have (I have two dual core CPUs, so 4 cores)? Or is it better to leave it at 32?

I'm sure I will come up with some other questions as I look through the options more...

Anyhow, any advice or warnings on any aspect of doing this would be appreciated.

***Edit

I should have metioned that I am planning to use 'linux-2.6.26.5.tar.bz2' from here: ftp://ftp.us.kernel.org/pub/linux/kernel/v2.6/ (messed up the first time and grabbed 2.6.9.....)

Alsa I am not trying to get out of 'doing my homework' here, I am currently reading all I can on kernelnewbies.org. I am just curious about personal experiences, preferences, and advice. Thanks.

Last edited by The Avatar of Time (2008-09-09 05:06:21)

Offline

#2 2008-09-09 06:38:33

somedrew
Member
From: Canada
Registered: 2007-05-14
Posts: 140

Re: Advice on Kernel Compilation

The Avatar of Time wrote:

... is it faster and/or better to have features built-in or modularized?

I prefer modules whenever possible. Load/unload time is negligible on modern hardware and it's much easier to unload a module than a static driver if the need arises (e.g., suspend to ram). Also, if some drivers do not require to be loaded all of the time, every little bit of spared CPU cache helps...

The Avatar of Time wrote:

I see that there is an option to set the maximum number of CPUs, is there any advantage to setting it to just the amount that I have (I have two dual core CPUs, so 4 cores)? Or is it better to leave it at 32?

Kconfig wrote:

CONFIG_NR_CPUS:                                                           
  │                                                                         
  │ This allows you to specify the maximum number of CPUs which this         
  │ kernel will support.  The maximum supported value is 512 and the         
  │ minimum value which makes sense is 2.                                   
  │                                                                         
  │ This is purely to save memory - each supported CPU adds                 
  │ approximately eight kilobytes to the kernel image.

The Avatar of Time wrote:

any advice or warnings on any aspect of doing this would be appreciated.

If you want to do away with using an initrd/initramfs, make sure that you compile in static support for your root filesystem and hard-disk controller.

BTW, 'Linux kernel in a Nutshell' is a quick kernel compilation & configuration reference that's a pleasure to read: http://www.kroah.com/lkn/

cheers,

Last edited by somedrew (2008-09-09 06:44:37)

Offline

#3 2008-09-09 07:23:41

The Avatar of Time
Member
Registered: 2008-01-11
Posts: 226

Re: Advice on Kernel Compilation

Thanks for the quick reply, I appreciate the insight.

If you want to do away with using an initrd/initramfs, make sure that you compile in static support for your root filesystem and hard-disk controller.

That's good info, thanks.

Offline

#4 2008-09-12 05:43:28

The Avatar of Time
Member
Registered: 2008-01-11
Posts: 226

Re: Advice on Kernel Compilation

Okay I have compiled my kernel, made it into a package, and installed it with pacman, according to this guide:
http://wiki.archlinux.org/index.php/Ker … rom_Source

So far everything seems to have went well. The problem that I have is that I don't know how to use my new kernel.

I know that I would have to edit /boot/grub/menu.lst and change the kernel and/or initrd line, but I don't see anything to change it to.

This is what is in /boot at the moment:

System.map26     grub          kernel26-fallback.img  vmlinuz26
System.map26-my  kconfig26-my  kernel26.img

Apparently I need to make a new kernel26 image somehow, but I don't seem to be able to figure out how to do that.

Any advice would be appreciated, thanks.

Offline

#5 2008-09-12 08:37:54

somedrew
Member
From: Canada
Registered: 2007-05-14
Posts: 140

Re: Advice on Kernel Compilation

That PKGBUILD is a little outdated. Due to the x86 merges your kernel image will be found in arch/x86/boot/bzImage rather than arch/i386/boot/bzImage. You'll need to update the PKGBUILD are remake the package or just copy over the kernel image to /boot/, but it's always nice to keep as much of the system as possible on pacman's radar.

cheers

Offline

#6 2008-09-12 09:57:14

methuselah
Member
Registered: 2007-10-02
Posts: 570

Re: Advice on Kernel Compilation

***** I deleted my first answer because I re-read your post and you were not using the zen patch.*****

I liked this guide the best: http://wiki.archlinux.org/index.php/Cus … n_with_ABS


I also just used the basic kernel26 files from the ABS tree with a few edits on all of them....


Since I couldn't find the coding that stops the regualr ABS kernel build to "make menuconfig", I used the dibblethewrecker PKGBUILD, edited with my kernel version (and zen2 patch which is optional) to create a donwloaded and patched pkg, that starts to build.....


I chose the make menuconfig option in my PKGBUILD so I could set all of my kernel tuneables and settings using the menuconfig way, then I saved it as a .config file. Then I aborted the build because that script would not work correctly for me. A traditional kernel build also works to create a .config file.


I then had a perfect config.x86_64 file for using the simple ABS PKGBUILD that just loads your choosen config file to build with.


As for you kernel26.img and vmlinuz you have to edit the ABS kernel26.preset and kernel26.install to have a different name than "kernel26"..... basically, everywhere in the ABS PKGBUILD, and the preset and install scripts I changed kernel26 to kernel26name..... so then you get a seperate kernel26name.img and vmlinuzkernel26name:

Screenshot-9-1.png
Large View: http://i480.photobucket.com/albums/rr16 … ot-9-2.jpg


***** I AM NEW TO THIS, so this isn't totally the correct way, but it worked for me*****

This is my /lib/modules and my /usr/src:

Screenshot-8-1.png
Large View: http://i480.photobucket.com/albums/rr16 … shot-8.png


This is my /boot :

Screenshot-6-1.png
Large View: http://i480.photobucket.com/albums/rr16 … ot-6-2.jpg


This is how I have my /boot/grub/menu.lst configured for all of my kernels:

# Config file for GRUB - The GNU GRand Unified Bootloader
# /boot/grub/menu.lst

# DEVICE NAME CONVERSIONS 
#
#  Linux           Grub
# -------------------------
#  /dev/fd0        (fd0)
#  /dev/hda        (hd0)
#  /dev/hdb2       (hd1,1)
#  /dev/hda3       (hd0,2)
#

#  FRAMEBUFFER RESOLUTION SETTINGS
#     +-------------------------------------------------+
#          | 640x480    800x600    1024x768   1280x1024
#      ----+--------------------------------------------
#      256 | 0x301=769  0x303=771  0x305=773   0x307=775
#      32K | 0x310=784  0x313=787  0x316=790   0x319=793
#      64K | 0x311=785  0x314=788  0x317=791   0x31A=794
#      16M | 0x312=786  0x315=789  0x318=792   0x31B=795
#     +-------------------------------------------------+

# general configuration:
timeout   5
default   0
color light-blue/black light-cyan/blue

# boot sections follow
# each is implicitly numbered from 0 in the order of appearance below
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*

# (0) Zen21000-AMD64-1000HZ-desktop-desktop
title  Zen21000-AMD64-1000HZ-desktop-desktop
root   (hd0,2)
kernel /vmlinuz26zen21000 root=/dev/disk/by-uuid/fe976406-f6d8-4cd0-99ea-e6e8aab2c397 resume=/dev/sda5 iommu=noaperture ro
initrd /kernel26zen21000.img

# (1) Zen2next-AMD64-432HZ-desktop-desktop
title  Zen2next-AMD64-432HZ-desktop-desktop
root   (hd0,2)
kernel /vmlinuz26zen2next root=/dev/disk/by-uuid/fe976406-f6d8-4cd0-99ea-e6e8aab2c397 resume=/dev/sda5 iommu=noaperture ro
initrd /kernel26zen2next.img

# (2) Zen2-AMD64-desktop-lowlatency
title  Zen2-AMD64-desktop-lowlatency
root   (hd0,2)
kernel /vmlinuz26zen2 root=/dev/disk/by-uuid/fe976406-f6d8-4cd0-99ea-e6e8aab2c397 resume=/dev/sda5 iommu=noaperture ro
initrd /kernel26zen2.img

# (3) Zen227rc5-AMD64-no-battery
title  Zen227rc5-AMD64-no-battery
root   (hd0,2)
kernel /vmlinuz26zen227rc5 root=/dev/disk/by-uuid/fe976406-f6d8-4cd0-99ea-e6e8aab2c397 resume=swap:/dev/sda5 iommu=noaperture ro
initrd /kernel26zen227rc5.img

# (4) Arch Linux-1000HZ
title  Arch Linux-1000HZ
root   (hd0,2)
kernel /vmlinuz26 root=/dev/disk/by-uuid/fe976406-f6d8-4cd0-99ea-e6e8aab2c397 resume=swap:/dev/sda5 iommu=noaperture ro
initrd /kernel26.img

# (5) Arch Linux
title  Arch Linux Fallback
root   (hd0,2)
kernel /vmlinuz26 root=/dev/disk/by-uuid/fe976406-f6d8-4cd0-99ea-e6e8aab2c397 ro
initrd /kernel26-fallback.img

# (1) Windows
title Windows
rootnoverify (hd0,0)
makeactive
chainloader +1

***** Like I said, none of this is the correct way*****  but since I couldn't find a guide with the exact correct way, I sort of figured this way out on my own, an it works perfectly for now.

Last edited by methuselah (2008-09-12 10:12:15)

Offline

#7 2008-09-14 07:20:41

The Avatar of Time
Member
Registered: 2008-01-11
Posts: 226

Re: Advice on Kernel Compilation

Thank you for the information. I'm still fighting with it, but hopefully I am getting closer to winning the battle.

I don't have much new to report just yet, but should soon. I am quite confident there will be more problems and questions to explore then. smile

Thanks for the help so far.

Offline

#8 2008-10-03 11:54:11

The Avatar of Time
Member
Registered: 2008-01-11
Posts: 226

Re: Advice on Kernel Compilation

Well I haven't had much time until now to work on this any further. However I have decided to use kernel26-ice from AUR, since it has the patches that I want already, and then customize and configure it for my hardware. Seems the quicker method. Is there any disadvantage to doing it this was as opposed to working from scratch though?

Also, I had been hoping to do away with initramfs/initrd. However, I want a bootsplash. I'm planning to use fbcondecor to achieve this. I have gathered though that one cannot have a bootsplash without initramfs. Is that correct or did I miss out on something?

Thanks.

Offline

#9 2008-10-05 06:56:58

The Avatar of Time
Member
Registered: 2008-01-11
Posts: 226

Re: Advice on Kernel Compilation

Okay, I managed to compile kernel26-ice just fine. I also got the nvidia-ice-beta module so that works as well. I have run into a few other issues however.

First off lirc is no longer working. At least I assume it is lirc that is the problem, I can neither start nor navigate MythTV with my remote (which of course worked before). So I am assuming I need to build new modules but I'm not entirely sure how to go about that. I know how to build the VirtualBox module, but that's about it. Or is this a seperate issue and not related to this new kernel?

Also I have been wanting a bootsplash, using fbcondecor, which is included in the patches used on kernel26-ice. So I installed fbsplash as well. However, I cannot seem to get a bootsplash working. I also installed a new grub to show a grubsplash and it works just fine.

I have been following this guide for fbsplash: http://wiki.archlinux.org/index.php/Fbsplash and when I rebooted I still could not see a bootsplash. Then I noticed that at the bottom it mentioned using mkinitcpio to generate a new image.

So I went to this guide for mkinitcpio: http://wiki.archlinux.org/index.php/Mki … the_image|

UnfortunatelyI have obviously messed something up with mkinitcpio. I added fblash to HOOKS as per the guide's instructions, though it should be noted there was nothing else listed in HOOKS, and then ran 'mkinitcpio -g /boot/kernel26.img'. Now I get a kernel panic while trying to boot into kernel26-ice and have to use the fallback image. I then tried using 'mkinitcpio -p kernel26-ice' but I get the same error and again have to use the fallback.

So does anyone know what I may have left out then to mess this up? The current HOOKS in /etc/mkinitcpio.conf look like this:

HOOKS="base udev autodetect pata scsi sata usbinput keymap filesystems fbsplash"

Another question I have though concerns using multiple kernels: Now that I have installed the nvidia-ice-beta driver/module I cannot boot the old default Arch kernel. I understand why that is of course, but what do people that boot from multiple kernels do about this? Get a new module everytime?

Anyhow thanks for any advice on this matter.

Offline

Board footer

Powered by FluxBB