Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Sep 2015 18:08:26 -0300
From:      Mario Lobo <lobo@bsd.com.br>
To:        Alexander Leidinger <Alexander@leidinger.net>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: /dev for Linux binaries in freebsd
Message-ID:  <20150926180826.5d673a64@Papi>
In-Reply-To: <20150926134433.Horde.dywx79dLiTk9Z_UmyvgIU7-@webmail.leidinger.net>
References:  <20150924195443.1805e50d@Papi> <20150926134433.Horde.dywx79dLiTk9Z_UmyvgIU7-@webmail.leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 26 Sep 2015 13:44:33 +0200
Alexander Leidinger <Alexander@leidinger.net> wrote:

> Quoting Mario Lobo <lobo@bsd.com.br> (from Thu, 24 Sep 2015 19:54:43
> -0300):
> 
> > I was trying to find out where a linux binary will look for the /dev
> > directory.
> >
> > I tried to link the device I need to /compat/linux/dev but that
> > didn't work.
> 
> This is expected. Do not create links to the real /dev there, you
> will create a loop (see below).
> 
> > How can a linux binary see the devices (serial ports, usb, etc) of
> > the system?
> 
> The behavior under the assumption that you haven't chrooted into  
> /compat/linux is:
> 
> A linux program will ask the kernel for /dev/xyz.
> The kernel knows that it is a linux program, and as such it will
> first look for /compat/linux/dev/xyz.
> If the kernel doesn't find the device there, it will look
> for /dev/xyz.
> 
> As such you should not touch /compat/linux/dev at all, it will  
> "fall-through" to the real /dev.
> 
> Maybe your real problem is not that you can't access the right /dev/  
> entry, but that the devide doesn't understand what the linux program  
> wants to do.
> 
> You can use ktrace or dtrace to check what the program tries to do.  
> You should see in the output what the real patch is it tries to
> reach and what kind or errno it get's when it tries to access it.
> 
> 
> If you chroot into /compat/linux, you need to mount devfs in  
> additionally to /compat/linux/dev.
> 
> Bye,
> Alexander.

Thanks for the tips, Alexander.

I`ll see what I can find out.

-- 
Mario Lobo
http://www.mallavoodoo.com.br
FreeBSD since 2.2.8 [not Pro-Audio.... YET!!]
 
"UNIX was not designed to stop you from doing stupid things, 
because that would also stop you from doing clever things."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150926180826.5d673a64>