public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Darren Hart <dvhart@linux.intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scripts/ksize: Add kernel build size report
Date: Sat, 8 Nov 2014 19:26:30 -0800	[thread overview]
Message-ID: <20141109032630.GB1026@thin> (raw)
In-Reply-To: <eda7fd84192e80829af62db0a6debe6f1987f98b.1415488698.git.dvhart@linux.intel.com>

On Sat, Nov 08, 2014 at 03:18:18PM -0800, Darren Hart wrote:
> ksize generates hierarchical build size reports from vmlinux, *.o, and
> built-in.o files.
> 
> ksize is useful in preparing minimal configurations and comparing
> similar configurations across kernel versions.
> 
> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> Cc: Josh Triplett <josh@joshtriplett.org>

One comment below; with that addressed:
Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> +def main(argv):
> +    try:
> +        opts, args = getopt.getopt(argv[1:], "dh", ["help"])
> +    except getopt.GetoptError, err:
> +        print '%s' % str(err)
> +        usage()
> +        return 2
> +
> +    driver_detail = False
> +    for o, a in opts:
> +        if o == '-d':
> +            driver_detail = True
> +        elif o in ('-h', '--help'):
> +            usage()
> +            return 0
> +        else:
> +            assert False, "unhandled option"
> +
> +    cols = term_width()
> +
> +    # Determine kernel version
> +    p = Popen("strings vmlinux | grep 'Linux version' | cut -d ' ' -f 3",
> +              shell=True, stdout=PIPE, stderr=PIPE)
> +    version = p.communicate()[0].strip()

This seems like a very fragile, Perl-y way to obtain the kernel version.

I'd suggest either not including the version (just as bloat-o-meter
doesn't), or parsing it out using objdump -h -t and file offsetting
(looking for the offset and size of linux_banner).  Personally I'd go
with the former.

- Josh Triplett

  reply	other threads:[~2014-11-09  3:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-08 23:18 [PATCH] scripts/ksize: Add kernel build size report Darren Hart
2014-11-09  3:26 ` Josh Triplett [this message]
2014-11-09  5:00   ` Darren Hart

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=20141109032630.GB1026@thin \
    --to=josh@joshtriplett.org \
    --cc=dvhart@linux.intel.com \
    --cc=linux-kernel@vger.kernel.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