I want to write a linux driver which maps my specified memory address space to /dev/fb0.

the driver should be specified by what part of linux? drm or frame buffer or server X or somthing else? Which properties should I have in my driver?

  • 1
    As I recall, although I am going by memory only as the question has since been deleted, in an earlier incarnation of this question you said that with one kernel you could send output to your LCD screen with cat via a framebuffer. So it would seem from that that there already is a Linux driver for your device. – JdeBP Sep 11 '18 at 8:53
  • @JdeBP yes you are right. I deleted my question in order to clarify what i am looking for. Although I got nearer to it by what is said. In fact I have a zynq board and an LCD that want to display desktop environment on it. LCD turns on at boot time but when startx calls, the LCD turns off and I can not display desktop environment. – Mojtaba Ahmadi Sep 11 '18 at 12:26

The driver is a linux kernel module.

Download the source of the linux kernel, have a look at the code of the existing framebuffer drivers in drivers/video/fbdev (github here) and the documentation in Documentation/fb (github). Google for tutorials how to write kernel modules, practice with a simple module first.

Just mapping memory won't be enough, you'll have to implement a few ioctls.

Writing kernel drivers is not easy. If you have to ask this kind of questions (and you asked a lot in the past few days), you probably won't be able to do it.

X is a server for the X protocol. It can use hardware via the DRM kernel modules, and it can also use hardware via framebuffer drivers (with the fbdev X driver). Details about that are easy to find online, google. /dev/fb0 is a framebuffer device, so you don't need to concern yourself with X or DRM.

  • 1
    thank you. I asked because answers were confusing and in different forums, different answers were given. and I was looking for simpler and faster way. I know this work is not easy, so I should try more and spend more time. thank you anyway for your helpful response :) – Mojtaba Ahmadi Sep 11 '18 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.