Re: [uml-user] Some Drivers in UML kernel

On Fri, May 16, 2008 at 11:35:20AM -0700, David Francisco Rodriguez Perez wrote:
> I am working on a simulator of a product and so far we have decided to go
> with UML. I have so far 2 questions.
> 1. There is a network namespace patch that is coming into the mainline in
> 2.6.26. Is this patch going to be supported in UML?
If it's in mainline, it's in UML (for the most part - some things
require arch support, but I don't the the namespace stuff is among them).
> 2. The following question is maybe a no-brainer. We have a a user space
> program using the socket library to connect to a server outside the UML
> entity. We would like to change that to a kernel driver in UML. Can we
> create a module for UML that uses a user space library like the socket
> library? I would assume not, but just to confirm.
You can. That's how UML drivers generally work. See pcap and vde for
a couple of drivers that pull in libraries.
Jeff
--
Work email - jdike at linux dot intel dot com

Thread view

Hi
I am working on a simulator of a product and so far we have decided to go
with UML. I have so far 2 questions.
1. There is a network namespace patch that is coming into the mainline in
2.6.26. Is this patch going to be supported in UML?
2. The following question is maybe a no-brainer. We have a a user space
program using the socket library to connect to a server outside the UML
entity. We would like to change that to a kernel driver in UML. Can we
create a module for UML that uses a user space library like the socket
library? I would assume not, but just to confirm.
Thanks for any help.
David Rodriguez

On Fri, May 16, 2008 at 11:35:20AM -0700, David Francisco Rodriguez Perez wrote:
> I am working on a simulator of a product and so far we have decided to go
> with UML. I have so far 2 questions.
> 1. There is a network namespace patch that is coming into the mainline in
> 2.6.26. Is this patch going to be supported in UML?
If it's in mainline, it's in UML (for the most part - some things
require arch support, but I don't the the namespace stuff is among them).
> 2. The following question is maybe a no-brainer. We have a a user space
> program using the socket library to connect to a server outside the UML
> entity. We would like to change that to a kernel driver in UML. Can we
> create a module for UML that uses a user space library like the socket
> library? I would assume not, but just to confirm.
You can. That's how UML drivers generally work. See pcap and vde for
a couple of drivers that pull in libraries.
Jeff
--
Work email - jdike at linux dot intel dot com

Hi
I was able to compile my driver using user space library libc.a. But when I
run the Linux executable, it runs this driver very early in the bootup
process such that I have not setup the ethernet eth0 interface.
So the output looks like:
HelloTCP Start
Not able to connect to remote client...
Then...I see the config on the eth0.
So I wanted to compile the driver as a loadable module but now I have
problems compiling due to errors of the users space socket system calls like
"socket", "connect", "setsockopt", as undefined. How could I do it?
David
On Fri, May 16, 2008 at 2:02 PM, Jeff Dike <jdike@...> wrote:
> On Fri, May 16, 2008 at 11:35:20AM -0700, David Francisco Rodriguez Perez
> wrote:
> > I am working on a simulator of a product and so far we have decided to go
> > with UML. I have so far 2 questions.
> > 1. There is a network namespace patch that is coming into the mainline in
> > 2.6.26. Is this patch going to be supported in UML?
>
> If it's in mainline, it's in UML (for the most part - some things
> require arch support, but I don't the the namespace stuff is among them).
>
> > 2. The following question is maybe a no-brainer. We have a a user space
> > program using the socket library to connect to a server outside the UML
> > entity. We would like to change that to a kernel driver in UML. Can we
> > create a module for UML that uses a user space library like the socket
> > library? I would assume not, but just to confirm.
>
> You can. That's how UML drivers generally work. See pcap and vde for
> a couple of drivers that pull in libraries.
>
> Jeff
>
> --
> Work email - jdike at linux dot intel dot com
>

Hi All
Sorry pls disregard my message. I was able to do it. I created a driver
similar to vde and pcap linking user space library libc.a and then I
exported the symbols to make TCP connections. Then I created a normal
loadable module to use those methods to make a connection to a server out of
the UML instance. Then when I install that module in the UML once all the
networking is already setup it connects to my outside server without no
issue.
Thanks
David
On Mon, May 19, 2008 at 5:29 PM, David Francisco Rodriguez Perez <
david.francisco.rodriguez@...> wrote:
> Hi
>
> I was able to compile my driver using user space library libc.a. But when I
> run the Linux executable, it runs this driver very early in the bootup
> process such that I have not setup the ethernet eth0 interface.
> So the output looks like:
> HelloTCP Start
> Not able to connect to remote client...
>
> Then...I see the config on the eth0.
>
> So I wanted to compile the driver as a loadable module but now I have
> problems compiling due to errors of the users space socket system calls like
> "socket", "connect", "setsockopt", as undefined. How could I do it?
>
> David
>
> On Fri, May 16, 2008 at 2:02 PM, Jeff Dike <jdike@...> wrote:
>
>> On Fri, May 16, 2008 at 11:35:20AM -0700, David Francisco Rodriguez Perez
>> wrote:
>> > I am working on a simulator of a product and so far we have decided to
>> go
>> > with UML. I have so far 2 questions.
>> > 1. There is a network namespace patch that is coming into the mainline
>> in
>> > 2.6.26. Is this patch going to be supported in UML?
>>
>> If it's in mainline, it's in UML (for the most part - some things
>> require arch support, but I don't the the namespace stuff is among them).
>>
>> > 2. The following question is maybe a no-brainer. We have a a user space
>> > program using the socket library to connect to a server outside the UML
>> > entity. We would like to change that to a kernel driver in UML. Can we
>> > create a module for UML that uses a user space library like the socket
>> > library? I would assume not, but just to confirm.
>>
>> You can. That's how UML drivers generally work. See pcap and vde for
>> a couple of drivers that pull in libraries.
>>
>> Jeff
>>
>> --
>> Work email - jdike at linux dot intel dot com
>>
>
>

On Mon, May 19, 2008 at 05:29:19PM -0700, David Francisco Rodriguez Perez wrote:
> I was able to compile my driver using user space library libc.a.
If libc is all you need, then don't bother trying to pull in libc.a at
all. UML needs libc, so you'll get it anyway.
> So I wanted to compile the driver as a loadable module but now I have
> problems compiling due to errors of the users space socket system calls like
> "socket", "connect", "setsockopt", as undefined. How could I do it?
See arch/um/os-Linux/user_syms.c
Jeff
--
Work email - jdike at linux dot intel dot com