[Toybox] Pondering mdev...

Rob Landley rob at landley.net
Mon Sep 2 00:31:51 PDT 2013


Ok, I'm officially a bit behind on email. (Started composing this  
message when I didn't have the net available, sat on the desktop of the  
netbook I'm only using email for a bit...)

On 08/25/2013 08:09:39 PM, Isaac wrote:
> On Sun, Aug 25, 2013 at 03:41:15AM -0500, Rob Landley wrote:
> > On 08/22/2013 11:17:17 PM, Isaac wrote:
> modprobe basically calls recursive_modprobe() (the 4-step process
> I mentioned above) which calls itself till all the modules are loaded.
> To resolve the aliases, it looks in $basedir or
> (/lib/modules/$(uname -r) || /tmp/modules/$(uname -r))
> 
> dependencies could be obtained either by ELF parsing for the symbols
> or by looking at the depends: field.
> I'm inclined to do a first pass that ignores symbols altogether, then
> add symbol support (which *I* haven't a clue how to do, apart from
> including elf.h...).

It's some fairly simple table parsing; elf.h is kinda crazy defining  
macros to hide types. (That said, musl's src/ldso/dynlink.c uses elf.h,  
as does uClibc's old readelf.c, so it can't be that bad.)

The best documentation on ELF is, unfortunately, the book "linkers and  
loaders" available free online:

   http://www.iecc.com/linker/

It is an _extremely_ dry read, and covers a lot of obsolete stuff in  
addition to ELF.

There's also an ELF spec and and architecture-specific ELF spec  
extensions on http://refspecs.linuxbase.org

It's a touch redundant (multiple versions of similar documents), but  
something like these two:

   http://refspecs.linuxbase.org/elf/elf.pdf
   http://refspecs.linuxbase.org/elf/x86_64-abi-0.95.pdf

Probably covers it.

Also, if you want a slightly dated but generally awesome intro to the  
concepts:

   http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html

is worth a read on general principles.

Rob
 1378107111.0


More information about the Toybox mailing list