Kernel Config Weight Kconfig Size Rev 0 2
Revision as of 03:34, 6 March 2007 by RBot (Bot (Edward's framework))
Table Of Contents:
- 1 Automated examination tool (rev 0.2)
- 2 Super-briefly explanation
- 2.1 What is Kconfig Size tool
- 2.2 How to use Kconfig Size tool
- 2.2.1 Build
- 2.2.2 Preparation for measurement
- 2.2.3 Measurement (Do your examination)
- 2.2.4 Represent measurement result
- 2.3 More information
- 3 Measurement result sample
Automated examination tool (rev 0.2)
Note Most of description in this chapter is duplicated from README file in the tool tar-ball. So it would be better download the tool and check it up.
What is Kconfig Size tool
Kconfig Size is a tool to measure the impact to the static size and memory usage caused by different kernel config items. Once top-level command kconfigsize is executed with the configuration file as parameter, the following will be executed automatically.
- Create the .config files for kernel make and build kernel images in order to measure the impact of each target-config-item which is specified by user. Each target-config-item will create one .config file and one kernel image.
- Measure the kernel image size and calculate the impact caused by each config item.
- Use kernel image to boot up the target machine and measure the memory usage, then calculate the impact caused by each config item. This process will repeat until all the kernel images are measured.
The result of size and memory usage can be represented by web interface or text file. Representation by web interface uses Kconfig Web.
How to use Kconfig Size tool
Download the tool tar-ball and execute below in appropriate directory on your host machine.
$ tar xzvf kconfigsize_rev0.2.0.tar.gz $ cd kconfigsize $ ./autogen.sh $ make $ make install
Executable binaries are installed to kconfigsize/bin/local.
Preparation for measurement
In order to perform measurement, necessary environment is as below.
- Linux kernel source code Only 2.6 series kernels are capable. 2.4 series can't be handled.
- Target machine When measure memory usage, emulator like qemu can be used as the target machine.
Target machine setting (only for measuring memory usage)
Target machine must be set like below.
- Kernel images can be downloaded from host machine by tftp.
- Console output can be read by host machine with serial console.
- Target machine should support below commands. dmesg, expr, sed, grep
- Target machine can be rebooted by command of host machine.
Please install the kconfigsize/bin/target/memfree.sh as boot script(/etc/rc?.d) to the target machine. More detail information about target machine setting and connection between target and host is described in docs/target_en.txt.
Applying patch to kernel source(only for measuring memory usage)
In order to measure memory usage, please apply the proper patch to kernel source code. Patches are put in kconfigsize/patches directory.
Create target-config-item list
In order to specify target-config-items, target-config-item list must be created. Kconfig Size has two measuring approaches, "top-down" and "bottom-up". Only one approach can be chosen at a time.
- top-down approach You need to specify .config file and target-config-item list. The tool measures impacts towards the size and memory usage of enabled config items (=y or =m) in the .config file. Config items to be measured are specified in target-config-item list.
- bottom-up approach You need to specify only target-config-item list, which defines both of minimum config items which are necessary for booting and target-config-items. The tool measures impact towards the size and memory usage of target-config-items.
Please note that the formats of target-config-item list are different in bottom-up and top-down approach. Detail information about target-config-item list is described in docs/configure_en.txt file, and please refer to it.
Create configuration file of Kconfig Size tool
Create the configuration file according to the environment. The major config items are as below.(Key name is in the brackets.)
- Name of the measurement (TEST_NAME)
- Output directory of measurement result (DB_PATH)
- Temporary output directory (WORK_PATH)
- .config file ... only used in top-down approach (KERNEL_CONFIG)
- Target-config-item list (TARGET_LIST)
- Directory of kernel source code (KERNEL_SOURCE)
- Kind of measurement need to be performed (DO_TEST) There are 3 kinds of measurement : size only, memory only, size and memory.
Below items are necessary only for memory measurement.
- Command for resetting target machine (RESET_HELPER)
- Command for communicating with target (MEM_MEASURE)
- Copy destination of kernel images for target machine (INSTALL_IMAGE)
Detail information about tool configration is also described in docs/configure_en.txt file, and please refer to it. In addition to it, the configuration examples are also available in kconfigsize/conf directory.
Measurement (Do your examination)
To start your measurement, please execute the command below.
$ kconfigsize/bin/kconfigsize <tool configuration file>
The tool will automatically create .config files, make kernel images, measure the image size, reboot the target machine, measure memory usage ,and then output the measurement result.
Represent measurement result
Measurement result can be viewed by web browser using CGI scripts so called Kconfig Web. Set the http server properly, and access the CGI script kconfigsize/bin/local/kconfigweb.cgi For more information, please refer to docs/kconfigweb_en.txt file.
There are documentation files listed below in docs directory. Please refer to them for more detail information. Files with suffix "_en" are written in English, and "_jp" are written in Japanese.
- configure_??.txt Details of target-config-item list and tool configuration.
- target_??.txt For measuring memory usage, host and target should be connected and set properly. This file contains details about how to set it.
- kconfigweb_??.txt Details about how to set the web interface and view the measurement result.
Measurement result sample
target-config-item list and result file
Below are sample target-config-item list for top-down approach and measurement result. Please try it to confirm how the results are represented on web-interface.
How to represent the sample result
- Extract the tar-ball of result appropriate directory. Now assume that the directory is /home/foo/.
$ cd /home/foo $ tar xzvf db.tar.gzDirectory named "db" is created, and result files are put in the directory.
- Create configuration file for Kconfig Web, and put it in Kconfig Size tool's configuration directory. The content of the configuration file must be as below.
db_dir=/home/foo/dbThe name of the file must be "kconfigweb.conf", and put it in kconfigsize/conf directory.
- Set your web server properly to make CGI scripts of Kconfig Web be able to work well.
- Access the CGI script below by your web browser.
- If successful, the simple page with only 2 links is represented. The links are "bottom-up" and "top-down". Please select the link of "top-down".
Note : "bottom-up" link will lead you to some complaining page, because no data by bottom-up approach is available.
- Can you see a page titled "top-down approach : Examination result" ? If so, congratulations Please try links and buttons to make confirm how about the results are represented.