Overview
Kernel configuration is a little complicated in Chromium OS. There are a number of different kernels based on architecture (x86, ARM), variants (generic, tegra2) and platforms (Seaboard, Mario). We want to split the config into a sort of hierarchy so that the common options are shared between the variants [why?] (click to enlarge):
Ultimately, as of Oct-10 there are 6 flavours, three for ARM and three for Intel (it is not clear why flavours is spelt the British way). Two of the variants are not actually distinct - these are are shown with arrows and are symlinks in the directory. In this case chromeos-arm just points to chromiumos-arm and they are the same.
Conversions
We need to be able to do the following:
- create a .config file for a particular flavour - this is done simply by concatenating the three levels for a particular flavour. For example we create the tegra2 flavour by concatenating base.config, armel/common.config and armel/chromeos-tegra2.flavour.config. This .config file is suitable for configuring the kernel.
- split a .config into its constituent parts. This is a little more complicated and has to be done for all flavours at once. Given a .config file for each flavour we can look for items which are common to all flavours - these can be put into the family config. We also look for everything common within each architecture - these are put into the architecture files like config.common.arm. The splitconfig script does this.
Scripts
Scripts to deal with the kernel configuration (in sys-kernel/chromeos-kernel or sys-kernel/chromeos-kernel-next) are in the chromeos/scripts directory:
$ ls chromeos/scripts/
compat_wireless_config kernelconfig prepareconfig splitconfig
compat_wireless_config
This particularly ugly script is used to setup configuration for compat-wireless which is used for some older wireless drivers. It is used in the emerge to set up the wireless_compat config which is separate from the kernel.
TODO: you need to manually ensure that the kernel config and the config in this script agree. Is this right?
We will not need compat_wireless in the end. The end is nigh.
kernelconfig
This script deals with each separate flavour in turn, performing the selected operations. It starts by building the config for each flavour, does the operations, and afterwards it splits the flavour configs back into the proper hierarchy. It supports three operations
- oldconfig - does a 'make oldconfig' on each config
- editconfig - does a 'make menuconfig' on each config
- genconfig - like oldconfig, but it leaves the generated full config files lying around afterwards in the CONFIGS directory
There is a bit of a problem with kernelconfig. If you want to change a kernel option which is common to all flavours, for example, then you must change it once for each flavour using 'kernelconfig editconfig'. At the moment this is 6 times! If you miss one, then the result may be no change which can be very confusing. See below for another approach.
prepareconfig
This is used to prepare the config for a particular flavour. It assembles the default config for the flavour, then embeds CONFIG_VERSION_SIGNATURE in the config file, which is a string like 'Ubuntu ${release}-${revision}-${flavour}' where release and revision are obtained from the changelog and the flavour is passed in on the command line.
This is useful when starting development on a board and you want to build in-tree:
./chromeos/scripts/prepareconfig chromeos-tegra2
export ARCH=arm
export CROSS_COMPILE=armv7a-cros-linux-gnueabi-
make oldconfig #(to pick up new options, if any)
make
...
This script is used in the emerge. An example resulting string is 'Ubuntu 2.6.32-0.1-chromeos-tegra2'
splitconfig
This takes all config.* files in the currect directory and works out the common options in each. It writes these to config.common, then generates new config.* files (overwriting the original ones) with these common options removed. As a side effect, all config options will be in sorted order.
This script is used by kernelconfig to extract the common options for an architecture, then again on a second level to extract the common options for Chromium OS.
Using the kernelconfig script
The kernel config is split into several config files - generic, chrome-specific, architecture-specific and board specific. Automatic tools split and combine these configs.
If you want to edit the configuration for a particular board etc. then you need to do something like:
$ cd .../src/third_party/kernel-next
$ ./chromeos/scripts/kernelconfig editconfig
This will run 'make menuconfig' for each part of the config. At the time of writing (Oct-10) this is:
- x86_64/chromeos-intel-pineview.flavour.config
- i386/chromeos-intel-menlow.flavour.config
- i386/chromeos-pinetrail-i386.flavour.config
- i386/chromiumos-i386.flavour.config
- armel/chromeos-arm.flavour.config
- armel/chromeos-tegra2.flavour.config
- armel/chromiumos-arm.flavour.config
You need to figure out which part your config options appear in, and then make the changes when that config comes up. When it says 'press a key', you have to press <enter>.