Message info From:Tom Gundersen Subject:[arch-projects] [mkinitcpio][PATCH] init: add timestamp at start of initramfs if binary exists Date:Sun, 6 May 2012 16:54:51 +0200

This will allow us to tell how much time was spent in the initramfs,
which might be good for working on optimizations and making sure we
don't regress.

If a binary able to produce the timestamp is not installed this is a

I'll post separately an install hook to the systemd package that will
install systemd-timestamp as /usr/bin/timestamp. However, it would be
trivial to replace this by an independent implementation if people
want to use this without systemd.

With this patch I get the following on my (ancient) laptop:

$ systemd-analyze
Startup finished in 294ms (kernel) + 2684ms (initramfs) + 15741ms (userspace) = 18720ms

FWIW, 1 second is spent on inserting the needed modules, and 1.5 seconds
on mounting the rootfs (mounting btrfs is slow!).

Signed-off-by: Tom Gundersen <>
init | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/init b/init
index 8e9ad90..98328ce 100644
--- a/init
+++ b/init
@@ -1,6 +1,10 @@

+if [ -x /usr/bin/timestamp ]; then
+ RD_TIMESTAMP=$(/usr/bin/timestamp)
. /init_functions

mount -t proc proc /proc -o nosuid,noexec,nodev
@@ -109,6 +113,6 @@ if [ "${udevd_running}" -eq 1 ]; then
udevadm info --cleanup-db

-exec env -i "TERM=$TERM" /sbin/switch_root /new_root $init "$@"
+exec env -i "TERM=$TERM" "RD_TIMESTAMP=$RD_TIMESTAMP" /sbin/switch_root /new_root $init "$@"

# vim: set ft=sh ts=4 sw=4 et: