D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Kernel boot times - again...

 

Just re-compiled a kernel for my little boxes and enabled printk timings 
to see just where it was spending time...

Intersting.

So - power on until extlinux is loaded: about 5 seconds. It does a memory 
check, printing over a serial port, then waits a few seconds for the hard 
drive to become ready - not strictly needed, but essential to allow the 
Ethernet link to come up if PXE booting...

extlinux loads bzImage, then initrd.gz - time for that is about 15 
seconds.

Then the kernel starts.

It takes 1.08 seconds to get to this point:

[    1.081358] rtc_cmos rtc_cmos: setting system clock to 2000-01-01 00:24:23 UTC 
(946686263)

there's no battery - and this is almost ready to jump into userland, but 
to get userland it has to uncompress the loaded initrd.gz image and mount 
it:

[    1.081358] RAMDISK: gzip image found at block 0
[   13.844280] VFS: Mounted root (ext2 filesystem) readonly on device 1:0.
[   13.844481] Freeing unused kernel memory: 156k freed

So 12.8 seconds to do the uncompression. Gzip is the fastest uncompression 
mechanism too.

The next (and last) thing logged by the kernel is the Ethernet port coming 
online:

[   17.513944] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

It takes a few more seconds until a login prompt appears, but by then it's 
mounted/checked filesystems, set the date/time via ntp, loaded the modules 
I can't compile into the kernel (asterisk telephony crud), started 
dns, http, sendmail and astersk services...

So with custom hardware - a way to get the kernel image into RAM quickly, 
and a kernel optimised exactly for the hardware concerend with the kernel 
launching a custom app rather than a general purpose /sbin/init, root 
filesystem on disk/flash then I can see how it's possible to get a boot 
from cold in 1.5 seconds to something usable. Well done them, I guess!

Wondering also if it's possible to build a system with (say) the bottom 
2MB of memory being Flash RAM directly memory mapped and set to read-only 
with the kernel image sitting inside it, using the rest of RAM for it's 
data structures. Almost a kernel on ROM then with no bootloader required. 
It would execute slower from Flash than RAM, but maybe some clever caching 
could make that faster, who knows!

Gordon

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html