Hope this will help! Complete Instructions...
Installing a new Kernel source
From what I've read of other Linux distributions, they have the possibility of providing modified kernels and what you read may inform you not to install your new kernel source in /usr/src/linux. That is not the case for Slackware. If Pat makes the kernel source available in a package, you can install that (using "installpkg") and it will be correctly placed in /usr/src/linux-version with a symlink pointing to it as /usr/src/linux.
If you download the source from The Linux Kernel Archives you just need to untar it to /usr/src, then create a symlink.
cd /usr/src
tar xvzf /filepath/filename
ln -s linux-version linux (replace version with the version of the kernel)
Ok, it's now installed. But now we want to create a new kernel with it right?
Compiling a new Kernel
Compiling a new kernel takes some time and practice. I only say this because I can't seem to get a kernel "right" on my first try and end up doing it again until I do get it the way I want it. This of course is only my opinion.
The benifits of compiling your own kernel outway the minor hassle of doing so though. Your kernel will only have the "features" you want, and should be smaller than the one that ships with Slackware.
First you can create a file in your source directory like this:
mcedit /usr/src/linux/makeK
#!/bin/bash
#make mrproper - only if you patch your kernel source and you have compiled it before.
#make menuconfig - or make xconfig (from an X console) - or make oldconfig
make dep && make bzImage && make modules && make modules_install && \
cp -p /boot/vmlinuz /boot/vmlinuz.old && cp arch/i386/boot/bzImage /boot/vmlinuz && \
cp System.map /boot/System.map && cp .config /boot/config &&\
echo Edit your lilo.conf to include the new kernel. Run lilo and reboot.
or for a 2.6 kernel:
#!/bin/bash
#make mrproper - only first time of new kernel source
#make menuconfig - or xconfig (from an X console) - or make oldconfig
make && make modules_install && \
cp -p arch/i386/boot/bzImage /boot/vmlinuz-2.6.14.3-32 && \
cp -p System.map /boot/System.map-2.6.14.3-32&& cp -p .config /boot/config-2.6.14.3-32 && \
echo Edit your lilo.conf to include the new kernel. Run lilo and reboot.
To compile your kernel the first time, you might want to start with the configuration file that you booted with, so...
cd /usr/src/linux
cp /boot/config .config
make oldconfig
You will be prompted for the differences between the kernel versions. Answer as you wish.
If you are in console mode, you can use "make menuconfig" to change your kernel configuration and if runing from X, then use "make xconfig".
Patching a kernel
I always keep a virgin copy of my kernel source in my /usr/src directory. For example:
cp -pr linux-2.4.19/ linux-2.4.19-clean/
Now I can make patches, etc to my kernel and if I have to, go back to clean source.
Everytime I make a kernel, I change the Makefile line 4 to something unique:
EXTRAVERSION = -a (-b, -pre8a, etc...). Then I compile until I keep it. Now I don't have to worry about missing modules everytime I boot into another kernel as the new modules will be saved to /lib/modules with the full version/extraversion name. Once I am happy with it, I rename the source directory to match the /lib/modules directory (or Makefile version).
mv linux-2.4.19/ linux-2.4.19a/
rm linux
ln -s linux-2.4.19a linux
Lets say I want to add the changes from patch-2.4.20-pre8 from The Linux Kernel Archives to my linux-2.4.19 source.
I download the patch file to /home/download
cd /usr/src
rm linux
cp -pr linux-2.4.19-clean/ linux-2.4.19/
gzip -dv /home/download/patch-2.4.20-pre8.gz
cp /home/download/patch-2.4.20-pre8 .
patch -p0 < patch-2.4.20-pre8
mv linux-2.4.19/ linux-2.4.20-pre8/
ln -s linux-2.4.20-pre8 linux
cd linux
cp /boot/config .config
make oldconfig
(then maybe "make menuconfig" if I want to see everything in context)
./makeK
LILO and boot_message.txt
Dont forget to run "lilo" after building a new kernel!
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
restricted
#linear
append="hdd=ide-scsi"
boot = /dev/hda2
message = /boot/boot_message.txt
prompt
timeout = 50
# compact # faster, but doesn't work on all systems.
# delay = 5
# VESA framebuffer console @ 1024x768x256
vga = 773
# Normal VGA console
# vga = normal
# VESA framebuffer console @ 1024x768x64k
# vga=791
# VESA framebuffer console @ 1024x768x32k
# vga=790
# VESA framebuffer console @ 1024x768x256
# vga=773
# VESA framebuffer console @ 800x600x64k
# vga=788
# VESA framebuffer console @ 800x600x32k
# vga=787
# VESA framebuffer console @ 800x600x256
# vga=771
# VESA framebuffer console @ 640x480x64k
# vga=785
# VESA framebuffer console @ 640x480x32k
# vga=784
# VESA framebuffer console @ 640x480x256
# vga=769
# ramdisk = 0 # paranoia setting
# End LILO global section
# Linux bootable partition config begins
image = /boot/vmlinuz
root = /dev/hda2
label = NewLinux
password=password1
read-only
# append="hdd-ide-scsi video=sstfb"
image = /boot/vmlinuz-ide-2.4.19
root = /dev/hda2
label = OrgLinux
password=password2
read-only
image = /boot/vmlinuz.old
root = /dev/hda2
label = OldLinux
password=password3
read-only
image = /boot/vmlinuz-2.4.18
root = /dev/hda2
label = BckLinux
password=password4
read-only
# Linux bootable partition config ends
# Start Memtest86 bootstrap
image = /memtest/memtest
label = MemTest
password=memtest
# End Memtest86
#----- End /etc/lilo.conf
/boot/boot_message.txt
Welcome to the LILO Boot Loader!
Please enter the name of the Linux Kernel you would like to boot
at the prompt below. The choices are:
NewLinux - New Custom Kernel (default)
OrgLinux - Originial Slackware 9 Kernel
OldLinux - Last Custom Kernel Kernel
BckLinux - Backup Custom 2.4.18 Kernel
MemTest - Run memory diagnostics
Creating a new bootdisk
There is a script in /sbin called makebootdisk for you. It gives you the choice of 3 different kinds of bootdisks.
A syslinux (DOS formated disk), lilo (linux formated disk), and simple (obsolete). You can choose which kernel you want like /boot/vmlinuz.
--------------------------------------------
Long Live the Slack King!
|