From 647bef8ca692b436020948dd90de165996443b6d Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 14 Sep 2010 10:48:06 +0200 Subject: [PATCH] base/init: set RDTIMESTAMP set $RDTIMESTAMP for init, if rd.timestamp is specified on the kernel command line, so that systemd can print out: "systemd: Boot finished after 15s = 3s (kernel) + 2s (initrd) + 10s (userspace)" --- dracut.kernel.7.xml | 8 ++++++++ modules.d/99base/init | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dracut.kernel.7.xml b/dracut.kernel.7.xml index 07fdce2c..0dc1ce8c 100644 --- a/dracut.kernel.7.xml +++ b/dracut.kernel.7.xml @@ -164,6 +164,14 @@ This parameter can be specified multiple times. set udev to loglevel debug + + + rd.timestamp + + + export RDTIMESTAMP environment variable to init, which is set to the uptime of the dracut start. + + diff --git a/modules.d/99base/init b/modules.d/99base/init index bff390d6..010e329b 100755 --- a/modules.d/99base/init +++ b/modules.d/99base/init @@ -77,6 +77,9 @@ mknod -m 0666 /dev/null c 1 3 mount -t proc /proc /proc >/dev/null 2>&1 mount -t sysfs /sys /sys >/dev/null 2>&1 +read RDTIMESTAMP _tmp < /proc/uptime +unset _tmp + if [ ! -c /dev/ptmx ]; then # try to mount devtmpfs if ! mount -t devtmpfs -omode=0755 udev /dev >/dev/null 2>&1; then @@ -305,6 +308,7 @@ else ;; esac done + initargs="$initargs" fi # Debug: Copy state @@ -313,6 +317,12 @@ if getarg rdcopystate; then cp /tmp/* /dev/.initramfs/ >/dev/null 2>&1 fi +if getarg rd.timestamp; then + export RDTIMESTAMP +else + unset RDTIMESTAMP +fi + info "Switching root" wait_for_loginit @@ -320,7 +330,6 @@ wait_for_loginit umask $OLD_UMASK unset HOME unset TERM - exec switch_root "$NEWROOT" "$INIT" $initargs || { echo "Something went very badly wrong in the initramfs. Please " echo "file a bug against dracut."