ToC Home Issues Hearts Links

Issue #3, July 2005

A 2.4.x Kernel Update and Compilation Guide, or
The adventures of installing a custom build kernel on to bare metal Slackware-10.1 installation

Author: Grant Coady


     KERNEL: A part of an operating system that preserves the medieval
             traditions of sorcery and black art.

             Posted on AOLS by Martin Boening,
             Linux Registered User #258205

These are brief notes outlining an experience with updating the stock kernel for Slackware 10.1 release and then compiling and installing a custom kernel. The procedure can be applied to other releases of Slackware and other versions of the 2.4 series kernel.

Standard DISCLAIMER:

  1. TMTOWTDI [0]
  2. This works for me. Maybe this will work for you.
  3. Kernel versions will change, check for latest kernel patches.

--
[0] "There's More Than One Way To Do It" --Larry Wall, Camel Book 2nd Ed. (Programming Perl), p. 10

That's the Perl Slogan, and you'll get tired of hearing it, unless you're the Local Expert, in which case you'll get tired of saying it. Sometimes it's shortened to TMTOWTDI, pronounced "tim-toady". But you can pronounce it however you like. After all, TMTOWTDI.


Test box

pentiumII/266

EPoX EP-61LXA-M: Intel 440LX chipset with pentiumII/266 on 66MHz FSB (4 x 66) with 128MB SDRAM, AGP card, PCI + ISA bus.

Slackware-10.1 on Reiserfs on IDE 13GB HDD

Assumptions

You are working on the command line interface, perhaps remotely. Grant does not often work in the GUI, and certainly cannot remember compiling and installing a kernel from there :)

Enjoy!

This may be a learning experience, it may break your machine, but it rarely eats filesystems, for that you need to try the bleeding edge development kernels. Take it easy, it may take several attempts to 'get it right' for you. But there is immense satisfaction in getting to know one's OS just a little better.


Table of Contents

Preparation
Prerequisites
Update Slackware

Install kernel source
Where to get the source
Patching 2.4.29 to 2.4.31
Creating a working source tree
Create custom EXTRAVERSION

Kernel configuration
Collect info about system
Kernel configuration
Adding EXPERIMENTAL options
Pre-compile planning, adjust the bootloader

Compiling the kernel
Checking out the new kernel
It is not just the kernel
Common problems
Automating the kernel install
The installkernel script option
Running third party patches

Preparation

Prerequisites

