Bering-uClibc 5.x - Developer Guide - Adding a Kernel Architecture Variant
Adding a Kernel Architecture Variant | ||
---|---|---|
Prev | Bering-uClibc 5.x - Developer Guide | Next |
Contents
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 and later 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/toolchain/i486-unknown-linux-uclibc.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 5.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.
Versions 5.0 and 5.1
All of these files are stored in directory repo/linux/
:
- The "baseline" file is called
Bering-kver.config
where "kver"" is something like "3.4.50". For exampleBering-3.4.50.config
. The baseline kernel is based on the i686 variant. - The "delta" file is called
Bering-kver.config-karch.patch
. For exampleBering-3.4.50.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
.
Version 5.2 and later
With Bering-uClibc 5.2 tools/confdiff.py
and tools/confpatch.py
replaced the
diff/patch utilities used earlier.
As before, all of these files are stored in directory repo/linux/
:
- The "baseline" file is called
Bering-kver.config
where "kver"" is something like "4.1.4". For exampleBering-4.1.4.config
. The baseline kernel is based on the i486 variant. - The "delta" file is called
Bering-kver.config-karch.patch
. For exampleBering-4.1.4.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:
tools/confdiff.py repo/linux/Bering-kver.config repo/linux/Bering-kver.config-karch > repo/linux/Bering-kver.config-karch.cdiff
The new .cdiff
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 5.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 |