matrix-rootfs: add the --no-strip option
authorDaniel Bainton <daniel.bainton@movial.fi>
Thu, 12 Mar 2009 11:43:54 +0000 (13:43 +0200)
committerDaniel Bainton <daniel.bainton@movial.fi>
Thu, 12 Mar 2009 11:43:54 +0000 (13:43 +0200)
matrix/rootfs.py

index 4d36ac8..82b157c 100644 (file)
@@ -1,7 +1,8 @@
-# Copyright (C) 2007-2008 Movial Creative Technologies Inc.
+# Copyright (C) 2007-2009 Movial Creative Technologies Inc.
 # Authors: Kalle Vahlman <kalle.vahlman@movial.fi>
 #          Timo Savola <tsavola@movial.fi>
 #          Tuomas Kulve <tuomas.kulve@movial.fi>
+#          Daniel Bainton <daniel.bainton@movial.fi>
 
 import errno
 import optparse
@@ -41,6 +42,11 @@ def main():
                dest='clean', action='store_false', default=True)
 
        parser.add_option(
+               '-s', '--no-strip',
+               help='do not strip the binaries',
+               dest='no_strip', action='store_true', default=False)
+
+       parser.add_option(
                '-i', '--image-only',
                help='generate only a filesystem image',
                dest='image_only', action='store_true')
@@ -95,6 +101,8 @@ def main():
        build.set_ubifs_min_io_size(config.boards[config.board].ubifs_min_io_size)
        build.set_ubinize_config_vol_size(config.boards[config.board].ubinize_config_vol_size)
 
+       build.set_no_strip(opts.no_strip)
+
        if opts.rootfs_only:
                build.generate(opts.clean, build_target="rootfs")
        elif opts.image_only:
@@ -140,7 +148,9 @@ class Builder(object):
        ubinize_config_vol_name = "rootfs"
        ubinize_config_vol_aligment = 1
        ubinize_config_vol_flags = "autoresize"
-       
+
+       # Do we strip the binaries? - False strips, True doesn't
+       no_strip = False
 
        file_list = []
        remove_list = []
@@ -248,6 +258,9 @@ class Builder(object):
                if size is not None:
                        self.ubinize_config_vol_size = size
 
+       def set_no_strip(self, no_strip):
+               self.no_strip = no_strip
+
        def generate(self, clean, build_target="all"):
                copy_list = self.file_list
 
@@ -300,7 +313,7 @@ class Builder(object):
                        else:
                                try:
                                        shutil.copy(f, path)
-                                       if not f.endswith(".ko"):
+                                       if not f.endswith(".ko") and not self.no_strip:
                                                os.system(self.strip + " " + os.path.join(path,os.path.basename(f)) + " &> /dev/null")
                                except IOError, e:
                                        # We allow nonexistent files since only place where we'll get those