From owner-freebsd-hackers Thu Oct 15 23:18:14 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA17934 for freebsd-hackers-outgoing; Thu, 15 Oct 1998 23:18:14 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA17920 for ; Thu, 15 Oct 1998 23:18:08 -0700 (PDT) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.9.1/8.9.1/Spinner) with ESMTP id NAA15779; Fri, 16 Oct 1998 13:49:45 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199810160549.NAA15779@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: Greg Lehey cc: Nicholas Charles Brawn , FreeBSD Hackers Subject: Re: How cam I be writing LKM ? In-reply-to: Your message of "Fri, 16 Oct 1998 13:27:50 +0930." <19981016132750.C468@freebie.lemis.com> Date: Fri, 16 Oct 1998 13:49:45 +0800 From: Peter Wemm Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Greg Lehey wrote: > On Friday, 16 October 1998 at 12:54:32 +1000, Nicholas Charles Brawn wrote: > > On Fri, 16 Oct 1998, Greg Lehey wrote: > > > > [snip] > >> The best thing to understand is: now is a very bad time to write an > >> LKM. They'll be going away and replaced by KLDs when the kernel goes > >> to ELF (in the next few weeks). > > > > This is news to me, however as i don't keep up with -current and -stable > > lists, it's not really a suprise. > > > > Ok, so are KLD's going to be present in 3.0-RELEASE? > > Sort of. Yes. Only just though.. But you have to choose to use them. If you use /boot/loader and compile the kernel for ELF, then you can even preload them. > > Is there going to be better dox available for them than were present > > on lkm's? > > Probably not :-) There will have to be, because the mechanism that drives KLD is also intended to replace the config(8) statically generated tables etc. > > And where can I get some information on them now? > > Peter Wemm seems to be spearheading the effort. We've done some mail > exchange, but I haven't had time to look at it in detail. Maybe I'll > write some documentation on it, but don't hold your breath. > > > Shucks, just when I was getting the hang of writing them too... :\ > > The story is that there's not much difference. Yes, at the moment. kld is a lot more powerful because it honours things like SYSINIT() in loaded files. Indeed, that's how the same source and binaries are used for producing kernels and modules. Look at the src/sys/ modules/* code, and the corresponding src/sys/* code that the module Makefiles build. In particular, DECLARE_MODULE() is what is used to create a visible module. Files contain zero or more modules. Theoretically modules should be self contained and self registering. I'm not so thrilled about the naming, but I used Doug and Mikes code and had to try and make it work together. We've got Doug's terminology. If I'd had (lots) more time, I'd probably have liked to change it a bit so that a kldload "file" was called a module, and what the present kernel code calls a module, I'd have called a "component" or something like that. The build process is pretty weak at the moment, it's more of a proof of concept than meant to be particularly useful. It's likely that a stronger dependency and versioning mechanism will be implemented at some point soon. Mike did a pretty good system but it wasn't integrated with the kernel linker and bus/device code which extensively used Doug's system in the alpha port. I still want to use Mike's design at the module (component) level. This is what my system looks like at the moment: 113# kldstat Id Refs Address Size Name 1 4 0xf0100000 1406d0 kernel 2 1 0xf0241000 486e0 nfs.ko 3 1 0xf028a000 f758 linux.ko 4 1 0xf089a000 a000 ibcs2.ko 114# kldstat -v Id Refs Address Size Name 1 4 0xf0100000 1406d0 kernel Contains modules: Id Name 1 rootbus 3 procfs 4 ufs 5 mfs 6 if_loop 7 ipfw 10 aout 11 elf 12 execinterp 2 1 0xf0241000 486e0 nfs.ko Contains modules: Id Name 2 nfs 3 1 0xf028a000 f758 linux.ko Contains modules: Id Name 8 linuxaout 9 linuxelf 4 1 0xf089a000 a000 ibcs2.ko Contains modules: Id Name 13 ibcs2 This is on an ELF kernel, but I think the a.out kld's will still work. > Greg Cheers, -Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message