Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 May 2003 17:49:30 -0400 (EDT)
From:      Garrett Wollman <wollman@lcs.mit.edu>
To:        Ruslan Ermilov <ru@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/release/alpha dokern.sh drivers.conf
Message-ID:  <200305192149.h4JLnUrt075384@khavrinen.lcs.mit.edu>
In-Reply-To: <20030518005055.GG12759@sunbay.com>
References:  <200305171158.h4HBwSUP054361@repoman.freebsd.org> <20030517125948.GC52158@sunbay.com> <20030517140630.GA60602@sunbay.com> <xzpsmrdlk1m.fsf@flood.ping.uio.no> <20030518005055.GG12759@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Sun, 18 May 2003 03:50:55 +0300, Ruslan Ermilov <ru@FreeBSD.org> said:

> It'd be even more advantageous to gzip(1) all the .ko files,
> and have sysinstall(8) unpack them.

Even better would be to simply link them all together.  The overhead
for symbol tables and dynamic linking information appears to be about
24%, and much of that can be shared.  Here is a simple science
experiment:

Build a complete set of modules.
$ ld -Bshareable -d -warn-common -o foo.ko `find modules -name '*.kld'`
$ objcopy --strip-debug foo.ko foo-nodebug.ko
$ ls -l foo-nodebug.ko 
-rw-r--r--  1 wollman  wheel  9005614 May 19 17:31 foo-nodebug.ko

OK, so this still won't fit on a floppy.  Let's try this instead:

$ awk '/^#/ { next; } NF > 2 {print "modules/usr/src/sys/modules/"$2"/"$2".kld"}' /usr/src/release/i386/drivers.conf > kld-list
$ ld -Bshareable -d -warn-common -o foo.ko `while read kld; do if [ -e $kld ]; then echo $kld; else echo $kld | sed -e 's,s/if_,s/,' -e 's,/miibus/,/mii/,' -e 's,/\(sysv...\)/,/sysvipc/\1/,' -e 's,/firewire/,/firewire/firewire/,' -e 's,/sbp/,/firewire/sbp/,' -e 's,/fwe/,/firewire/fwe/,'; fi; done < kld-list`
$ objcopy --strip-debug foo.ko foo-nodebug.ko
$ ls -l foo-nodebug.ko 
-rw-r--r--  1 wollman  wheel  1834728 May 19 17:44 foo-nodebug.ko

Well, that right there is almost enough to fit all the drivers on a
single floppy again.  If we can gzip it, we're more than there:

-rw-r--r--  1 wollman  wheel  677731 May 19 17:47 foo-nodebug.ko.gz

Let's try just the stuff from floppy 2:

-rw-r--r--  1 wollman  wheel  732717 May 19 17:47 foo-nodebug.ko

...which gzips down to:

-rw-r--r--  1 wollman  wheel  257111 May 19 17:47 foo-nodebug.ko.gz

-GAWollman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305192149.h4JLnUrt075384>