From 067bfe2aa8b63b9b3ceb584b7895dc6687e3d4f1 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Wed, 10 Aug 2011 18:56:11 -0500 Subject: New 'hb objsizes' command Change-Id: I6693c0d70170794f448f29165266732f8e6d2682 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/246 Tested-by: Jenkins Server Reviewed-by: CAMVAN T. NGUYEN --- src/build/tools/hb | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/build/tools/hb') diff --git a/src/build/tools/hb b/src/build/tools/hb index f2cfac8de..cfe345c36 100755 --- a/src/build/tools/hb +++ b/src/build/tools/hb @@ -117,6 +117,16 @@ hb_helptext() echo " in it, while /.../foo/ will create a subdirectory within foo" echo " by the name of your repository's directory name." ;; + objsizes) + echo " Topic 'objsizes'" + echo + echo " Usage:" + echo " hb objsizes" + echo + echo " Reads the ELF header information from all of the hostboot" + echo " modules and generates a CSV output of the sizes of the text" + echo " and data sections of the modules." + ;; customrc) echo " Topic 'customrc'" echo @@ -146,7 +156,7 @@ hb_helptext() echo " hb help [|]" echo echo " Available Commands:" - echo " workon, simsetup, prime, startsimics, rsync" + echo " workon, simsetup, prime, startsimics, rsync, objsizes" echo echo " Additional Help Topics:" echo " customrc" @@ -263,6 +273,23 @@ hb_rsync() fi } +hb_objsizes() +{ + [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1 + + echo "Object,Text Size,Data Size" + + objdump -h ${HOSTBOOTROOT}/img/*.elf ${HOSTBOOTROOT}/img/*.so | \ + grep -e ".elf" -e ".so:" -e ".text " -e ".data " | \ + sed "s/.so:.*/.so/" | \ + sed "s/.elf:.*/.elf/" | \ + sed 's/.*\.text *\([0-9a-f]*\).*/,0x\1/' | \ + sed "s/.*\.data *\([0-9a-f]*\).*/,0x\1/" | \ + sed "N ; N ; s/\n//g" | \ + xargs -n1 perl -e 'printf "%s,%d,%d\n", map { 0 == hex $_ ? $_ : hex $_ } split /\,/,shift;' | \ + sed "s/.*\///" +} + if [ 0 == $# ]; then hb_helptext exit -1 @@ -287,6 +314,9 @@ startsimics) rsync) hb_rsync $* ;; +objsizes) + hb_objsizes $* + ;; *) hb_helptext $* exit -1 -- cgit v1.2.1