Re: [Help] Linux low level data structures < - > FreeBSD low level data structures

2017-06-04 Thread blubee blubeeme
@Hans
I've noticed these things about Linux. A  lot of stuff relies on knowing
the internals of the data structures instead of working with the API but I
don't want to start all that stuff up.

The goal is to lift up FreeBSD w/o tearing down Linux and as u know needing
to be glued to the Linux data structures, while they always seem to be in
flux is one reason why I want to steer clear from the linuxkpi stuff.

I cam across the webcamd thing a while ago, it was written when Linux was
not moving so fast if I remember correctly. This is a big challenge but I
think once it's up and running it will bring some additional resources to
FreeBSD that can bring the desktop world up to snuff with it's server
acumen.

Thanks for the tips though!

Best,
Owen

On Mon, Jun 5, 2017 at 12:07 AM, Hans Petter Selasky 
wrote:

> Hi Owen,
>
> The most comprehensive open-source wrappers for Linux kernel APIs in the
> FreeBSD kernel is found at:
>
> https://github.com/FreeBSDDesktop/freebsd-base-graphics/
> tree/drm-next/sys/compat/linuxkpi
>
> The most comprehensive open-source wrappers for Linux kernel APIs in
> FreeBSD user-space is found at:
>
> http://www.freshports.org/multimedia/webcamd
>
> I recommend you start with webcamd. Download the source code and look at
> the sources. See if there is something you think you can improve. It is
> much easier to debug using GDB and if something goes wrong it can easily be
> restarted.
>
> When you have a working solution for webcamd, try to use the same solution
> with the kernel.
>
> There is no simple 1:1 mapping for Linux APIs to FreeBSD APIs. Take for
> example linux/list.h . You might think that a list can be re-implemented
> and mapped to our sys/queue.h. But oh-no. Linux kernel code depends on all
> the characteristics of list.h, how the structure members are stored and
> named, and how foreach() macros complete with NULL or non-NULL in the
> iterator. Further you'll find resistance among the Linux kernel developers
> to support compilers different from GCC. I recently found a piece of code
> in a header file, which works with GCC and causes a panic() when compiled
> with clang. I reported it to one of the Linux kernel team members and they
> didn't care about it. Even if you get everything compiling it doesn't it
> will work :-(
>
> --HPS
>
>
> On 06/04/17 16:35, blubee blubeeme wrote:
>
>> Hi Julian
>>
>> My goals are to port the Linux graphics stack over to FreeBSD w/o relying
>> too heavily on the linuxkpi stuff. That's cool for a lot of use cases but
>> it just seems a bit too brittle.
>>
>> It is a very large I understand the task will not be easy but I am willing
>> to do the work, even from scratch if necessary although some help would be
>> appreciated.
>>
>> I've been watching the Linux DRM project grow and while the top levels has
>> changed, it's been a very long time since the actual low level stuff has
>> been changed. Most of the diffs have shown changes in the
>> [linux/driver/gpu/drm] layer which relies heavily on the
>> [linux/include/drm] that does a lot of the heavy lifting here's a link to
>> the latest version files:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin
>> ux.git/tree/include/drm?h=v4.12-rc3
>>
>> here's a diff of the latest version of the [linux/driver/gpu/drm] :
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin
>> ux.git/diff/?id=v4.12-rc3=v4.12-rc2=2
>>
>> The diffs in the drivers change constantly but the lower level stuff
>> hasn't
>> changed as much.
>>
>> Doing some of the lower level translation to native FreeBSD style data
>> structures then the upper part could be easily migrated, even with
>> something as using AST to translate the headers to their FreeBSD
>> equivalent
>> without worrying about inadvertently breaking something or having major
>> diffs that needs people to actively look at maintaining.
>>
>> That's a high level overview of my plan and what I'd like to achieve. Will
>> it be easy, most likely not but once it's done FreeBSD will be just fine.
>>
>> Hope that helps clarify things for anyone who is interested. Any
>> assistance
>> would be greatly appreciated.
>>
>> Best,
>> Owen
>>
>> On Sun, Jun 4, 2017 at 9:26 PM, Julian Elischer 
>> wrote:
>>
>> On 4/6/17 7:07 pm, blubee blubeeme wrote:
>>>
>>> Hello

 Is there anyone on either of these lists that have experience with both
 linux low level data structures and their equivalents on FreeBSD?

 For instance the linux header file:
 

 which includes the header file:
 

 Then looking at that file:
 
 
 
 
 


>>> You are going to have to be a lot more specific about this.
>>> I have worked in several places where they use s shim layer to make Linux
>>> basic services work on freeBSD.
>>> usually  a mix of functions, macros and inlines.
>>> However you need to narrow down your questions a bit as the POSSIBLE
>>> scope
>>> of your 

Re: [Help] Linux low level data structures < - > FreeBSD low level data structures

2017-06-04 Thread Hans Petter Selasky

Hi Owen,

The most comprehensive open-source wrappers for Linux kernel APIs in the 
FreeBSD kernel is found at:


https://github.com/FreeBSDDesktop/freebsd-base-graphics/tree/drm-next/sys/compat/linuxkpi

The most comprehensive open-source wrappers for Linux kernel APIs in 
FreeBSD user-space is found at:


http://www.freshports.org/multimedia/webcamd

I recommend you start with webcamd. Download the source code and look at 
the sources. See if there is something you think you can improve. It is 
much easier to debug using GDB and if something goes wrong it can easily 
be restarted.


When you have a working solution for webcamd, try to use the same 
solution with the kernel.


There is no simple 1:1 mapping for Linux APIs to FreeBSD APIs. Take for 
example linux/list.h . You might think that a list can be re-implemented 
and mapped to our sys/queue.h. But oh-no. Linux kernel code depends on 
all the characteristics of list.h, how the structure members are stored 
and named, and how foreach() macros complete with NULL or non-NULL in 
the iterator. Further you'll find resistance among the Linux kernel 
developers to support compilers different from GCC. I recently found a 
piece of code in a header file, which works with GCC and causes a 
panic() when compiled with clang. I reported it to one of the Linux 
kernel team members and they didn't care about it. Even if you get 
everything compiling it doesn't it will work :-(


--HPS

On 06/04/17 16:35, blubee blubeeme wrote:

Hi Julian

My goals are to port the Linux graphics stack over to FreeBSD w/o relying
too heavily on the linuxkpi stuff. That's cool for a lot of use cases but
it just seems a bit too brittle.

It is a very large I understand the task will not be easy but I am willing
to do the work, even from scratch if necessary although some help would be
appreciated.

I've been watching the Linux DRM project grow and while the top levels has
changed, it's been a very long time since the actual low level stuff has
been changed. Most of the diffs have shown changes in the
[linux/driver/gpu/drm] layer which relies heavily on the
[linux/include/drm] that does a lot of the heavy lifting here's a link to
the latest version files:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/drm?h=v4.12-rc3

here's a diff of the latest version of the [linux/driver/gpu/drm] :
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/?id=v4.12-rc3=v4.12-rc2=2

The diffs in the drivers change constantly but the lower level stuff hasn't
changed as much.

Doing some of the lower level translation to native FreeBSD style data
structures then the upper part could be easily migrated, even with
something as using AST to translate the headers to their FreeBSD equivalent
without worrying about inadvertently breaking something or having major
diffs that needs people to actively look at maintaining.

That's a high level overview of my plan and what I'd like to achieve. Will
it be easy, most likely not but once it's done FreeBSD will be just fine.

Hope that helps clarify things for anyone who is interested. Any assistance
would be greatly appreciated.

Best,
Owen

On Sun, Jun 4, 2017 at 9:26 PM, Julian Elischer  wrote:


On 4/6/17 7:07 pm, blubee blubeeme wrote:


Hello

Is there anyone on either of these lists that have experience with both
linux low level data structures and their equivalents on FreeBSD?

For instance the linux header file:


which includes the header file:


Then looking at that file:








You are going to have to be a lot more specific about this.
I have worked in several places where they use s shim layer to make Linux
basic services work on freeBSD.
usually  a mix of functions, macros and inlines.
However you need to narrow down your questions a bit as the POSSIBLE scope
of your question is too large for anyone to attempt an answer.

Remember that both systems are POSIX inspired so outside the kernel there
are many more simlarities than one might be led to expect,
  but you need to be way more specific.
It's even possible to write kernel code to run on both, but it is usually
domain specific.




I'll be doing a lot of work trying to find these FreeBSD equivalent of
these types of files to port some code.

Does anyone here have experience with something like this? Is there any
other projects that maps these low level data structures from
Linux <-> FreeBSD, etc?

Best,
Owen

___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: [Help] Linux low level data structures < - > FreeBSD low level data structures

2017-06-04 Thread blubee blubeeme
Hi Julian

My goals are to port the Linux graphics stack over to FreeBSD w/o relying
too heavily on the linuxkpi stuff. That's cool for a lot of use cases but
it just seems a bit too brittle.

It is a very large I understand the task will not be easy but I am willing
to do the work, even from scratch if necessary although some help would be
appreciated.

I've been watching the Linux DRM project grow and while the top levels has
changed, it's been a very long time since the actual low level stuff has
been changed. Most of the diffs have shown changes in the
[linux/driver/gpu/drm] layer which relies heavily on the
[linux/include/drm] that does a lot of the heavy lifting here's a link to
the latest version files:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/drm?h=v4.12-rc3

here's a diff of the latest version of the [linux/driver/gpu/drm] :
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/?id=v4.12-rc3=v4.12-rc2=2

The diffs in the drivers change constantly but the lower level stuff hasn't
changed as much.

Doing some of the lower level translation to native FreeBSD style data
structures then the upper part could be easily migrated, even with
something as using AST to translate the headers to their FreeBSD equivalent
without worrying about inadvertently breaking something or having major
diffs that needs people to actively look at maintaining.

That's a high level overview of my plan and what I'd like to achieve. Will
it be easy, most likely not but once it's done FreeBSD will be just fine.

Hope that helps clarify things for anyone who is interested. Any assistance
would be greatly appreciated.

Best,
Owen

On Sun, Jun 4, 2017 at 9:26 PM, Julian Elischer  wrote:

> On 4/6/17 7:07 pm, blubee blubeeme wrote:
>
>> Hello
>>
>> Is there anyone on either of these lists that have experience with both
>> linux low level data structures and their equivalents on FreeBSD?
>>
>> For instance the linux header file:
>> 
>>
>> which includes the header file:
>> 
>>
>> Then looking at that file:
>> 
>> 
>> 
>> 
>> 
>>
>
> You are going to have to be a lot more specific about this.
> I have worked in several places where they use s shim layer to make Linux
> basic services work on freeBSD.
> usually  a mix of functions, macros and inlines.
> However you need to narrow down your questions a bit as the POSSIBLE scope
> of your question is too large for anyone to attempt an answer.
>
> Remember that both systems are POSIX inspired so outside the kernel there
> are many more simlarities than one might be led to expect,
>  but you need to be way more specific.
> It's even possible to write kernel code to run on both, but it is usually
> domain specific.
>
>
>
>> I'll be doing a lot of work trying to find these FreeBSD equivalent of
>> these types of files to port some code.
>>
>> Does anyone here have experience with something like this? Is there any
>> other projects that maps these low level data structures from
>> Linux <-> FreeBSD, etc?
>>
>> Best,
>> Owen
>> ___
>> freebsd-curr...@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-current
>> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org
>> "
>>
>
>
>
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: [Help] Linux low level data structures < - > FreeBSD low level data structures

2017-06-04 Thread Julian Elischer

On 4/6/17 7:07 pm, blubee blubeeme wrote:

Hello

Is there anyone on either of these lists that have experience with both
linux low level data structures and their equivalents on FreeBSD?

For instance the linux header file:


which includes the header file:


Then looking at that file:







You are going to have to be a lot more specific about this.
I have worked in several places where they use s shim layer to make 
Linux basic services work on freeBSD.

usually  a mix of functions, macros and inlines.
However you need to narrow down your questions a bit as the POSSIBLE 
scope of your question is too large for anyone to attempt an answer.


Remember that both systems are POSIX inspired so outside the kernel 
there are many more simlarities than one might be led to expect,

 but you need to be way more specific.
It's even possible to write kernel code to run on both, but it is 
usually domain specific.





I'll be doing a lot of work trying to find these FreeBSD equivalent of
these types of files to port some code.

Does anyone here have experience with something like this? Is there any
other projects that maps these low level data structures from
Linux <-> FreeBSD, etc?

Best,
Owen
___
freebsd-curr...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"



___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


[Help] Linux low level data structures < - > FreeBSD low level data structures

2017-06-04 Thread blubee blubeeme
Hello

Is there anyone on either of these lists that have experience with both
linux low level data structures and their equivalents on FreeBSD?

For instance the linux header file:


which includes the header file:


Then looking at that file:






I'll be doing a lot of work trying to find these FreeBSD equivalent of
these types of files to port some code.

Does anyone here have experience with something like this? Is there any
other projects that maps these low level data structures from
Linux <-> FreeBSD, etc?

Best,
Owen
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"