Timing the boot process The default kernel setup will take about 5 seconds to boot and get into userspace. For some people, this may be too long. For others, they may be concerned about how long before they can start executing in different aspects of the kernel. General Tips Make sure you set the u-boot bootdelay variable to 0 seconds Disable all the kernel features you do not need Disable console output while booting (see the silent booting page for more information) Turn off printk all together if possible Delay some of the less critical features to loadable modules Set the lpj= on the bootargs prompt. This will set loops per jiffy, and reduce boot time by up to 250ms. use non-compressed kernel image, with a separate filesystem Optimize kernel for size (use Os, not O2) Have a peek at: http://www.linuxinsight.com/files/ols2004/bird-reprint.pdf on how to boot in 500ms or less. elinux wiki: Boot Time Have a look here: Fast Boot Example this describes how to boot Linux form Processor Reset into user space form in less than 1 Second Testing Boot Timing Selecting this option causes timing information to be included in printk output. This allows you to measure the interval between kernel operations, including bootup operations. This is useful for identifying long delays in kernel startup. Linux Kernel Configuration Kernel hacking --->[*] Show timing information on printks If you compile the following code into your kernel, you can get an idea of when kernel code may be executed at different parts of the boot up process. You could also insert a 'cat /proc/uptime' into the /etc/rc file so you know how long it took to start executing in userspace. What this snippet does is insert a line into the kernel buffer indicating how long it took to reach each kernel init level. For more info, please see the example module page. #include #include #include #include #include #define stamp_it(x) \ static int __init check_time_ ## x (void) { \ struct timespec uptime; \ do_posix_clock_monotonic_gettime(&uptime); \ printk("%-20s:TIMESTAMP: %lu.%02lu seconds\n", __FUNCTION__, \ (unsigned long) uptime.tv_sec, \ (uptime.tv_nsec / (NSEC_PER_SEC / 100))); \ return 0; \ } \ x ## _initcall(check_time_ ## x); stamp_it(core) stamp_it(postcore) stamp_it(arch) stamp_it(subsys) stamp_it(fs) stamp_it(device) stamp_it(late) The default build for the BF537 STAMP will look something like: check_time_core :TIMESTAMP: 0.12 seconds check_time_postcore :TIMESTAMP: 0.13 seconds check_time_arch :TIMESTAMP: 0.13 seconds check_time_subsys :TIMESTAMP: 0.14 seconds check_time_fs :TIMESTAMP: 0.15 seconds check_time_device :TIMESTAMP: 0.15 seconds check_time_late :TIMESTAMP: 1.02 seconds userspace cat /proc/uptime: 4.48 seconds Note that this is timing from the start of executing the kernel. In other words, this does not include the time spent in u-boot which may vary drastically depending on where the kernel/rootfilesystem is located (tftp/flash/etc…) and which is compressed. Kernel Size using -Os versus -O2 Linux Kernel Configuration General setup --->[ ] Optimize for size(Look out for broken compilers!) -O2: michael@mhenneri-D02:~/uclinux-dist-trunk/linux-2.6.x> size vmlinux */built-in.o text data bss dec hex filename 945581 79976 45880 1071437 10594d vmlinux 34148 862 1076 36086 8cf6 block/built-in.o 152284 6072 3748 162104 27938 drivers/built-in.o 248036 2488 1940 252464 3da30 fs/built-in.o 17440 2509 1128 21077 5255 init/built-in.o 15828 560 108 16496 4070 ipc/built-in.o 177984 23984 30196 232164 38ae4 kernel/built-in.o 22732 12 16 22760 58e8 lib/built-in.o 73696 3680 560 77936 13070 mm/built-in.o 126928 4284 1428 132640 20620 net/built-in.o 1544 4 4 1552 610 security/built-in.o 133 0 0 133 85 usr/built-in.o -Os: michael@mhenneri-D02:~/uclinux-dist-trunk/linux-2.6.x> size vmlinux */built-in.o text data bss dec hex filename 872778 83556 45880 1002214 f4ae6 vmlinux 32156 862 1076 34094 852e block/built-in.o 140964 6072 3748 150784 24d00 drivers/built-in.o 228580 2488 1940 233008 38e30 fs/built-in.o 16160 2509 1128 19797 4d55 init/built-in.o 14456 560 108 15124 3b14 ipc/built-in.o 165596 23984 30196 219776 35a80 kernel/built-in.o 20760 12 16 20788 5134 lib/built-in.o 68156 3680 560 72396 11acc mm/built-in.o 116176 4284 1428 121888 1dc20 net/built-in.o 1420 4 4 1428 594 security/built-in.o 134 0 0 134 86 usr/built-in.o Conclusion There is a 7% difference between compiling the kernel with Os versus the default O2. If size is your major concern, you should take this option into consideration. However the overall boot-time doesn't decrease and stays almost the same, due to less code optimizations which will slow down the boot-process.