[haiku-development] Re: r1a3 anyboot image too big for CD

  • From: "Ingo Weinhold" <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 25 May 2011 14:55:55 +0200

On Tue, 24 May 2011 09:55:42 -0700 Urias McCullough <umccullough@xxxxxxxxx> 
wrote:
> On Tue, May 24, 2011 at 9:28 AM, Matt Madia <mattmadia@xxxxxxxxx> wrote:
> > The ISO cd images, are still under 700MiB though ... But if a "with
> > sources"'disc is made, it'll most likely be above 700MiB
> 
> I think it's time to seriously consider offering the "sources" as a
> separate CD upon request and/or as a downloadable package.
> 
> I believe our infrastructure is solid enough that we can ensure these
> are kept for the obligatory period of time that GPL/LGPL requires.

Agreed.

> As for the image sizes - they're only likely going to get larger
> unless we start finding ways to cut the fat.

Once package management is in, we'll save quite a bit of space due to the fact 
that pretty much all software will be compressed.

> One option is to support "compressed packages" on the anyboot images
> just like we do on ISO.

That would make it less "live", though.

> Another option is to find a way to compress
> the entire BFS image using something like SquashFS...

That would become useless as soon as we as we have package management. So I 
don't think it would be a good time investment to get that supported.

> Also, I'm not sure if our optional packages contain stripped binaries
> or not - but that might be a way to save some significant space as
> well.

Most optional packages are built with debug info included. I'm a bit undecided 
on the matter, as those builds do provide nicer stack traces. OTOH I don't 
recall when I last found a stack trace of an optional package of interest 
anyway.

As a temporary solution for the alpha branch I attached a patch that strips 
debug info from optional packages files in common/bin and common/lib. 
Furthermore it sets the BFS block size of the image to 1 KB. I only tested with 
a slightly modified gcc 4 only alpha-like image. The block size change saves 
32.5 MB, the stripping additional 19 MB.

Regarding Adrien's mail on the same topic: I don't think Perl can be removed. 
There are other packages depending on it. WonderBrush OTOH can be removed, 
saving about 6 MB.

CU, Ingo
Index: build/scripts/build_haiku_image
===================================================================
--- build/scripts/build_haiku_image     (revision 41666)
+++ build/scripts/build_haiku_image     (working copy)
@@ -141,6 +141,20 @@
 fi
 
 
+stripDebugInfo()
+{
+       file="$1"
+
+       # Determine whether the file is an ELF file by checking the ELF 
signature,
+       # or at least the printable characters.
+       elfMarker=`dd "if=$file" bs=1 skip=1 count=3 2> /dev/null`
+       if [ "$elfMarker" = 'ELF' ]; then
+               # make user-writable first -- some files aren't
+               chmod u+w "$file"
+               strip --strip-debug "$file"
+       fi
+}
+
 extractFile()
 {
        # extractFile <archive> <directory>
@@ -173,6 +187,22 @@
                rm $extractDir/.OptionalPackageDescription
        fi
 
+       # strip executables in common/bin
+       if [ -d $extractDir/common/bin ]; then
+               for file in `find $extractDir/common/bin -type f -a -executable 
\
+                               -a -size +1k`; do
+                       stripDebugInfo "$file"
+               done
+       fi
+
+       # strip libraries in common/lib
+       if [ -d $extractDir/common/lib ]; then
+               for file in `find $extractDir/common/lib -type f -a -size +1k \
+                               -a -name lib\*`; do
+                       stripDebugInfo "$file"
+               done
+       fi
+
        $cp -r "${sPrefix}$extractDir/$extractedSubDir/." 
"${tPrefix}$targetExtractedDir"
 
        $rmAttrs -rf "$extractDir"
@@ -216,7 +246,7 @@
                fi
 
                $bfsShell --initialize $imageOffsetFlags "$imagePath" \
-                       "$imageLabel" "block_size 2048"
+                       "$imageLabel" "block_size 1024"
                $makebootable $imageOffsetFlags "$imagePath"
        fi
 

Other related posts: