Penguin

Updating the Kernel SourceCode without reconfiguring from scratch

Download and unpack the latest Kernel TarBall (ie from http://kernel.org/). Copy the .config file from the previous Kernel's directory to the fresh one. From the new directory, run make oldconfig to pick up the old configuration, then make menuconfig to change any options for the new Kernel.

To update the symlink:

ls -l /usr/src/linux
rm /usr/src/linux
cd /usr/src
ln -s linux-version linux

DebianLinux users will want to read KernelPackageNotes for information on using make-kpkg(1) to build a Kernel Deb. If not, they can follow the same steps, using

apt-cache search kernel-source # to find out the latest version
apt-get kernel-source-version

to download the latest source.

Updating your source tree to the latest version

patch-2.6.17 applies against 2.6.16, so if you have 2.6.16.n, you'll have to first remove the 2.6.16.n patch.

Use ketchup, a Python utility to handle this patching for you.

A good command line for NZ users:

ketchup -G -k ftp://ftp.nz.kernel.org/pub/linux/kernel -r 2.6

Only use -G if you trust the mirror!

Compiler Version

The Kernel can be sensitive to the version of GCC in use. F.ex. 2.4 and early 2.6 kernels did not work with GCC 3.x. They contained the following snippet in README
COMPILING the kernel:

 - Make sure you have gcc 2.95.3 available.  gcc 2.91.66 (egcs-1.1.2) may
   also work but is not as safe, and *gcc 2.7.2.3 is no longer supported*.

OTOH kernels since about 2.6.15 require GCC 3.x. Read the file to find the versions of compilers and other tools you need. Make sure to check the README and Documentation/Changes files to find out which version you need. Of course you always read the compile instructions for software you download, right? :)

To compile a kernel with a specific compiler, you can say eg. make CC=gcc-2.95 bzImage to make the bzImage target using the gcc-2.95 compiler. See also DistCC

Linking fails with bootsplash compiled into your kernel

Compiling aborts with the following message
  LD      .tmp_vmlinux1
drivers/built-in.o(.text+0xa898a): In function `splash_getraw':
: undefined reference to `con2fb_map'
drivers/built-in.o(.text+0xa918c): In function `splash_verbose':
: undefined reference to `con2fb_map'
drivers/built-in.o(.text+0xa9670): In function `splash_status':
: undefined reference to `con2fb_map'
drivers/built-in.o(.text+0xa97a4): In function `splash_read_proc':
: undefined reference to `con2fb_map'
drivers/built-in.o(.text+0xa997d): In function `splash_write_proc':
: undefined reference to `con2fb_map'
make: *** [.tmp_vmlinux1] Error 1

You need to have framebuffer console support compiled in. It can't be a module! Set CONFIG_FRAMEBUFFER_CONSOLE=y in the .config. NB This sounds like a one off bug that has probably been long fixed.

ModuleInitTools

Starting with 2.5.51, modules have a different format. The extension has also changed from .o to .ko, for kernel object. To work with modules, you need a completely rewritten set of module tools (modprobe(8), insmod(8), lsmod(8)), collectively called module-init-tools. They can coexist with the 2.4.x-specific tools. Note, however that module-init-tools no longer reads modules.conf and instead uses a new file called modprobe.conf(5) which has a different syntax. man 5 modprobe.conf will be your friend here. It's possible to set modprobe.conf to handle modules for both 2.4.x and 2.5.x kernels, which is pretty cool if you're a dual-booter.

nVidia and LinuxKernel 2.6

nVidia drivers version 1.0-6106 and up support all 2.4 and 2.6 kernels, including kernels with the new 2.6 option for 4k stacks.

Kconfig files

These are kernel configuration files. When the kernel configuration application is run, it reads the main kernel configuration file, located in /source/dir/arch/<your architecture>/Kconfig. This main configuration file then includes other configuration files from the different subdirectories in the kernel directory tree.

Don't edit these Kconfig files directly unless you are doing KernelDevelopment. These files are driven from .config file mentioned earlier in this article.

In the 2.4 series, you could read Documentation/Configure.help to get the equivalent information.

See also


CategoryKernel