From 1ae239ff80de3caa8b27ab84972b8e38f1cc4eae Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Fri, 12 Aug 2011 07:19:04 -0700 Subject: documentation/dev-manual/dev-manual-kernel-appendix.xml: Added kernel reconfigure example. this example uses the CONFIG_SMP configuration. By default, this configuration is disabled. The example shows how to use menuconfig and explains the .config file role and how you can use it combined with menuconfig to manage multiple configuration changes. Thanks to Darren Hart for identifying this simple change to demonstrate how to change the kernel configuration. (From yocto-docs rev: c571c01b8589ad6f76e66388c3ae24a1de029f65) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- .../dev-manual/dev-manual-kernel-appendix.xml | 210 +++++++++++++++++---- 1 file changed, 169 insertions(+), 41 deletions(-) (limited to 'documentation/dev-manual') diff --git a/documentation/dev-manual/dev-manual-kernel-appendix.xml b/documentation/dev-manual/dev-manual-kernel-appendix.xml index 4000a0b943..ffe3230126 100644 --- a/documentation/dev-manual/dev-manual-kernel-appendix.xml +++ b/documentation/dev-manual/dev-manual-kernel-appendix.xml @@ -495,14 +495,176 @@ Changing the Kernel Configuration - This section presents an example that changes the kernel configuration. - The example shows how to use menuconfig to quickly see - and set configurations used by the kernel. + This example changes the default behavior (off) of the Symmetric Multi-processing Support + (CONFIG_SMP) to on. + It is a simple example that demonstrates how to reconfigure the kernel. - - [Example to be supplied] - +
+ Getting Set Up to Run this Example + + + If you took the time to work through the example that modifies the kernel source code + in Modifying the Kernel Source + Code you are set up to quickly work through this example. + If not, then work through the following list to prepare: + + Understand the development environment: + See + Understanding the Files You Need for information. + Set up the local Yocto Project files Git + repository: + See + Setting Up the Local Yocto Project Files Git Repository for + information. + Set up the poky-extras Git + repository: + See + Setting Up poky-extras Git repository for + information. + Set up the the bare clone and its copy: + See + Setting Up the Bare Clone and its Copy for information. + + Build the default QEMU kernel image: + See + Building and Booting the Default QEMU Kernel image + for information. + Do not boot the image in the QEMU emulator at this point. + + +
+ +
+ Examining the Default <filename>CONFIG_SMP</filename> Behavior + + + By default, CONFIG_SMP supports single processor machines. + To see this default setting from within the QEMU emulator boot your image using + the emulator as follows: + + $ runqemu qemux86 + + + + + Login to the machine using root with no password. + After logging in, enter the following command to see how many processors are + being supported in the emulator. + The emulator reports support for a single processor: + + # cat /proc/cpuinfo | grep processor + processor : 0 + # + + +
+ +
+ Changing the <filename>CONFIG_SMP</filename> Configuration Using <filename>menuconfig</filename> + + + The menuconfig tool provides an interactive method with which + to set kernel configurations. + You need to run menuconfig inside the BitBake environment. + Thus, the environment must be set up using the oe-init-build-env + script found in the Yocto Project files Git repository build directory. + If you have not sourced this script do so with the following commands: + + $ cd ~/poky + $ source oe-init-build-env + + + + + After setting up the environment to run menuconfig, you are ready + to use the tool to interactively change the kernel configuration. + In this example we are basing our changes on the linux-yocto-3.0 + kernel. + The Yocto Project build environment recognizes this kernel as + linux-yocto. + Thus, the following command from the shell in which you previously sourced the + environment initialization script launches menuconfig: + + $ bitbake linux-yocto -c menuconfig + + + + + Once menuconfig launches, navigate through the user interface + to find the CONFIG_SMP configuration setting. + You can find it at Processor Type and Features. + The configuration selection is + Symmetric Multi-processing Support. + + + + Once you save the selection the .config configuration file + is updated. + This is the file that the build system uses to configure the Linux Yocto kernel + when it is built. + You can find and examine this file in the Yocto Project files Git repository in + the build directory. + This example uses the following: + + ~/poky/build/tmp/work/qemux86-poky-linux/linux-yocto-2.6.37+git1+84f...r20/linux-qemux86-standard-build + + + + + Within the .config you can see the following setting: + + CONFIG_SMP=y + + + + + A good method to isolate changed configurations is to use a combination of the + menuconfig tool and simple shell commands. + Before changing configurations with menuconfig simply rename + the default .config, use menuconfig to make + as many changes an you want and save them, then compare the renamed configuration + file against the newly created file. + You can use the resulting differences as your base to create configuration fragments + to permanently save in your kernel layer. + For an example of this procedure, see [WRITER'S NOTE: need forwarding link to section]. + +
+ +
+ Recompiling the Kernel and Testing the New Configuration + + + At this point you are ready to recompile your kernel image with + the new setting in effect using the BitBake commands below: + + $ bitbake linux-yocto -c compile -f + $ bitbake linux-yocto + + + + + Now run the QEMU emulator: + + $ runqemu qemux86 + + + + + Login to the machine using root with no password + and test for the number of processors the kernel supports: + + # cat /proc/cpuinfo | grep processor + processor : 0 + processor : 1 + # + + + + + From the output you can see that you have successfully reconfigured the kernel. + +
@@ -516,7 +678,7 @@ [Example to be supplied] -
+ @@ -584,40 +746,6 @@ It should just build whatever is necessary and not go through an entire build ag
Prepare to use <filename>menuconfig</filename> - - The menuconfig tool provides an interactive method with which - to set kernel configurations. - In order to use menuconfig from within the BitBake environment - you need to source an environment setup script. - This script is located in the local Yocto Project file structure and is called - oe-init-build-env. - - - - The following command sets up the environment: - - $ cd ~/poky - $ source oe-init-build-env - - -
- -
- Make Configuration Changes to the Kernel - - - After setting up the environment to run menuconfig you are ready - to use the tool to interactively change the kernel configuration. - In this example we are basing our changes on the linux-yocto-2.6.37 - kernel. - The Yocto Project build environment recognizes this kernel as - linux-yocto. - Thus, the following command from the shell in which you previously sourced the - environment initialization script launches menuconfig: - - $ bitbake linux-yocto -c menuconfig - - [WRITER'S NOTE: Stuff from here down are crib notes] -- cgit v1.2.3-54-g00ecf