1

My understanding is that the kernel understands how to communicate with the different hardware in a system via specific device trees.

How is it that I can download one version of Ubuntu and I am able to install this on any system where the hardware may vary?

The same goes for the BeagleBone embedded boards. There is a default Debian image which can flash to any of the different type of BeagleBone boards which have different peripherals. How does it know which device tree / device tree overlay to use when the same image works for all?

2

The device drivers (i.e. the part of the kernel that interact directly with the hardware) can be compiled as kernel modules. These are separate files, which can be loaded or unloaded by the kernel, as necessary, depending on the hardware present in the system.

The generic kernels that are shipped with mainstream Linux distributions tend to be supplied with all of the drivers for every conceivable piece of hardware compiled as modules. So, when the kernel boots up on a given system, it probes out and detects what hardware is on the system and then directs the userspace program, udev, to load whatever kernel modules are needed for the specific hardware.

  • Urgh! I forgot to mention udev! +1 – Fabby Jan 17 at 22:03
  • Thanks. I notice with Windows, when we install it, different hardware gets detected and then then the specific drivers for different hardware gets installed for use with Windows. Therefore if for example we swap the hard disk from a HP computer to a Dell computer, it probably won't work due to the wrong drivers installed. With Linux however I guess this is different?? The hardware gets detected and the device drivers get loaded on boot-up every time? – Engineer999 Jan 17 at 22:04
  • 1
    @Engineer999 yup unless you have very old or very new hardware that the kernel knows nothing about and then you might have to build a custom kernel. – Fabby Jan 17 at 22:06
  • @Engineer999 I believe it should do. By default, all of the drivers/modules are provided, for as much hardware as possible. Except very new hardware, as Fabby mentioned. – Time4Tea Jan 17 at 22:07
  • 1
    Or old obsolete hardware @Time4Tea modules do get removed too. – Fabby Jan 17 at 22:07
2

The Linux Kernel Map shows in some detail the device control. It contains something called "drivers" and "modules" that can be extended by "Loadable Kernel Modules".

E.G.: USB devices generally have a module that gets loaded when the device gets attached whereas the USB root hub is statically linked into the kernel and an nVidia card need a driver downloaded from nVidia.

That's why most distributions run on a wide variety of hardware, but not necessarily all very new hardware, which might need a separate module or a driver.

For more information on the difference between a driver and a module have a look here

How the kernel knows which modules to load digs deeper into the hardware layer and it does it by enumerating:

  • the PCI bus
  • the SCSI bus
  • the USB hub
  • the DSPs ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.