I have found a way that could speed up the boot time. It was a finding that came out of a trial that had nothing to do with trying to speed up the boot time. On the contrary I would expect the boot time to increase instead of decrease.
The trial was about trying to separate the kernel modules from the root file system in order to be able to use an unmodified tinycore.gz with different kernels. As you probably know tinycore.gz contains a set of standard kernel modules built for use with the standard TC kernel. When using a custom built kernel you have to provide the same set of modules but built for use with the custom kernel instead. This is how i did it:
- I built the custom kernel and packaged the modules that corresponds to the the modules for the standard kernel built into tinycore.gz into a tar.gz file (lets call it rootfs-modules-mykernel.tar.gz)
- I created a minimal rootfs with no modules in it, busybox + a few other programs and packaged it into a file called tcboot.gz
- The init script in tcboot.gz does
- Finds out the the boot device. This is done by looking at the available partitions for a file called tcboot.gz
- Create a tmpfs and extract the tinycore.gz located at the same device as tcboot.gz into the newly created tmpfs.
- Copy a script file that replaces /etc/init.d/rcS in the tmpfs. The script will load the rootfs-modules-mykernel.tar.gz do a depmod and then call /etc/init.d/tc-config.
- Perform a switch_root to the tmpfs
[/list]
In spite of all the extra work, e.g., loading two root file systems, loading the rootfs modules for the custom kernel, the total startup time is about 5 seconds shorter than booting the corresponding standard TC system. The test was made booting from a USB stick.
Why? The explanation, as far as I can see lies in that it is much faster to read data from a disk in a running kernel compared to when the boot loader loads the rootfs into the initramfs during boot.
It seems like a long way to go to save 5 seconds, but as said I was not trying to find a solution to decrease the startup time, but this came as a nice surprise to me. For others that hunts startup seconds I just wanted to point out the potential.
Something I have not tried but could be interesting for some, could be to build a "big" rootfs with all their extensions installed into the rootfs. Using the above method might show significant increase in boot time. I am not advocating this but just pointing out that for some, the ones that always boot up with and installs the same set of extensions, might end up with shorter boot times.
/Lars