Kernel module in D - linux-kernel

Is it possible to create a kernel module in D?
I’d like to write a device driver for Arch, using The Linux Kernel Module Programming Guide. I’m having trouble finding info on this, perhaps by someone who’s been down this path already.

Typing Kernel module in D in google gives me 4th result with Proof of Concept: Writing a Linux Kernel Module in D.
Yes, it's possible to create a kernel module using D.

Related

UEFI BootLoader

I am looking at developing a simple (to start with) UEFI Boot loader to load a ELF image, and was wondering if anyone had a good entry point into maybe any existing projects, or examples that I can use to get started out with.
In addition I was wondering if any one had any experience in getting virtual box to run an EFI application. I have set up a VM with EFI mother board but can seam to create an EFI System Partition for it to load out of (without using an OS), all I can achieve is the UEFI command line.
You might try taking a look at the GRUB or elilo source code. These are also good because they support loading ELF images. You might also look to the EDK2, there is a lot of good code there, and it's easy to build EFI executable images with it.
When referencing the UEFI, I also like to use Phoenix's wiki. I find the boot services entry to be especially useful.
Hope this helps at least a little!
I recently became interested in bootloaders too. I'm still a newbie in this field, but I found this interesting step-by-step tutorial to code a "Hello World" bootloader. Hope it gives you or anyone else with the same question a starting point for developing your bootloader.
GRUB installation on UEFI is possible by means of grub-mkimage. ELF binaries are known to be similarly masqueraded as complying UEFI's PE32+ requirement. If some C developers will refactor the code as done by https://www.kernel.org/doc/Documentation/efi-stub.txt and then generalize mkimage's that code as a separate tool for the sake of multibooters without PE32+ kernel loaders for every OS...
Just imagine
ld -b input-format -o <output>.efi --oformat=output-format objfile ...

Correlation between

I am asking here because I have no idea where to find any information about this problem. If you could recommend me a book or an article about it, I would be pleased.
Where can I find any information about correlation between Linux kernel and GLIBC's version? I know that, the kernel itself contains implementation of libc's functions, but I do not know, how they are delivered to it.
For example:
Recently I had to build the kernel for an old PowerPC processor. It came with libc's dynamic library files in version 2.3.6 out-of-the-box. In /lib/ path there are files with names like librt.so-2.3.6.
What is the simplest way to update this lib to a newer version?
Is it possible to configure kernel's build system to make it generating uImage file with a newer GLIBC version or an alternative one (ex. EGLIBC)?
There is little correlation, the same kernel should work with a wide range of glibc versions, and viceversa. The library finds out what the kernel handles, and uses that. For the gory details of what has changed in glibc (this is what you interact with, including support for new kernel features), you should look at the upstream changelog. For new features in the Linux kernel, perhaps the best source are the periodical "What's new in..." articles the kernel section of LWN

Customizing linux kernel for new board

I'm porting/customizing linux kernel for our board. I will base on atmel evolution board configuration, and I need to overwrite some startup routines and add our drivers.
Is there any document, link, forum where I can get information how to make it in Linux way ?
Which files can I overwrite, and which shall I create from scratch ?
Is this a Board Support Package question ?
Thank you
I doubt that there is short and simple answer to your question. To accomplish this task you should more or less good understand Linux as distribution (kernel + boot scripts + user space software) work together and how make them be a friends.
I could recommend you book, which I found extremely useful as embedded Linux engineer: Embedded Linux Primer: A Practical Real-World Approach (2nd Edition) I am quite confident it will answer most of your questions.
I think that's it. Short, nice, fresh:
http://free-electrons.com/blog/elce-2012-slides-porting-linux-to-new-arm-soc/

How do you program a device driver for OSX?

So I am trying to make a hackintosh, and I want to write a device driver for a piece of hardware I have.
How would one go about learning how to program device drivers? Does it require assembly language?
You would want to write a Kernel extension.
Apple has a introduction to the topic in their developer library
You will need to learn I/O Kit--it's the (embedded) C++ framework/runtime in the kernel. What kind of device is it? PCI?
Here's another documentation link:
https://developer.apple.com/library/mac/#documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Intro/AH_Intro.html
Good luck...

Linux: wake_up and sleep_on functions

I am trying to learn how to program loadable kernel modules for linux. I was wondering if anyone could tell me what the functions sleep_on and wake_up do?
In examples I am looking at &WaitQ is always passed into them and
static DECLARE_WAIT_QUEUE_HEAD(WaitQ);
is declared at the top of the module.
If a task in the kernel arrives at a point where it wants to use resource and it gets told the resource is currently used by another task, it can decide to go sleep saying wake me up when the resource is available again. That's basically the deal with sleep_on and wake_up. See here for an explanation in detail: http://www.linuxtopia.org/online_books/Linux_Kernel_Module_Programming_Guide/x1032.html

Resources