improve boot time on cd
Originally created by Tails on #6109 (Redmine)
When amnesia is booted from a CD, there is a lot of seeks from one file to another during boot. This could be improved by ordering files on the CD in the order used during boot and reading them in the same order before those files need to be used.
Usage
See release process.
How to test
Further testings can be helped by using the bootchart
package that has
been adapted from Ubuntu:
i386,
amd64,
.dsc,
.tar.gz. Once the binary
package has been copied to config/chroot_local-packages
, at the end of
normal boot (without profile
specified), a tarball will be left in
/var/log/bootchart
, ready to be read with bootchart-java
or
pybootchartgui
.
Implementation
Two scripts have been added to the live-bottom
stage of the
initramfs
.
-
00boot_profile
When
profile
appears on the kernel command line, it starts theboot-profile
program. It will also add a new autostart entry to the user home directory in order to launch/usr/local/bin/end-profile
. -
00readahead
When
profile
does not appear on the kernel command line:-
all files listed in
/usr/share/amnesia/readahead-list
are first stat()’ed, -
files until
/usr/bin/Xorg
are read, -
the rest of the files are read in background.
-
The boot-profile
daemon uses inotify
to record file that are
accessed during boot. It writes its pid in /boot-profile.pid
. When
killed, it dumps the sort list at the path specified as its first
command line argument.
The end-profile
script will wait and start iceweasel before
automatically killing the boot-profile
daemon.
The file list /usr/share/amnesia/readahead-list
used by 00readahead
is generated by scripts/config
(called by lb config
).
Further
ureadahead
Ubuntu has implemented some kind of automatic read-ahead thing in
Karmic, using their home-made ureadahead
package. Their implementation
is probably worth having a look, as it may help automatically generating
the files order at build time (run first build’s result in a VM, then
rebuild using measurements done in this test boot).