dlang / project-ideas

Collection of impactful projects in the D ecosystem
36 stars 12 forks source link

DPP with Linux kernel headers #54

Closed edi33416 closed 3 years ago

edi33416 commented 4 years ago

Description

Razvan (@RazvanN7 ) and I worked last year with Alex Militaru on writing linux drivers in D. At the time we tried to use DPP to #include kernel headers in D modules, but we didn't manage to get it to work on the Linux code base so we had to do everything by hand.

As you probably know from personal experience, manually translating headers to .di interfaces is a tedious, repetitive, boring and error prone (because of it repetitive and boring) task for a programmer and a waste of actual development time. This is a perfect task for automation.

We feel that adding DPP support for the Linux code base would be a great addition and a natural way of going forward for writing drivers in D.

What are rough milestones of this project?

  1. Get familiar with DPP's code and work flow
  2. Understand why DPP doesn't work on the Linux code base (my guess is because of GCC specific flags)
  3. Make DPP work on failing cases (eg. make it learn about GCC specifics and how to ignore or translate them without breaking code)

How does this project help the D community?

This would be a great enabler for any developer that desires to write a Linux driver in D, and I feel that it will also be received well by the community.

Recommended skills

Willingness to learn Determination C, D bonus: experience with llvm/libclang bonus: experience with Linux build system

(If applicable, e.g. GSoC/SAoC)

What can students expect to get out of doing this project?

  1. how to debug
  2. how DPP works
  3. how language interop works at the lowest level

Point of Contact

@edi33416 @RazvanN7 @atilaneves

References

<NG discussions, GitHub PRs, Bugzilla issues, ...>

burner commented 4 years ago

have you created issue's for the non working headers in the dpp project?

edi33416 commented 4 years ago

Unfortunately I didn’t, but what I did at the time is that I set up a github repo with a VM [0] that we can use to repro the test scenario.

This uses vagrant, virtualbox and ansible to power-up an Ubuntu 18.04 and configure the environment and everything. Please follow the Readme.md to get the VM up and running.

After the machine boots, you can find the test files in /home/vagrant/dpp-test on the guest machine.

This can be used to repro and file an issue.

[0] - https://github.com/edi33416/d-kern-mod-vm/tree/master

RazvanN7 commented 3 years ago

I'm closing this since the issues have been fixed and now dpp can be successfully used to include linux kernel files.