You are not logged in.

#1 2005-05-11 07:46:51

windrider
Member
Registered: 2005-05-07
Posts: 27

some questions b4 i try to compile my first custom kernel

Hi all, i'm tempted to try and configure my own custom kernel but i need to ask a few questions before i try...

http://wiki2.archlinux.org/index.php/Ke … ompilation

the first 5 instructions on this wiki were to do this:

# cd /usr/src
# mv linux-2.x.x linux-2.x.x.arch
# mv /lib/modules/linux-2.x.x /lib/modules/linux-2.x.x.arch
# mv /boot/vmlinuz2x vmlinuz-2.x.x.arch
# mv /boot/System.map2x System.map-2.x.x.arch
# mv /boot/kconfig2x /boot/kconfig-2.x.x.arch

if i just want to compile a new, seperate kernel from my current one, why would i need to do this? if i followed these 5 commands, i wont be able to boot up back into my old kernel unless i use a rescue disk to copy the files back into their original locations, not?

also, what other steps would i have to take to ensure that i dont accidentally overwrite my old kernel? Or other things i should look out for, for a first timer

Offline

#2 2005-05-11 08:52:20

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: some questions b4 i try to compile my first custom kernel

People might suggest that you use my PKGBUILD for this, which you can also find on the wiki - it might help but if you have not used makepkg and abs before you might be better doing it the way you are already trying, otherwise you'll be learning 2 things at once - still I guess you have to learn about makepkg one day or you are missing out on all the fun smile

You could just read through the relevant pages on the wiki tho and make your own choice about how you want to do it smile  There;'s no huge rush after all

I'd ask first what you want to do with your custom kernel, it might affect your choice of method smile

Offline

#3 2005-05-11 09:19:35

windrider
Member
Registered: 2005-05-07
Posts: 27

Re: some questions b4 i try to compile my first custom kernel

yep, i did take a look at your pkgbuild, but i'm still not too familiar with abs and pkbuild yet so its all abit confusing. especially the LOCALVERSION/EXTRAVERSION and patchfile parts. i've always wanted to build a kernel this way so i guess i shld try to do it at least once the non arch way. my main objective for learning how to do this is to have a leaner customised kernel, to make things run faster (i guess thats the main reason why ppl compile their own kernels isnt it?)

Offline

#4 2005-05-11 11:42:14

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Re: some questions b4 i try to compile my first custom kernel

[LONG POST]
There are two different kinds of people : those who prefer the /usr/src way, and those who use dibble's PKGBUILD.

To my opinion, someone who's never compiled a kernel should first try to do it the manual way. What is PKGBUILD for if you don't understand what's in ?

pacman -R kernel26
cd /usr/src
wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.8.tar.bz2
tar -xvjf ./linux-2.6.11.8.tar.bz2
ln -s linux-2.6.11.8 linux
cd linux
make menuconfig # some tips below
make && make modules_install
# Don't do a make install
cp arch/i386/boot/bzImage /boot/linux
cp System.map /boot
cp .config /boot
nano -w /boot/grub/menu.lst


# I assume your / is on /dev/hda2 and /boot is on the same partition
title Arch Linux [/boot/linux]
root (hd0,1)
kernel /boot/linux root=/dev/hda2 ro # lapic devfs=nomount


title Windows
rootnoverify (hd0,2) #Windows on /dev/hda3
makeactive
chainloader +1



If you use lilo :

nano -w /etc/lilo.conf

boot=/dev/hda        
prompt            
timeout=100         # =10 seconds
default=linux

image=/boot/linux
  label=linux  
  read-only       
  root=/dev/hda2
#append="some options like devfs=nomount or lapic"


other=/dev/hda3
  label=windows



If you use lilo, DO NOT FORGET to run 'lilo' after editing /etc/lilo.conf.

Kernel Options

- Enabling an option generally does not hurt so if you are not sure, enable the option.
- Compile as modules only what you do not use, for removable devices, and things you would not like to be automatically loaded ( a NIC on a laptop for example)
- Try googling around to see what modules are needed for some of your exotic hardware if you have to.
- Know you hardware (run lspci,lsdev, use hwd)


To answer to what you said, a self-compiled kernel is not that much faster... However, it is surely not bloated anymore since it probes only for the hardware you actually have. Hotplug wont desperately try to load uncorrect modules for hours(and you wont have to blacklist them), and you have the options YOU chose, for example use udev as default.

Compiling the kernel also enables to patch it for example with reiser4 support(fastest fs on earth), -ck speed improvements, -nitro patch set.

I suggest you google around and see what patches are available, though I would not do that if you never compiled a kernel.

To patch :

cd /usr/src/linux
patch -p1 < /path/to/xxx-patch.bz2


Oh, I nearly forgot to say that if you compile the kernel yourself, binary modules provided by pacman do not work anymore. You will have to recompile them too(for example ipw2100, nvidia, etc). This is made easy with ABS.

Offline

#5 2005-05-11 17:11:34

windrider
Member
Registered: 2005-05-07
Posts: 27

Re: some questions b4 i try to compile my first custom kernel

thanks for all that info, great help. just one final question. If i use the method described above, i would have to remove my current kernel wouldnt i? is there anyway to build and boot the kernel i build as a totally seperate kernel? so that eg i get 2 options at bootup to choose which kernel i get to boot from. In that case i would be able to keep my current kernel intact in case anything goes wrong right?

Offline

#6 2005-05-11 20:34:15

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: some questions b4 i try to compile my first custom kernel

windrider wrote:

the first 5 instructions on this wiki were to do this:

# cd /usr/src
# mv linux-2.x.x linux-2.x.x.arch
# mv /lib/modules/linux-2.x.x /lib/modules/linux-2.x.x.arch
# mv /boot/vmlinuz2x vmlinuz-2.x.x.arch
# mv /boot/System.map2x System.map-2.x.x.arch
# mv /boot/kconfig2x /boot/kconfig-2.x.x.arch

These commands are preceded in the wiki by this line:

Move the Arch default kernel headers out of the way. This is better than removing them, so you have a backup

and followed by this line:

It is a very good idea, to change your grub / lilo config to be able boot this stuff. There should be info on how to do this here

The info that should be there is what you're missing, although you'd probably already worked that out. If you're using grub, you'll see something like this in /boot/grub/menu.lst:

# (0) Arch Linux
title   Arch Linux 2.6.11.7
root    (hd0,1)
kernel  /boot/vmlinuz26 root=/dev/hda1 ro vga=791

Change the kernel line as follows:

kernel  /boot/vmlinuz-2.x.x.arch root=/dev/hda1 ro vga=791

i.e. replace vmlinuz26 with whatever you renamed it as. You should also change the title line to identify it as your original kernel.

After you've compiled and installed your new kernel, you'll need to add another set of title/root/kernel lines to /boot/grub/menu.lst to provide the required kernel choice at boot-time.

If you're using lilo, hopefully someone else will fill you in.

Offline

Board footer

Powered by FluxBB