8

I'm looking at a rather old Linux (v2.4) that has custom device drivers built into the kernel. Now I wonder since when that was done. I suppose it most be an old technique, was this the way device drivers were added to Linux already in version 1?

0

2 Answers 2

14

Kernel modules have been available since version 1.1.85 in January 1995 (see the introduction of README.modules in the 1.1.85 patch). At first, few drivers were actually available as modules, but within a few years everything that made sense as a module was available as a module.

When developing a new driver for the kernel, it’s easier to work on it as a module than a built-in driver: instead of rebooting when you make changes to the driver, you can unload the old module and load the new one in its place. In most cases though drivers are made available in both forms (built-in and in a module) before release, assuming they’re part of the main kernel source code. Drivers which are provided outside the main kernel source code can really only be made available as modules, unless the kernel itself is forked (which does happen).

2
  • If I recall correctly modules also made the kernel blob smaller which was important at one point. Nov 24, 2022 at 8:06
  • @Thorbjørn yes, that’s one of the advantages given in the “Module HOWTO”: “LKMs can save you memory, because you have to have them loaded only when you're actually using them. All parts of the base kernel stay loaded all the time. And in real storage, not just virtual storage.” Not only is the initial kernel blob smaller, but modules can be unloaded when they’re no longer necessary, which was important in small systems (e.g. for a removable hard drive: you could unload the FAT, USB etc. modules when the drive was unplugged). Nov 24, 2022 at 8:27
2

Before common use of initrd on hard disks, you compiled all drivers needed at boot time into the kernel. Initrd is quite old now, but use of it on hard disks is reasonably new.

8
  • Citation needed... Initrd has been used on hard disks for a very long time, e.g. in Debian since at least 2002. You’re right about compiling drivers necessary to boot the system into the kernel. Jul 26, 2017 at 21:09
  • @StephenKitt: Red Hat sure didn't and I've got the OS install intact to prove it (pre-internet computer). Slackware didn't either.
    – Joshua
    Jul 26, 2017 at 21:51
  • 2
    Red Hat Linux 3.9 introduced modules instead of monolithic kernels in 1996. That’s not “reasonably new” in my book (at least, not as far as Linux history goes!). Jul 26, 2017 at 22:18
  • 1
    Regarding initrd, I believe that was a new feature introduced in the 1.3.x line (circa 1997 I guess). It certainly wasn't used in my 1.2.13 based system in 1996, but when I upgraded to 2.0 I'm pretty sure the new system used it.
    – Jules
    Jul 28, 2017 at 19:53
  • 1
    @StephenKitt definitely my first few Linux systems didn't use an initrd... if you were using a stock kernel you used the "IDE kernel" if your / was on an IDE disk or the "SCSI kernel" if it was on SCSI, the root fs was mounted directly, and the first process the kernel ran was the real init. IIRC the substantial changeover happened around the same time as 2.6 and udev. It was available before then, no doubt, but it wasn't the obvious or common thing.
    – hobbs
    Aug 4, 2017 at 5:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .