mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: [PATCH] add option --printsize
Date: Mon, 21 May 2012 16:37:06 +0800	[thread overview]
Message-ID: <20120521083706.GA3040@localhost.localdomain> (raw)

Add --printsize for measuring module installed size to initramfs

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 dracut.sh |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- dracut.orig/dracut.sh	2012-05-21 16:32:17.980074395 +0800
+++ dracut/dracut.sh	2012-05-21 16:32:57.450074527 +0800
@@ -123,6 +123,7 @@ Creates initial ramdisk images for prelo
   -M, --show-modules    Print included module's name to standard output during
                          build.
   --keep                Keep the temporary initramfs for debugging purposes
+  --printsize           Print out the module install size
   --sshkey [SSHKEY]     Add ssh key to initramfs (use with ssh-client module)
 
 If [LIST] has multiple arguments, then you have to put these in quotes.
@@ -268,6 +269,7 @@ while (($# > 0)); do
                        show_modules_l="yes"
                        ;;
         --keep)        keep="yes";;
+        --printsize)   printsize="yes";;
         -*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
         *)
             if ! [[ ${outfile+x} ]]; then
@@ -700,6 +702,7 @@ mods_to_load=""
 for_each_module_dir check_module
 for_each_module_dir check_mount
 
+_isize=0 #initramfs size
 modules_loaded=" "
 # source our modules.
 for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
@@ -717,6 +720,14 @@ for moddir in "$dracutbasedir/modules.d"
         fi
         mods_to_load=${mods_to_load// $_d_mod /}
         modules_loaded+="$_d_mod "
+
+        #print the module install size
+        if [ -n "$printsize" ]; then
+            _isize_new=$(du -sk ${initdir}|cut -f1)
+            _isize_delta=$(($_isize_new - $_isize))
+            echo "$_d_mod install size: ${_isize_delta}k"
+            _isize=$_isize_new
+        fi
     fi
 done
 unset moddir

             reply	other threads:[~2012-05-21  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21  8:37 Dave Young [this message]
     [not found] ` <20120521083706.GA3040-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2012-05-21  8:43   ` [PATCH] add option --printsize Cong Wang
     [not found]     ` <4FBA003D.50103-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-21  8:50       ` Harald Hoyer
     [not found]         ` <4FBA01ED.2000001-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-05-21  8:57           ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120521083706.GA3040@localhost.localdomain \
    --to=dyoung-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox