mdev with hda's

David Henderson dhenderson at
Wed May 11 22:45:49 UTC 2011

On 05/11/2011 06:24 PM, Harald Becker wrote:
>   Hallo David!
>> Since both are immediately exporting the environment, they will have
>> the same information as originally posted, but for the sake of
>> argument, I did as asked with the output below:
> Click! ... thinking about I found the possible solution why hd devices
> show up with a shell inherited environment ...
> ... the reason is contained in your above statement: hd and sd device do
> *not* both *immediately* export the environment ... I assume you are
> using a standard kernel, with statically included ata driver ... the
> kernel/device startup sequence differes between hd and sd devices. hd
> devices are present before init startup and do not produce hotplug
> events (as far as I noted). sd devices produce hotplug events on
> startup. That leads to the extreme difference of environment setup. hd
> devices are setup during initial "mdev -s" run ... and inherit the
> calling shells environment, whereas sd devices are initialized by
> hotplug events called from scsi kernel threads ... and inherit the
> kernel threads environment.
> ... that will explain all noted differences and behavior ... but may
> need some verification (only solved theoretically).

I'm actually using the TinyCore kernel ( which includes a 
couple of patches by their development team, so it's not a vanilla 
kernel.  Based on your explanation above, it makes perfect sense why I'm 
getting two vastly different sets of environment variables.  Problem 
solved! :)

>> TERM=linux
>> OS=XiniX
>> USER=root
>> LD_LIBRARY_PATH=/lib:/home/root/.lib:/home/.everyone/.lib
>> bootmode=normal
>> ED=EE
>> PATH=/home/root/.etc/defaults:/etc/defaults:/home/root/.bin:/home/root/.sbin:/bin:/sbin
>> vga=0x314
>> PWD=/dev
>> ADMAIL=support at
>> HOME=/home/root
>> SHLVL=3
>> PIDDIR=/var/run/pids
>> SVDIR=/var/run/services
>> VER=0.5
>> ADMIN=Dave
> Is this the environment setting of your startup / init script(s)?
> Especially the variables vga and bootmode are an indication for this
> assumption.
> May be you can search through your init scripts and locate the "mdev -s"
> call ... put an "env>/tmp/init_env" there (just before mdev call) and
> compare output with above list. Add an "export MDEV_TEST=irgendwas"
> bevor the "mdev -s", this shall show up as "MDEV_TEST=irgendwas" in your
> mdev output for hda devices ... if I'm right with my above theory.
> --
> Harald
> _______________________________________________
> busybox mailing list
> busybox at

Yes, the above is environment of the startup/init script - no need to 
test that theory as I know for sure that's the case. :)  I still think 
that it would make more sense for mdev to pass a standard environment 
when called than the way it works now.  It will present less confusion 
to a developer (namely me :).


NOTE: anyone using this thread as a resolution to a problem, your 
environment variables will most likely *not* be like the ones above 
since this is a custom distro.

More information about the busybox mailing list