LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   how does hardware detection work (https://www.linuxquestions.org/questions/linux-hardware-18/how-does-hardware-detection-work-4175435791/)

SaintDanBert 11-05-2012 04:25 PM

how does hardware detection work
 
NOTE -- Other articles date from three or more years back... forever in internet time.

Can someone direct me to a details description of how linux hardware detection works? I need some understanding and lack the knowledge to read kernel and driver code and discover some details. Any help will be valuable and appreciated.

I run Linux Mint-12 (derived from Ubuntu 11.10) which is a Debian family distro so that you have more context. I know that each distro family has its own details.

I understand some behavior at the tree-top level:
  • power-on does hardware init; parts wake up
  • something causes some BIOS code to run
  • BIOS knows some and learns some hardware details
  • BIOS code loads first parts from boot device
  • first parts know some and learn some about hardware
  • "events" start dealing with found hardware
  • first parts load second parts from boot device
  • second parts add smarts to event processing
  • full system running -- devices come and go at end-user discretion

The "dynamic kernel module" process loads device drivers for found hardware. How do we get from HARDWARE_INIT to LOAD_MODULE( "moduleName" )?

Once loaded, do the events originate in the driver or does whatever loaded the driver throw the events when it see successful load and init completed?

I have hardware that works as advertised with win-dose, but that linux does not seem to grok well. (I get some behavior that is different, less, poor, on linux compared with win-dose.)

Lastly, if I must read about the kernel or boot loaders or elsewhere, can someone offer suggestions for recommended places to start? Are there blueprints or specs or similar before I start reading code?

Thanks in advance,
~~~ 0;-Dan

SaintDanBert 11-07-2012 10:53 AM

BUMP!!

Someone must have some reference or some knowledge about this topic.
Please throw this olde geek a bone (or pizza or beer or ...) so that
I can move forward with solving my problem.

~~~ 0;-Dan

kinneyd 11-07-2012 02:50 PM

I'm afraid I'm no expert on the topic, but my understanding is udev is pretty much responsible for loading modules these days. Look at section 7.4.2.4.

http://www.linuxfromscratch.org/lfs/...er07/udev.html

Hope that is somewhat useful.

SaintDanBert 11-07-2012 04:42 PM

What a great web site reference !!!

This is a classic case of you need to know enough to ask useful questions.
I had no idea that such a site existed.

Other LQ Readers: can you offer suggestions of more useful reading?

~~~ 0;-Dan

onebuck 11-08-2012 06:41 AM

Member Response
 
Hi,

Linux Kernel Interactive Map is a good map of the kernel to feel your way around. This gives a general overview for initialization.

Provide some insight to Dynamic Interrupt Request Allocation for Device Drivers that will help you understand overall device management.

Linux Device Drivers, Third Edition will help you to dissect or understand device drivers. Plus this book is a good desk reference.

Linux Signals for the Application Programmer a little sugar. :)

HTH!

SaintDanBert 11-08-2012 01:36 PM

Quote:

Originally Posted by onebuck (Post 4824913)
The Magic is in the Magician not the wand! ©

What is the origin of your signature quotation. I would guess Harry Potter©.

My avatar usually appears as Mickey Mouse™ in the Sorcerer's Apprentice©.
I know where the wizard keeps the hat, and I've learned how to swim and
clean up after any mess I create. (grin)

~~~ 0;-Dan

SaintDanBert 11-08-2012 01:40 PM

Quote:

Originally Posted by onebuck (Post 4824913)
Hi,

Linux Kernel Interactive Map is a good map of the kernel to feel your way around. This gives a general overview for initialization.

Provide some insight to Dynamic Interrupt Request Allocation for Device Drivers that will help you understand overall device management.

Linux Device Drivers, Third Edition will help you to dissect or understand device drivers. Plus this book is a good desk reference.

Linux Signals for the Application Programmer a little sugar. :)

HTH!

Thanks for the reading references. Like much in this open community world, one needs some knowledge before one can ask reasonable questions. I have hopes for The Linux Documentation Project as a clearing house and go-to point to find 'yellowBrick==1' on the road to information.

If you know of other documentation collections, would you kindly mention those in a follow-up post?

Thanks,
~~~ 0;-Dan

SaintDanBert 11-08-2012 02:03 PM

I found the following article from 2009:
Intro to UDEV
that seems to offer a little light on the subject. Specifically:

Kernel Device Event Management
  • When bootup is initialized, the /dev directory is mounted in tmpfs.
  • After that, Udev will copy the static device nodes from /lib/udev/devices to the /dev directory.
  • The Udev daemon then runs and collects uevents from the kernel, for all the devices connected to the system.
  • The Udev daemon will parse the uevent data and it will match the data with the rules specified in /etc/udev/rules.d.
  • It will create the device nodes and symbolic links for the devices as specified in the rules.
  • The Udev daemon reads the rules from /etc/udev/rules.d/*.rules and stores them in the memory.
  • Udev will receive an inotify event, if any rules were changed. It will read the changes and will update the memory.
I hope to find something more recent. 2009 to 2012 is forever in Linux/internet time...

~~~ 0;-Dan

onebuck 11-08-2012 02:05 PM

Member Response
 
Hi,

Look at Slackware®-Links for useful links.

As to my sig 'The Magic is in the Magician not the wand! ©', I copyrighted that years ago. Been using it for a long time. Just a play on context of words to symbolize that man is the master visionary.

SaintDanBert 11-08-2012 02:17 PM

Re: Magic and wands and hats

I doff my hat (sic) to the way you think.

Cheers,
~~~ 0;-Dan

SaintDanBert 11-16-2012 11:56 PM

In some reading, somewhere, I remember finding that during the power-up and initial scans, some software creates and XML representation of all hardware found.

Where do I find documentation on this XML representation of hardware?


Is there a Document Type Definition or XML Schema for this hardware representation as XML?

Is the XML stored to disk somewhere that mortals can read it?

Is this the same XML one might see reading the output from lshw -xml?


All times are GMT -5. The time now is 11:06 PM.