[arch-projects] [PATCH 2/2 mkinitcpio] RD_TIMESTAMP: export timestamp to init
Tom Gundersen
teg at jklm.no
Mon Aug 1 15:53:50 EDT 2011
This follows the same protocol as between dracut and systemd.
With this patch allows us to do some basic profiling of our
initrd:
% systemd-analyze
Startup finished in 710ms (kernel) + 2445ms (initrd) + 21214ms (userspace) = 24370ms
To get the timestamp as accurate as possible, a few things are shuffled
around to do the measurement as early in init as we can.
A patch to systemd is also required, which I will submit if this is accepted.
Signed-off-by: Tom Gundersen <teg at jklm.no>
---
init | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/init b/init
index 8c8709c..9bcc21a 100644
--- a/init
+++ b/init
@@ -4,10 +4,12 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
busybox --install -s
+mount -t proc proc /proc -o nosuid,noexec,nodev
+
+RD_TIMESTAMP=$(/bin/cat /proc/uptime)
+
. /init_functions
-mkdir -p /new_root
-mount -t proc proc /proc -o nosuid,noexec,nodev
mount -t sysfs sys /sys -o nosuid,noexec,nodev
if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
@@ -80,6 +82,7 @@ if [ "${break}" = "y" ]; then
fi
# Mount root at /new_root
+mkdir -p /new_root
${mount_handler:-default_mount_handler} /new_root
init=${init:-/sbin/init}
@@ -113,6 +116,7 @@ for d in proc sys dev run; do
umount /${d}
fi
done
-exec env -i TERM=$TERM /sbin/switch_root -c /dev/console /new_root ${init} "$@"
+
+exec env -i TERM="$TERM" RD_TIMESTAMP="$RD_TIMESTAMP" /sbin/switch_root -c /dev/console /new_root ${init} "$@"
# vim: set ft=sh ts=4 sw=4 et:
--
1.7.6
More information about the arch-projects
mailing list