Quote:
Originally Posted by newio
|
Old and gold, but it will take you hours to extract the correct information from that thread... it staggers from left to right all the time.
This is a short recap of how I build my 2.6 kernels.
====================================================
*** Update: ***
I copied this guide to my Wiki page at
http://alien.slackbook.org/dokuwiki/...kernelbuilding so that is does not drown in this forum after a couple of days.
***
I run the commands from a X terminal, and at some point start the X based kernel configurator. I run my desktop as "myself" but I build my kernels as root. In order to let root use my X display, I do the following in my X terminal: get root rights; merge my own (alien's) Xauthority file with the one from the root user, and set the DISPLAY variable. After doing that, I can run X applications from the "su" terminal.
Code:
echo $DISPLAY # you'll be needing this value 3 lines below
sudo -i # or "su -" on older Slackwares
xauth merge ~alien/.Xauthority # use your own username here instead of "alien"
export DISPLAY=:0.0 # use the value of DISPLAY you've seen 3 lines before
Now that the build environment is set up, continue with the sources.
Download a new kernel, unpack it into /usr/src and create the "linux" link so that the commands are a little more generic. I will take a kernel version of "2.6.16.15" as an example. If yours is a different version, you'll know where to change the version strings in the rest of the story below.
Code:
wget http://www.us.kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.15.tar.bz2
tar -C /usr/src -jxvf linux-2.6.16.15.tar.bz2
cd /usr/src
rm linux
ln -s linux-2.6.16.15 linux
You will probably notice more linux-* directories in /usr/src but it is common to let the "linux" link point to the kernel you are working with.
Now, get a Slackware kernel config file for a headstart during your own configuring. Pat's config files are pretty generic. By the time you read this, there might be a config for a newer 2.6 release available:
Run "make oldconfig" in the kernel source directory so that the defaults are used from the .config file you just installed. Because your kernel sources are probably newer than the .config, there will be new options to choose from. You will only have to answer these (press ENTER for the default answers which are mostly fine, or "m" to build new drivers as modules).
Code:
cd /usr/src/linux
make oldconfig
You now have configured a pretty generic kernel (that is the reason why Pat calls them "kernel-generic" probably :-) but you will want to change some of the defaults to suit your needs. Run the X based configurator (if you do not run X but are at a text console, just run "make menuconfig" to get the curses-based dialog program instead)
Walk through the forest of options. What I change is:
* build the ext3 and reiser fileystem drivers into the kernel instead of compiling them as modules - I do not need to create an additional "initrd" then (see under "Filesystems" in the configurator).
* enable support for dual procesessors and hypertreading (under "Processor type and features" > "Symmetric multi-processing support").
* enable 4GB of RAM. The Slackware default setting is to only support ~800 MB of your RAM, so any additional installed RAM is never used! (under "Processor type and features" > "High Memory Support (4GB)").
* enable the "low-latency" kernel if you run a desktop/laptop computer (under "Processor type and features" > "Preemption model" > "Preemptible kernel").
* set a 1000Hz timer (under "Processor type and features" > "Preemption model" > "Timer frequency").
* ... and more I can't think of right now. You can decide to disable a lot of the modules that the default config will build, to cut down on time, if you don't have the hardware in your computer. You could also looka at software suspend and CPU frequency scaling (under "Processor type and features") if you own a laptop.
And finally save your configuration if you're satsfied.
Now, start the build of kernel and modules, and install them to the proper places.
Code:
make bzImage modules # compile the kernel and the modules
make modules_install # installs the modules to /lib/modules/<kernelversion>
cp arch/i386/boot/bzImage /boot/vmlinuz-custom-2.6.16.15 # copy the new kernel file
cp System.map /boot/System.map-custom-2.6.16.15 # copy the System.map (optional)
cp .config /boot/config-custom-2.6.16.15 # backup copy of your kernel config
cd /boot
rm System.map # delete the old link
ln -s System.map-custom-2.6.16.15 System.map # create a new link
Edit /etc/lilo.conf and add a
new section for your new kernel. Remember, your new kernel may not even boot if you made a mistake somewhere, so you will want to leave the sections for your current kernel(s) intact. Your current /etc/lilo.conf will have a section somewhat like this, near the bottom of the file:
Code:
image = /boot/vmlinuz
root = /dev/hda1
label = linux
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
Add another section just below (adding it below will guarantee that your current kernel will remain the default to start):
Code:
image = /boot/vmlinuz-custom-2.6.16.15
root = /dev/hda1
label = newkernel
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
After adding a stanza for your new kernel to /etc/lilo.conf and saving the file, run lilo to activate your changes:
Now is the time for a reboot, to test the results! In the lilo boot screen, select the "newkernel" option instead of the default "linux" option.
If the new kernel boots fine, you can add this line to the top of /etc/lilo.conf and re-run "lilo":
Code:
default = newkernel
Other packages that contain kernel modules
Most certainly you will have packages installed that contain kernel modules that are not part of the default kernel. Slackware has "alsa-driver" for instance, and if you installed any wireless driver, these are basically kernel modules too.
Now, with the installation of your new kernel, you will lose these modules, and you have to recompile the sources so that the binary modules match the new kernel.
You can get an overview of all packages that have installed a kernel module for your
current kernel by running this command (i.e. you must run this command while still running your
old kernel):
Code:
cd /var/log/packages
grep -l "lib/modules/`uname -r`" *
All the mentioned packages will need a recompile.
For ALSA you have a choice: either enable the ALSA driver that is part of the kernel you've just downloaded, or leave the kernel configuration like Slackware's: disable all ALSA support in the kernel and instead re-build the alsa-driver package.
Good luck with it all!
Eric