Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 May 2003 23:57:30 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        scott_long@btc.adaptec.com
Cc:        des@ofug.org
Subject:   Re: cvs commit: src/release/alpha dokern.sh drivers.conf
Message-ID:  <20030517.235730.97368061.imp@bsdimp.com>
In-Reply-To: <3EC71BA3.4020908@btc.adaptec.com>
References:  <20030518005055.GG12759@sunbay.com> <20030517.231551.107143172.imp@bsdimp.com> <3EC71BA3.4020908@btc.adaptec.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <3EC71BA3.4020908@btc.adaptec.com>
            Scott Long <scott_long@btc.adaptec.com> writes:
: M. Warner Losh wrote:
: > In message: <20030518005055.GG12759@sunbay.com>
: >             Ruslan Ermilov <ru@FreeBSD.org> writes:
: > : It'd be even more advantageous to gzip(1) all the .ko files,
: > : and have sysinstall(8) unpack them.
: > 
: > Timing Solutions has been running with gzip'd .ko files since about
: > FreeBSD 4.1 or so without ill effect (module one bug that jdp fixed
: > about the same time we noticed it in the 4.2ish time frame).  kldload
: > doesn't work with .gz'd files, but the boot loader does :-)
: > 
: > Warner
: 
: Does TSI have any patches to donate?  What about sysinstall?

TSC (not TSI :-) didn't need to patch anything to make it happen.  We
don't use sysinstall to build our embedded systems.  It would be
better to hack kldload(8) to deal with .gz files.  However, since
kldload(8) doesn't know what file it is loading (unless it starts with
a '/' and has a . in it) it would be hard to patch it generically.  It
would be easy to patch it to to handle that one exception case.

However, sysinstall goes directly to the iron using kldload(2).  It
might be interesting to add gzip support to the kernel loading
process, but I'm not up for it for 5.1-RELEASE :-)

Here's a gross patch to sysinstall that gunzips .ko.gz files to
/tmp/blah.ko, kldloads it, then unlinks it.  Likely needs to be
cleaned up to use the same #defines (esp for /tmp), error checking on
system, etc.  I don't plan on committing it, but I did take the time
to find where the code needed to go so I thought I'd post the patch
(which i just hand edited, so you might need to apply it by hand).
Maybe we should kill the desc file stuff too while we're in the
neighborhood.

Warner

Index: modules.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sysinstall/modules.c,v
retrieving revision 1.6
diff -u -r1.6 modules.c
--- modules.c	15 Jan 2003 21:47:36 -0000	1.6
+++ modules.c	18 May 2003 05:54:36 -0000
@@ -92,6 +92,16 @@
 			msgConfirm("Loading module %s failed", dp->d_name);
 		}
 	    }
+	    if (strcmp(dp->d_name + dp->d_namlen - (sizeof(".ko.gz") - 1), ".ko.gz") == 0) {
+		snprintf(module, sizeof(module), "/tmp/%s", dp->d_name);
+		module[strlen(module) - sizeof(".gz")] = '\0';
+		snprintf(desc, sizeof(desc), "zcat < %s/%s > %s", MODULESDIR,
+		  dp->d_name, module);
+		system(desc);
+		if (kldload(module) < 0 && errno != EEXIST)
+		    msgConfirm("Loading module %s failed", dp->d_name);
+		unlink(module);
+	    }
 	}
 	closedir(dirp);
     }


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