Changes between Version 1 and Version 2 of UndertakerTailorFlipper


Ignore:
Timestamp:
Oct 12, 2014, 9:23:56 PM (5 years ago)
Author:
ty86ciqi
Comment:

README eingebaut und angepasst

Legend:

Unmodified
Added
Removed
Modified
  • UndertakerTailorFlipper

    v1 v2  
    1 = TODO =
     1= Flipper: Lightweight Kernel Tailoring =
     2
     3'''Flipper''' can be used to gather information about the control flow in the kernel in order to
     4generate a minimal use-case specific configuration. While ftrace causes quite a lot of overhead
     5during the observation of the kernel, Flipper relies on small bit-setting instructions patched into
     6the kernel to collect data. Its advantages and results are presented in the GPCE '14 paper (1) and
     7Bernhard Heinloth's Master Thesis (2).
     8
     9== 1.) Patch instructions into a Linux source tree ==
     10
     11To prepare a kernel source directory, you need the semantic patch tool Coccinelle (spatch, more information at http://coccinelle.lip6.fr/).
     12
     13With Coccinelle installed, you can prepare a Linux kernel source tree by running the following command:
     14
     15{{{
     16        ./flipper/analyze.sh -i -b -B flipper/blacklist -m out.map -o out.patch -v path/to/linux-src/
     17}}}
     18
     19The resulting patch can then be applied to the kernel using the traditional patch util:
     20{{{
     21        patch -p1 -d path/to/linux-src/ < out.patch
     22}}}
     23
     24== 2.) Integrate character device to read tracing information ==
     25
     26Additionally, it is necessary to integrate the Flipper char device into the kernel.
     27
     28First, copy the required source files into the source folder
     29
     30{{{
     31        cp -r flipper/kernel/* path/to/linux-src/
     32}}}
     33
     34
     35Then you need to modify the following files to include the device into the build process:
     36
     37        In drivers/misc/Kconfig
     38                add
     39
     40{{{
     41                        source "drivers/misc/flipper/Kconfig"
     42}}}
     43
     44                before
     45
     46{{{
     47                        endmenu
     48                        [end of file]
     49}}}
     50
     51        In drivers/misc/Makefile
     52                add
     53
     54{{{
     55                        obj-$(CONFIG_FLIPPER_TRACE)     += flipper/
     56}}}
     57
     58                at the end of file
     59
     60        And in include/uapi/linux/Kbuild
     61                add
     62
     63{{{
     64                        header-y        += flipper.h
     65}}}
     66
     67                at the end of file
     68
     69Now you are ready to build the kernel.
     70
     71To enable this code point tracer, you have to enable the Flipper device in the
     72kernel configuration (CONFIG_FLIPPER_TRACE).
     73The value of CONFIG_FLIPPER_TRACE_ENTRIES must be equal or more than the number
     74of injected codepoints (for simplicity the number of lines of the out.map file).
     75We strongly recommend to enable CONFIG_FLIPPER_TRACE_ONE_ENTRY_PER_INDEX since
     76it not only avoids race-conditions but also uses less recording instructions
     77(at the cost of an increased size).
     78
     79== 3.) Use the system/run the target workload ==
     80
     81Use your target device booted with the prepared kernel in a typical manner.
     82
     83At the end, don't forget to save the recorded trace using
     84
     85{{{
     86        cp -f /dev/flipper trace.bitmap
     87}}}
     88
     89== 4.) Resolve tracing information to source code lines ==
     90
     91You are able to resolve the source code points using the evaluateMap script and the mapping file generated by the analyze.sh script:
     92
     93{{{
     94        ./flipper/evaluateMap.sh trace.bitmap out.map > trace.list
     95}}}
     96
     97
     98== 5.) Generate Linux kernel configuraion ==
     99
     100This file can be processed with the undertaker-tailor utility to generate your
     101linux configuration (maybe, more parameters will be needed, see the output
     102of "undertaker-tailor -h" or the README in the tailor/ subdirectory for further
     103details):
     104
     105{{{
     106        undertaker-tailor -f trace.list
     107}}}
     108
     109== References ==
     110Additional information about the approach can be found in
     111 - (1) Automatic Feature Selection in Large-Scale System-Software Product Lines, GPCE '14, Västerås, Sweden (https://www4.cs.fau.de/Publications/2014/ruprecht_14_gpce.pdf)
     112 - (2) Automatic Tailoring of the Multi-Purpose Linux Operating System on Embedded Devices, Master Thesis by Bernhard Heinloth (https://www4.cs.fau.de/Ausarbeitung/MA-I4-2014-09-Heinloth.pdf)