Tims Fastboot Tools
This page has materials to support Tim Bird's presentation "Tools and Techniques for Reducing Bootup Time". This presentation was first delivered at the Embedded Linux Conference, Europe, in November of 2008.
This patch was used by Tim for several kernel versions, to address problems with the printk-times feature on ARM platforms. It is very simple, and consists of just adding a flag to avoid calling sched_clock() too early.
This patch appears (as of kernel version 2.6.27) to be obsolete. The 2.6.27 kernel now calls cpu_clock() for printk_times. This uses a similar mechanism to flag when it is safe to call.
Here's the patch:
On most platforms, printk_clock() calls sched_clock(), which provides good timestamp resolution. However, most ARM boards use a timer source for sched_clock() which must be initialized at boot. If sched_clock() is called too early, the machine hangs. This code utilizes the default jiffies-based value for printk_clock, until told that sched_clock() is safe. This is almost always 0 before the clock is initialized, so this patch causes no loss of timing data, or confusing time switchover mid-boot. OMAP support is included. To utilize this on other ARM platforms, just add "safe_to_call_sched_clock=1" in the timer initialization code for your platform, when it is safe to call sched_clock(). Signed-off-by: Tim Bird <firstname.lastname@example.org> ChangeLog: 2008/02/05 Location: alp@oak--linux-3/alp-linux--dev-3--3.1 First changlog version. --- arch/arm/kernel/time.c | 8 7 + 1 - 0 ! arch/arm/mach-omap1/time.c | 3 3 + 0 - 0 ! include/asm-arm/mach/time.h | 2 2 + 0 - 0 ! 3 files changed, 12 insertions(+), 1 deletion(-) Index: alp-linux/arch/arm/kernel/time.c
"grabserial" is a simple program to grab and display data from a specified serial port. It can place a timestamp on each line received, which makes it useful for reporting timing of events seen on a booting system's serial console output.
See Grabserial for detailed information, sample output and download instructions.
Tim's quick and dirty process trace
Process trace is Tim's quick and dirty method of tracing early boot processes. As I write this (Oct, 2008), an boot tracer is being written and is available in the fastboot git tree on kernel.org. This will likely be mainlined, and should supercede this work. However, this tool has worked for me.
This is really quite simple. The "system" consists of a patch which adds printks to fork, exec and exit, and a script which parses those printks and prints information about the reported processes.
Here is the patch: Media: tims_process_trace.patch
This patch was written against Linux kernel version 2.6.27.
To use this patch, apply it to your kernel, with something like:
cd linux_src ; patch -p1 </path/to/patch/tims_process_trace.patch
You should also increase the size of your kernel log buffer (this is the buffer where printk messages are stored in the kernel.) I recommend a value of 18, which is 256K. This is CONFIG_lOG_BUF_SHIFT, and is found in the "General Setup" menu of the kernel configuration system.
Compile, build and install your kernel. Boot the kernel.
After booting, use dmesg to collect the messages. Note that you need to specify the (increased) size of the message buffer with the '-s' option:
dmesg -s 256000 >/tmp/bootlog.txt
Now, process the bootlog with the scripts/procgraph program.
This script is somewhat badly named. It does not generate a graph, but just allows you to sort the processes by various attributes (start time, duration, idle time, etc.) Actual graphing should be added "real soon now".