Hi, after a very long delay, I finally committed your two stripping
patches, with a few changes (especially to make sure that the same
*-stripped.so doesn't get picked up again and re-stripped).


--
Nadav Har'El
[email protected]

On Mon, May 23, 2016 at 11:09 PM, Yuri Volchkov <[email protected]>
wrote:

> Before this patch, mkbootfs.py, unlike upload_manifest.py, did not do
> stripping. This was leading to unnecessary inflating of the bootfs.
>
> For image=rogue I've got following results
> 1) zfs image reduced by 1.4M
> 2) ramfs image reduced by 30K
>
> Fixes #667.
>
> Signed-off-by: Yuri Volchkov <[email protected]>
> ---
>  scripts/mkbootfs.py | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/mkbootfs.py b/scripts/mkbootfs.py
> index b92e898..c49e1be 100755
> --- a/scripts/mkbootfs.py
> +++ b/scripts/mkbootfs.py
> @@ -1,6 +1,6 @@
>  #!/usr/bin/python
>
> -import os, struct, optparse, io
> +import os, struct, optparse, io, subprocess
>  try:
>      import configparser
>  except ImportError:
> @@ -52,6 +52,24 @@ def read_manifest(fn):
>                    for f in manifest.options('manifest')])
>      return files
>
> +def strip_file(filename):
> +    stripped_filename = filename
> +
> +    def is_our(filename):
> +        cwd = os.getcwd()
> +        moddir = os.path.abspath(os.path.join(cwd, "../../modules"))
> +        return   filename[0] != "/" or \
> +                 filename.startswith(cwd) or \
> +                 filename.startswith(moddir)
> +
> +    if filename.endswith(".so") and is_our(filename):
> +        stripped_filename = filename[:-3] + "-stripped.so"
> +        if not os.path.exists(stripped_filename) \
> +           or (os.path.getmtime(stripped_filename) < \
> +               os.path.getmtime(filename)):
> +            subprocess.call(["strip", "-o", stripped_filename, filename])
> +    return stripped_filename
> +
>  def main():
>      make_option = optparse.make_option
>
> @@ -90,6 +108,7 @@ def main():
>      files = read_manifest(options.manifest)
>      files = list(expand(files.items()))
>      files = [(x, unsymlink(y)) for (x, y) in files]
> +    files = [(x, strip_file(y)) for (x, y) in files]
>
>      pos = (len(files) + 1) * metadata_size
>
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups
> "OSv Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to