Slackware-10.1 installed on a PC :o) At least the first two Slackware CDROMs. Some time and patience. A willingness to 'Have a go, mate'; even if it means breaking the machine. Common recovery scenarios are discussed later. Also check you installed the d/* development tools and k/kernel-source.

Update Slackware

It is prudent to keep up to date with patches to the distro, fixes may be security related or bugs serious enough to impact performance. Use your preferred method to obtain Slackware updates. See:

http://www.slackware.com/getslack/

choose a mirror and grab the updates, for example:

ftp://ftp.planetmirror.com/pub/slackware/slackware-10.1/patches/*
ftp://ftp.planetmirror.com/pub/slackware/slackware-10.1/patches/packages/*

but probably not:

ftp://ftp.planetmirror.com/pub/slackware/slackware-10.1/patches/source/*

When you have the patches, issue:

# upgradepkg /path/to/slackware-10.1/patches/packages/*tgz

Install kernel source

We will follow Linus' advice and compile new kernel under our user directory. For the following exercise, assume we compiling kernel in ~/kernel/

Where to get the source

The central repository for the linux-kernel source is kernel.org, as for the Slackware updates above, try to use a local mirror to spread the load:

http://www.XY.kernel.org/pub/linux/kernel/v2.4/

or

ftp://ftp.XY.kernel.org/pub/linux/kernel/v2.4/

where XY is your country code, omit the country code to reach main server.

Slackware-10.1 comes with 2.4.29 so may save ourselves a 30MB download and copy the installed kernel source to user area and patch the distro 2.4.29 kernel up to the latest version (2.4.31 as of this writing).

If you have Slackware-10.2 or have updated to 2.4.31 from Slackware-current, take a copy of the kernel-source:

$ mkdir kernel
$ cp -a /usr/src/linux-2.4.31/ kernel

and skip to creating a working source tree.

Patching 2.4.29 to 2.4.31

Grab the linux-kernel patches, we need:

ftp://ftp.au.kernel.org/pub/linux/kernel/v2.4/patch-2.4.30.gz (114kB)
ftp://ftp.au.kernel.org/pub/linux/kernel/v2.4/patch-2.4.31.gz (28kB)

Then,

$ mkdir kernel
$ cp -a /usr/src/linux-2.4.29/ kernel
$ cd kernel/
$ mv linux-2.4.29 linux-2.4.31
$ cd linux-2.4.31
$ zcat /path/to/patch-2.4.30.gz | patch -p1
$ zcat /path/to/patch-2.4.31.gz | patch -p1
$ cd ..

Creating a working source tree

Why? Two reasons: make 'rm -rf' your friend: easy to wipe out a source tree and start over if you goof up the patching (stuff happens). Secondly, it keeps a clean, non-patched copy of the source tree for future updates. These reasons no longer hold the same meaning on fast boxen, but if you working with an old 'freebie' box to make a firewall, for example, these techniques can help. Here we go:

$ cp -al linux-2.4.31 linux-2.4.31a
$ cd linux-2.4.31a

Create custom EXTRAVERSION

Why change EXTRAVERSION?? So your custom kernel does not wipe out the distro kernel /lib/modules/ directory, that's why! Assuming you updated the distro kernel to Slackware-current 2.4.31, for example.

Now we have the kernel sources up to date, it is time to configure the kernel to suit our system.

Duplicate hardlinked file prior to edit: <<== Important!

$ mv Makefile Makefile~; cp Makefile~ Makefile
$ vim Makefile
Confidence booster (or deflator :), check you now have two different Makefiles:
$ head -5 Makefile
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 31
EXTRAVERSION = a

$ head -5 ../linux-2.4.31/Makefile
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 31
EXTRAVERSION =

Note: 2.6 series kernel have a *config option to append local version.

Next, we look at configuring the new kernel.

Kernel configuration

In this section we gather information about the hardware and configure the kernel to suit the hardware plus the intended use of the machine. The example configuration is for a very basic setup and will likely require additions in order to make a more usable system. Season to taste.

Collect info about system

Do an lspci to see what hardware you have - important bits highlighted and [n] will be referenced further below for the example 'silly' box:

# lspci

00:00.0 Host bridge: Intel Corp. 440LX/EX - 82443LX/EX Host bridge (rev 03)
00:01.0 PCI bridge: Intel Corp. 440LX/EX - 82443LX/EX AGP bridge (rev 03)
        ^^^                     ^^^^^^^^              ^^^                 [0]
00:07.0 ISA bridge: Intel Corp. 82371AB/EB/MB PIIX4 ISA (rev 01)
        ^^^                                                               [1]
00:07.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE (rev 01)
        ^^^                                      ^^^^^                    [2]
00:07.2 USB Controller: Intel Corp. 82371AB/EB/MB PIIX4 USB (rev 01)
        ^^^             ^^^^^                                             [3]
00:07.3 Bridge: Intel Corp. 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:08.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 08)
        ^^^^^^^^             ^^^^^                           ^^^^^^^      [4]
00:09.0 Ethernet controller: Digital Equipment Corporation DECchip 21140 [FasterNet] (rev 22)
        ^^^^^^^^                                           ^^^^^^^^^^^^^  [5]
01:00.0 VGA compatible controller: ATI Technologies Inc 3D Rage IIC AGP (rev 7a)
        ^^^                                                         ^^^   [6]

[0] Machine is new enough (!?) to have a PCI bus
[1] It also has ISA slots, modern boxen don't have these
[2] The IDE hard and CDROM drives uses PIIX4 interface

Drivers: discover driver names by reading the *config help menus, it does get easier once your fingers get it...

[3] USB = uhci (discover by reading <Help> below, choose the JE driver)
[4] NIC = e100 (by Intel, now is better than the older Becker eepro100 driver)
[5] NIC = tulip (a large family of NICs are based on or emulate DECchip)
[6] AGP = agpgart support for 440LX/EX [0]

Check what cpu:

# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 3
model name      : Pentium II (Klamath)
                  ^^^^^^^^^^                                              [7]
...
# cat /proc/meminfo
MemTotal:       126372 kB
                ^^^^^^^^^                                                 [8]

Kernel configuration

Think about what you need for the machine, this example is for a localnet machine with NFS, nothing fancy...

Your configuration will likely need more, but then, that is the whole idea, to start you on the path to customising your own system.

Starting from scratch

To clear everything and start fresh, skip this step for fresh kernel source:

$ make mrproper

and here we go:

$ make menuconfig

GUI users may prefer make xconfig...

Any menus not shown in list below indicate that all items in missing menu are turned off (blank). Brought to you by the characters *, M and N; for Yes, Maybe (Module) and No (< >)

Square brackets [ ] indicate a Yes/No choice. Angle brackets < > indicate Yes/Module/No choice No brackets indicate string entry, a really basic backspacing editor, often fails to show the cursor, backspace to clear previous entry.

Remember to read <Help> for more information on a choice, often there will be a Y/N indication if unsure. If you get the message:

"There is no help available for this kernel option."

it is probably safe to turn off the option. Keep notes on items you are not sure of, these are likely the ones needing adjustment when things go wrong.

Code maturity level options
  [ ] Prompt for development and/or incomplete code/drivers

- Reduce choices by hiding the experimental options, we will revisit this menu later to turn on some experimental stuff.

Loadable module support
  [*] Enable loadable module support
  [ ]   Set version information on all module symbols
  [*]   Kernel module loader

- We are building a modular kernel with a fresh (reduced) set of modules, I find the above setting produces the least astonishing result.

Processor type and features
  (Pentium-Pro/Celeron/Pentium-II) Processor family                       [7]
  [ ] PGE extensions (not for Cyrix/Transmeta)
  [*] Machine Check Exception
  < > Toshiba Laptop support
  < > Dell laptop support
  < > /dev/cpu/microcode - Intel IA32 CPU microcode support
  < > /dev/cpu/*/msr - Model-specific register support
  < > /dev/cpu/*/cpuid - CPU information support
  (off) High Memory Support                                               [8]
  [ ] Math emulation
  [*] MTRR (Memory Type Range Register) support
  [ ] Symmetric multi-processing support
  [ ] Local APIC support on uniprocessors (NEW)
  [ ] Unsynced TSC support

- Select the CPU you have in your system, selecting wrong CPU may result in an unbootable kernel. Read the <Help> for other options.
- High memory support is for >= 1GB memory

General setup
  [*] Networking support
  [*] PCI support                                                         [0]
  (Any)   PCI access mode
  [*] ISA bus support                                                     [1]
  [*] PCI device name database
  [ ] EISA support
  [ ] MCA support
  [ ] Support for hot-pluggable devices
  [*] System V IPC
  [ ] BSD Process Accounting
  [*] Sysctl support
  (ELF) Kernel core (/proc/kcore) format
  < > Kernel support for a.out binaries
  [*] Kernel support for ELF binaries
  < > Kernel support for MISC binaries
  [ ] Select task to kill on out of memory condition
  [*] Power Management support
  <*>   Advanced Power Management BIOS support
  [ ]     Ignore USER SUSPEND
  [ ]     Enable PM at boot time
  [ ]     Make CPU Idle calls when idle
  [ ]     Enable console blanking using APM
  [*]     RTC stores time in GMT
  [ ]     Allow interrupts during APM BIOS calls
  [*]     Use real mode APM BIOS call to power off
  ACPI Support  --->
    [ ] ACPI Support

- Set the 'Use real mode APM BIOS call to power off' if your ATX box does not turn off on shutdown.
- ACPI needs to be turned on in BIOS, if present. Older ACPI boxen (prior to 2000) are not supported in 2.4 kernel.

Memory Technology Devices (MTD)
  < > Memory Technology Device (MTD) support

Parallel port support
  < > Parallel port support

Plug and Play configuration
  <*> Plug and Play support
  <*>   ISA Plug and Play support                                         [1]

- Turn on PnP support if you have BIOS PnP option on (recommended). Turn on ISA PnP support if you have PnP devices installed, this example has an ISA SoundBlaster 16 card.

Block devices
  <*> Normal floppy disk support
  < > XT hard disk support
  < > Compaq SMART2 support
  < > Compaq Smart Array 5xxx support
  < > Mylex DAC960/DAC1100 PCI RAID Controller support
  < > Promise SATA SX8 support
  <M> Loopback device support
  < > Network block device support
  < > RAM disk support
  [ ] Per partition statistics in /proc/partitions

- Loopback device is handy to have available for mounting .iso image files.

Multi-device support (RAID and LVM)
  [ ] Multiple devices driver support (RAID and LVM)

Networking options
  <*> Packet socket
  [*]   Packet socket: mmapped IO
  <*> Netlink device emulation
  [ ] Network packet filtering (replaces ipchains)
  [ ] Socket Filtering
  <*> Unix domain sockets
  [*] TCP/IP networking
  [*]   IP: multicasting
  [ ]   IP: advanced router
  [ ]   IP: kernel level autoconfiguration
  < >   IP: tunneling
  < >   IP: GRE tunnels over IP
  [ ]   IP: multicast routing
  [ ]   IP: TCP Explicit Congestion Notification support
  [ ]   IP: TCP syncookie support (disabled per default)
    IP: Netfilter Configuration  --->
    IP: Virtual Server Configuration  --->
  < > 802.1Q VLAN Support
  ---
  < > The IPX protocol
  < > Appletalk protocol support
  < > DECnet Support
  < > 802.1d Ethernet Bridging
  QoS and/or fair queueing  --->
  Network testing  --->

Telephony Support
  < > Linux telephony support

ATA/IDE/MFM/RLL support
  <*> ATA/IDE/MFM/RLL support
  IDE, ATA and ATAPI Block devices  --->
    <*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
    --- Please see Documentation/ide.txt for help/info on IDE drives
    [ ]   Use old disk-only driver on primary interface
    [ ]   Support for SATA (deprecated; conflicts with libata SATA driver)
    <*>   Include IDE/ATA-2 DISK support
    [ ]     Use multi-mode by default
    [ ]     Auto-Geometry Resizing support
    <M>   Include IDE/ATAPI CDROM support
    < >   Include IDE/ATAPI TAPE support
    < >   Include IDE/ATAPI FLOPPY support
    <M>   SCSI emulation support                   <<== optional, for burners
    [ ]   IDE Taskfile Access
    --- IDE chipset support/bugfixes
    [ ]   CMD640 chipset bugfix/support
    [ ]   ISA-PNP EIDE support
    [*]   PCI IDE chipset support
    [ ]     Generic PCI IDE Chipset Support                  <<== last resort
    [ ]     Sharing PCI IDE interrupts support      <<== for PCI IDE adapters
    [*]     Generic PCI bus-master DMA support
    [ ]     Boot off-board chipsets first support
    [ ]       Force enable legacy 2.0.X HOSTS to use DMA
    [*]       Use PCI DMA by default when available
    [ ]     Enable DMA only for disks      <<== example: Iomega ATAPI Zipdisk
    ...
    <*>     Intel PIIXn chipsets support                                  [2]
    ...
    [ ]   Other IDE chipset support
    [ ]   IGNORE word93 Validation BITS        <<== for 80-way ribbon problem
    < > Support for IDE Raid controllers (EXPERIMENTAL)

- Minimise the options turned on here to only those required, we have CDROM and SCSI emulation for an each-way bet on the CDROM access method.
- Compile in driver matching your chipset!

SCSI support
  <M> SCSI support                      <<== Compile in for SATA or SCSI boot
  --- SCSI support type (disk, tape, CD-ROM)
  <M>   SCSI disk support                                          <<== ditto
  (4) Maximum number of SCSI disks that can be loaded as modules
  < >   SCSI tape support
  < >   SCSI OnStream SC-x0 tape support
  <M>   SCSI CD-ROM support              <<== for ide-scsi or real SCSI CDROM
  [ ]     Enable vendor-specific extensions (for SCSI CDROM) (NEW)
  (2) Maximum number of CDROM devices that can be loaded as modules (NEW)
  <M>   SCSI generic support                                 <<== for burners
  --- Some SCSI devices (e.g. CD jukebox) support multiple LUNs
  [*]   Enable extra checks in new queueing code
  [ ]   Probe all LUNs on each SCSI device
  [*]   Verbose SCSI error reporting (kernel size +=12K)
  [ ]   SCSI logging facility
  SCSI low-level drivers  --->             <<== check all off for IDE systems

- Compile SCSI support in for SATA boot drive, may be module for SCSI CD-ROM for scdX, SCSI generic for sgX devices. SCSI layer is also used for USB storage. Generally speaking, compile in for boot drive, otherwise module.

Fusion MPT device support
  < > Fusion MPT (base + ScsiHost) drivers

I2O device support
  < > I2O support

Network device support
  [*] Network device support                                          [4] [5]
  ARCnet devices  --->
    < > ARCnet support

  < > Dummy net driver support
  < > Bonding driver support
  < > EQL (serial line load balancing) support
  < > Universal TUN/TAP device driver support
  < > General Instruments Surfboard 1000
  Ethernet (10 or 100Mbit)  --->
    [*] Ethernet (10 or 100Mbit)
    ...
    [*]   EISA, VLB, PCI and on board controllers
    ...
    <M>     DECchip Tulip (dc21x4x) PCI support                           [5]
    [*]       Use PCI shared mem for NIC registers
    ...
    <M>     EtherExpressPro/100 support (e100, Alternate Intel driver)    [4]
    ...
    [ ]   Pocket and portable adapters

  Ethernet (1000 Mbit)  --->
  [ ] FDDI driver support
  ...
  Wireless LAN (non-hamradio)  --->
  Token Ring devices  --->
  [ ] Fibre Channel driver support
  Wan interfaces  --->

- Generally speaking, compile in a single NIC driver, or use modules for multi NIC system, or if using older ISA NICs that require parameters.

Amateur Radio support
  [ ] Amateur Radio support

IrDA (infrared) support
  < > IrDA subsystem support

ISDN subsystem
  < > ISDN support

Old CD-ROM drivers (not SCSI, not IDE)
  [ ] Support non-SCSI/IDE/ATAPI CDROM drives

Input core support
  <*> Input core support
    < >   Keyboard support                              <<== for USB keyboard
    <*>   Mouse support                                    <<== for USB mouse
    (1024)    Horizontal screen resolution
    (768)    Vertical screen resolution
    < >   Joystick support
    < >   Event interface support
    < >   User level driver support

- Need above for USB mouse, screen resolution is for scaling tablet type pointing devices.

Character devices
  [*] Virtual terminal                       <<== blank console without this!
  [*]   Support for console on virtual terminal            <<== and this too!
  <*> Standard/generic (8250/16550 and compatible UARTs) serial support
  [ ]   Support for console on serial port
  [ ] Extended dumb serial driver options
  [ ] Non-standard serial port support
  [*] Unix98 PTY support
  (256) Maximum number of Unix98 PTYs in use (0-2048)
  I2C support  --->
  Mice  --->
    < > Bus Mouse Support
    <*> Mouse Support (not serial and bus mice)
    [*]   PS/2 mouse (aka "auxiliary device") support
    ...

  Joysticks  --->
  < > QIC-02 tape support
  < > IPMI top-level message handler
  Watchdog Cards  --->
  ...
  <*> Enhanced Real Time Clock Support
  ...
  Ftape, the floppy tape device driver  --->
  ...
  <*> /dev/agpgart (AGP Support)                                          [0]
  [*]   Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 support
  ...
  Direct Rendering Manager (XFree86 DRI support)  --->
  < > ACP Modem (Mwave) support
  < > HP OB600 C/CT Pop-up mouse support

- Say <*> to AGP support if you have AGP card, and select appropriate chipset, select DRI only if your graphics chipset is mentioned [6]
- Say <M> to AGP support if you intend to use nVidia or ATI binary driver.

Multimedia devices
  < > Video For Linux

File systems
  [ ] Quota support
  < > Kernel automounter support
  < > Kernel automounter version 4 support (also supports v3)
  <*> Reiserfs support
  [ ]   Enable reiserfs debug mode
  [ ]   Stats in /proc/fs/reiserfs
  < > Ext3 journalling file system support
  <M> DOS FAT fs support                     <<== for floppies and USB sticks
  <M>   MSDOS fs support                                        <<== this too
  < >     UMSDOS: Unix-like file system on top of standard MSDOS fs
  <M>   VFAT (Windows-95) fs support                  <<== long filenames too
  < > Compressed ROM file system support
  [ ] Virtual memory file system support (former shm fs)
  <M> ISO 9660 CDROM file system support
  [*]   Microsoft Joliet CDROM extensions
  [*]   Transparent decompression extension              <<== yet to meet one
  < > JFS filesystem support
  < > Minix fs support
  < > FreeVxFS file system support (VERITAS VxFS(TM) compatible)
  < > NTFS file system support (read only)
  < > OS/2 HPFS file system support
  [*] /proc file system support
  [*] /dev/pts file system for Unix98 PTYs
  < > QNX4 file system support (read only)
  < > ROM file system support
  <*> Second extended fs support
  < > System V/Xenix/V7/Coherent file system support
  < > UDF file system support (read only)
  < > UFS file system support (read only)
  < > XFS filesystem support
  Network File Systems  --->                  <<== only if you have local net
     < > Coda file system support (advanced network fs)
     <*> NFS file system support
     [*]   Provide NFSv3 client support
     <M> NFS server support
     [*]   Provide NFSv3 server support
     [*]   Provide NFS server over TCP support
     <M> SMB file system support (to mount Windows shares etc.)  <<== windoze
     [ ]   Use a default NLS (NEW)
     [ ]   Enable Unix Extensions (NEW)
     < > NCP file system support (to mount NetWare volumes)

  Partition Types  --->
  Native Language Support  --->

- Remember to compile in boot and main filesystem support! <<== Important!

  Partition Types  --->
    [ ] Advanced partition selection

  Native Language Support  --->
         Default NLS Option: "iso8859-1" (NEW)
    <*> Codepage 437 (United States, Canada) (NEW)
    ...
    <*> NLS ISO 8859-1  (Latin 1; Western European Languages) (NEW)
    ...

- Add more to taste :)

Console drivers
  [*] VGA text console
  [*] Video mode selection support

- We revisit this item below.

Sound
  < > Sound card support

USB support
  <*> Support for USB
  [*]   USB verbose debug messages
  --- Miscellaneous USB options
  [*]   Preliminary USB device filesystem
  --- USB Host Controller Drivers
  <*>   UHCI Alternate Driver (JE) support                                [3]
  < >   OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
  --- USB Device Class drivers
  <M>   USB Mass Storage support
  ...
  --- USB Human Interface Devices (HID)
  <*>   USB Human Interface Device (full HID) support      <<== for USB mouse
  [*]     HID input layer support                <<== ditto, USB keyboard too
  [ ]     /dev/hiddev raw HID device support
  ...

Bluetooth support
  < > Bluetooth subsystem support

Kernel hacking
  [ ] Kernel debugging
  (0) Kernel messages buffer length shift (0 = default)

Cryptographic options
  [ ] Cryptographic API

Library routines
  <*> CRC32 functions
  <*> zlib decompression support
  <*> zlib compression support

- Not all above may be displayed, safe to say yes.

That is it for first pass, some important stuff like the VESA framebuffer was hidden while the EXPERIMENTAL flag was turned off, now we turn on that flag and revisit the console menu.

Adding EXPERIMENTAL options

If you skip this section be sure to delete the vga = nnn in /etc/lilo.conf or set it to a valid VGA display value, use the Source, Luke.

Code maturity level options
  [*] Prompt for development and/or incomplete code/drivers

If you use the machine without a GUI, you may like to use vesafb, though it is slower than a 80x25 screen. Example: a 100x37 character screen on an 800x600 display allows me to forgo the GUI on a laptop. The specific chip drivers below rarely perform well, VESA VGA 2.0+ is common.

Console drivers
  [*] VGA text console
  [*] Video mode selection support
  < > MDA text console (dual-headed) (EXPERIMENTAL) (NEW)
  Frame-buffer support  --->                                      <<== vesafb
    [*] Support for frame buffer devices (EXPERIMENTAL) (NEW)
    ...
    [*]   VESA VGA graphics console (NEW)
    ...
    [*]   Select compiled-in fonts (NEW)
    ...
    [*]     Sparc console 8x16 font (NEW)
    [ ]     Sparc console 12x22 font (not supported by all drivers) (NEW)
    ...

- If your screen is 1024x768 or larger, try the "Sparc console 12x22 font", very nice on 1280x1024 display.

We're done, exit, saving configuration.

!!Important!! ALWAYS run make dep immediately after make *config when you see following message:
*** Next, you must run 'make dep'               <<== Important!
$ make dep

Pre-compile planning, adjust the bootloader

Check kernel version:

$ head -5 Makefile
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 31
EXTRAVERSION = a

Switch to super-user, backup the distro /etc/lilo.conf just in case...

# cp /etc/lilo.conf /etc/lilo.conf.bkp

Then edit /etc/lilo.conf, I prefer to remove noise, see 'man lilo.conf'

# /etc/lilo.conf for Slackware on silly
#
boot = /dev/hda
root = /dev/hda3                  <<== this box Slackware only, so may move..
read-only                        <<== ..these two into the top global section
compact                    <<== speeds initial LILO loading, produces warning
prompt
timeout = 50                                         <<== five second timeout

# vesa| 800x600 1024x768 1280x1024           <<== table from the source, Luke
# ---- -------- -------- ---------
# 256 |  0x303    0x305    0x307
# 32k |  0x313    0x316    0x319
# 64k |  0x314    0x317    0x31A
# 16M |  0x315    0x318    0x31B
vga = 0x303                                     <<== hexadecimal, same as 771

image = /boot/bzImage-2.4.31a                          <<== new kernel stanza
  optional
  label = 2.4.31a

image = /boot/vmlinuz-ide-2.4.31          <<== distro kernel stanza, modified
  label = Slack-2.4.31

# end

Thus we have configured our new kernel, probably a) the most boring, b) yet the most important part of the exercise. Next, we'll try compiling our new kernel.

Compiling the kernel

This is it! Time to compile our new kernel. Briefly (because there's more than one way to do it, this works for me), assumes you did edit lilo.conf:

$ make bzImage modules
$ su
# make install modules_install
# mv /vmlinuz /boot/bzImage-2.4.31a
# mv /System.map /boot/System.map-2.4.31a
# cp .config /boot/config-2.4.31a
# lilo                             <<== you cannot run lilo too many times ;)
# reboot

Congratulations! That was easy... Wasn't it? No? Read on...

Checking out the new kernel

Use dmesg, two forms:

  dmesg | less              # view current dmesg, which may be different to
  less /var/log/dmesg       # viewing the boot time dmesg, it depends...

Also check /var/log/syslog, /var/log/debug and perhaps /var/log/messages

First line of dmesg tells you about the new kernel:

Linux version 2.4.31a (root@silly) (gcc version 3.3.4) #6 Tue Jul 19 09:36:57 EST 2005

If you don't see this first line of dmesg then you know to check /var/log/dmesg for the startup boot information as well. The dmesg ring-buffer is dumped to /var/log when filesystem is remounted r/w.

The rest? It depends... Too.

It is not just the kernel

The startup scripts have much to do with how your machine performs, some options may need adjustment to suit hardware. Another trap for the unwary is the hotplug blacklist, it may disable loading a module you require. If you want to run your system with demand loaded modules, you need not load everything at boot, this aspect is less important on modern hardware...

Common problems

Compile as user fails with permissions error
As root, perform 'make clean', or chown -R user /path/to/top/of/source. You may choose to perform entire kernel build as root to avoid this issue, your choice.

Compile fails at different places
Check hardware, overheating CPU or flaky memory, compiling kernels read/writes lots of little files, uses all CPU and is a far better memory tester than memtest86 :o)

Compile fails at same place
This should not happen in stable kernel series, remove the offending kernel source tree and start over :) Stuff happens. Remember the only important system information in a kernel source is your .config file, the rest is as close as the install CDROMs or kernel.org tarball.

Boot failure with blank screen :(
Oops, something bad... hit Ctrl-Alt-Del, you should notice some disk activity and after a little while the machine reboots, select distro kernel and start from 'make menuconfig' again.

If Ctrl-Alt-Del did nothing, hot NumLock twice, nothing happen? Box locked up, remove any non-essential USB devices, power cycle (to get a hardware power-on reset), and select distro kernel, start over.

Also consider this sequence:
    $ mv .config ..; make mrproper; mv ../.config .
    $ make oldconfig; make dep; make bzImage modules
    $ su
    # make install modules_install
Install boot files and run lilo, see next section for automating install.

Boot failure, text on screen
Okay, where did it fail? Keep in mind we had a running system, so it cannot be too difficult. If the system made it to a CLI prompt, it may be missing modules or startup scripts. There's usually a hint on the screen. If there's not enough information, then another technique may serve, this is generally for laptops :) They can be a little more tricky to customise.

Start by turning off the execute bit on all /etc/rc.d/rc.* scripts, apart from the rc.? basic startup scripts.

Reboot should get you to a prompt from where you may switch to /etc/rc.d and start scripts one by one with, for example, networking:
    sh rc.inet1 start
    sh rc.inet2 start
    ...
You see the notion, re-enable the non-crash items as you go, serves as a progress marker and speeds up the reboot after next crash :) Once you isolate the offending script, study it and work out why it crash...

When it happened to me it was module load order in rc.pcmcia, I needed CardBus first... This is also when you appreciate running a journalled filesystem (a small, separate /boot may be ext2 as it is rarely written).

Minor failure
This is where the fun starts, tracking down and reducing the difference between what is, and your understanding thereof. Be patient, after all, you may always reboot to the distro kernel, try again later. This is for enjoyment, not a heavy slog.

Still have problems?
Time to take a break... Then its the old STFW or JFGI. And read the various fora. Perhaps even write to them, as a last resort, naturally.

Feedback
To aols, it is a very gentle group, livened up occasionally with odd characters (as in people, not glyphs) and flamefests. 8-)

Automating the kernel install

For those who want to compile the kernel more than once, a suggestion for making it a little easier. Two aspects come to mind, what if I want to go back to previous configuration? How much to automate? Over the years this linux user settled on automating the kernel backup and install, but not automating rewriting /etc/lilo.conf, for example, as it is trivial to copy/modify a stanza for a new kernel.

As root, edit /etc/lilo.conf and add one more stanza:

# /etc/lilo.conf for slackware on silly
#
boot = /dev/hda
root = /dev/hda3
read-only
compact
prompt
timeout = 50

# vesa| 800x600 1024x768 1280x1024
# ---- -------- -------- ---------
# 256 |  0x303    0x305    0x307
# 32k |  0x313    0x316    0x319
# 64k |  0x314    0x317    0x31A
# 16M |  0x315    0x318    0x31B
vga = 0x303

image = /boot/bzImage-2.4.31a
  optional
  label = 2.4.31a

image = /boot/bzImage-2.4.31a.old             <<== allow boot previous kernel
  optional
  label = 2.4.31a.old

image = /boot/vmlinuz-ide-2.4.31
  label = Slack-2.4.31
  append = ""

# end

Next,

# lilo
Warning: COMPACT may conflict with LBA32 on some systems <<== Mostly Harmless
Added 2.4.31a *
Skipping /boot/bzImage-2.4.31a.old   <<== this is what that 'optional' allows
Added Slack-2.4.31

The installkernel script option

Script arch/i386/boot/install.sh is called from 'make install', in turn install.sh tries first ~/bin/installkernel then /sbin/installkernel.

The first call gives the user control over the installation, the second call to /sbin/installkernel is made if ~/bin/installkernel is missing, some distros use this for their install process. Slackware doesn't use it, so you may place the script in either location.

Get the script from here, or try the latest version from ftp://ftp.bugsplatter.mine.nu/scripts/installkernel.gz

Running third party patches

I use the hotfix patches for 2.4 kernels, there are other security patches out there. I tend to keep separate hardlinked source trees for each patch, easing maintenance. It also lets you 'rm -rf' the branch and start over quite easily. This is useful when patching the kernel, one slip and the source is broken, better to wipe it out and start over than to attempt a repair.

Example, update to 2.4.31-hf2

Grab the 5kB patch from: http://linux.exosec.net/kernel/2.4-hf/2.4.31/2.4.31-hf2/2.4.31-hf2.withver.diff.gz

Split off a hardlinked copy of the source tree for the hotfix patch.

$ cd ~/kernel
$ cp -al linux-2.4.31 linux-2.4.31-hf2
$ cd linux-2.4.31-hf2
$ zcat /path/to/2.4.31-hf2.withver.diff.gz | patch -p1 <<== adds EXTRAVERSION
$ cp /boot/config-2.4.31a .config                  <<== reuse existing config
$ make oldconfig; make dep; make bzImage modules     <<== configure and build

While the kernel is compiling, open a root terminal adjust /etc/lilo.conf:

# /etc/lilo.conf for slackware on silly
#
boot = /dev/hda
root = /dev/hda3
read-only
compact
prompt
timeout = 50

# vesa| 800x600 1024x768 1280x1024
# ---- -------- -------- ---------
# 256 |  0x303    0x305    0x307
# 32k |  0x313    0x316    0x319
# 64k |  0x314    0x317    0x31A
# 16M |  0x315    0x318    0x31B
vga = 0x303

image = /boot/bzImage-2.4.31-hf2        <<== duplicate stanza, change version
  optional
  label = 2.4.31-hf2                             <<== change version here too

image = /boot/bzImage-2.4.31a
  optional
  label = 2.4.31a

image = /boot/bzImage-2.4.31-hf2.old                <<== optional prior build
  optional
  label = 2.4.31-hf2.old

image = /boot/bzImage-2.4.31a.old
  optional
  label = 2.4.31a.old

image = /boot/vmlinuz-ide-2.4.31              <<== recommended, distro kernel
  label = Slack-2.4.31

# end

Grab a coffee, whatever your poison... tick ... tick ... tock...

Don't watch the compile too closely, yes, there are warnings, again, mostly harmless. If you see "Error...", yes, then you have a problem.

We got a prompt, I usually uparrow to see what the last command was :o)

Install the kernel using the installkernel script (called automagically from the 'make install').

$ su
# make install
...
sh -x ./install.sh 2.4.31-hf2 bzImage /home/grant/linux-2.4.31-hf2/System.map ""
+ '[' -x /root/bin/installkernel ']'
+ exec /root/bin/installkernel 2.4.31-hf2 bzImage /home/grant/linux-2.4.31-hf2/System.map ''

Grant's /root/bin/installkernel, 2005-07-22
* Destination files:
        config:         /boot/config-2.4.31-hf2
        kernel:         /boot/bzImage-2.4.31-hf2
        modules:        /lib/modules/2.4.31-hf2
        map:            /boot/System.map-2.4.31-hf2

* Moving old kernel files to /boot/*.old

* Moving /lib/modules/2.4.31-hf2 to /lib/modules/2.4.31-hf2.old

* Writing new kernel files to /boot

* Run lilo
Warning: COMPACT may conflict with LBA32 on some systems
Added 2.4.31-hf2 *                                         <<== new kernel
Added 2.4.31a
Skipping /boot/bzImage-2.4.31-hf2.old              <<== harmless, intended
Skipping /boot/bzImage-2.4.31a.old
Added Slack-2.4.31                   <<== keep the distro kernel available

* Reminder: make modules && make modules_install

make[1]: Leaving directory `/home/grant/kernel/linux-2.4.31-hf2/arch/i386/boot'

Thus,

# make modules_install
# reboot

Rinse and repeat...



BerliOS Logo