Hacker News new | past | comments | ask | show | jobs | submit login
Linux Kernel Development and Writing a Simple Kernel Module (2018) (devarea.com)
213 points by whack 4 months ago | hide | past | favorite | 8 comments

If you're not familiar with the kernel you will probably try to use some specific thing from the C standard library only to find out that it doesn't work or isn't defined. You're looking at kmalloc() as the kernel equivalent for malloc(), though I think normally for something like a device driver you'd allocate pages of memory (via one of the __alloc_pages related calls) and manage it yourself from there. The best way is to use the source, look at other examples and search the code. But there is an API, and most common things have not really changed for decades now

I reccomend https://kernelnewbies.org/ as a first stop for the curious (although I might also reccomend Emacs, contrary to their tutorial ;).

I wish there would be more guides like this for macOS KEXT development. Easy to read, clean code examples, and quick to get started.

I was planning to port a driver for a specific PCI 802.11 NGFF WiFi device from FreeBSD or Linux, but it's really hard to find exhaustive guides on KEXT development, whereas Linux has the amazing guide at https://www.kernel.org/doc/html/latest/driver-api/80211/inde....

Same but for Windows. There are a handful of decent, but cursory WDK books / tutorials, and the Windows Internals books, but outside of that the MSDN documentation seems pretty bad. A lot of stuff seems almost contradictory (it probably isnt, but it reads that way)

Everytime ove wanted to develop a driver for windows, I get stuck because I cant even figure out what type of driver to use because there are so many possible models and existing stacks to build off of.

At least with linux and BSDs I can hop in something like an irc channel when and someone can usually help me.

I thought Apple was deprecating (3rd party) kernel-mode drivers? Or am I misremembering that?

That is correct, but hasn't happened, yet. My comment also applies to DriverKit which is Apples "modern" solution to run userspace Kernel extensions.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact