Bering-uClibc 4.x - Developer Guide - Adding a Kernel Architecture Variant

From bering-uClibc
Jump to: navigation, search
Adding a Kernel Architecture Variant
Prev Bering-uClibc 4.x - Developer Guide Next


Introduction

Bering-uClibc 3.x was built for a single "lowest common denominator" platform - a generic i486 CPU. This offered maximum flexibility but meant that it was not possible to include optimisations for more recent CPU models, which is becoming more of a problem as the i486 gets older and less common.

For Bering-uClibc 4.x this approach has changed and a small number of different CPU platform variants are supported as standard. Specific kernels and kernel Modules are built for all of the supported variants and distributed via disk Image variants for each platform.

This page outlines the procedure for adding a new CPU variant to the standard list.


Add the Kernel Architecture Name

Most of the build tools automatically process each of the entries in the kernel architecture list which is defined in one place.

In file make/MasterInclude.mk edit the definition of variable "KARCHS" to add a new name to the space-separated list. Search for lines like:

# available kernel archs
export KARCHS:=i686 i486 geode

The new name should be short (ideally 4 characters) and should clearly refer to the new CPU architecture.

The new name will be referred to as "karch" in the remainder of this page.


Add the Kernel .config Patch File

Rather than separately maintaining a complete .config file each kernel variant a "baseline" plus "delta" approach has been adopted. All of the standard, common settings for Bering-uClibc 4.x are in the "baseline" file and just the bare minimum of variant-specific changes are in a per-variant "delta" file implemented in the form of a patch.

All of these files are stored in directory repo/linux/:

  • The "baseline" file is called Bering-kver.config where "kver"" is something like "2.6.35.11". For example Bering-2.6.35.11.config.
  • The "delta" file is called Bering-kver.config-karch.patch. For example Bering-2.6.35.11.config-i486.patch.

As part of the build process, each "delta" patch is applied to the "baseline" file to create file source/linux/Bering-kver.config-karch which is then copied to source/linux/linux-karch/.config and used to configure the kernel.

You need to create the new Bering-kver.config-karch file by some means and then create the patch as follows:

diff -c  Bering-kver.config  Bering-kver.config-karch  >  Bering-kver.config-karch.patch

The new .patch file name needs to be added to repo/linux/buildtool.cfg.


Add the kmodules Configuration

Since the kernel Modules vary from one kernel architecture variant to another each variant needs its own moddb-karch.lrp which is generated from the kmodules source.

Edit repo/kmodules/buildtool.cfg and add a new block of lines for "<moddb-karch>".


Add the initrd Configuration

Since the kernel Modules vary from one kernel architecture variant to another each variant needs its own initrd-karch.lrp which is generated from the initrd source.

Edit repo/initrd/buildtool.cfg and add a new block of lines for "<initrd-karch>".


Add the Image Configuration

Each kernel architecture variant needs its own disk Image variant(s).

Create a new directory under image/ and create file buildimage.cfg within that (best to copy and edit an existing file). Refer to the Building an Image page for details of the directory naming convention.

Repeat if multiple types (e.g. ISOLINUX versus SYSLINUX) of image are relevant for this kernel variant, but only create the minimum set likely to be required.


Add the Documentation

Usually, a new kernel architecture variant will be added because it is required for a specific hardware device which is particularly suitable for running Bering-uClibc 4.x.

Please therefore add some content to the Hardware-Specific Guides page of this Wiki to detail the hardware device and to specify which Image should be used for it.



Prev Up Next