cvs commit: src/release/alpha dokern.sh drivers.conf

Garrett Wollman wollman at lcs.mit.edu
Mon May 19 14:49:33 PDT 2003


<<On Sun, 18 May 2003 03:50:55 +0300, Ruslan Ermilov <ru at 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



More information about the cvs-all mailing list