3 ms·
Let's say I grabbed the e1000 driver from Linux, how much of the Linux kernel would I end up re-writing (badly)?
by voltagex_ 6y ago
Let's say I grabbed the e1000 driver from Linux, how much of the Linux kernel would I end up re-writing (badly)?
- Koshkin 6y agoWhy not just grab some other parts of Linux? Or, better yet, link your application right into it?
- toast0 6y agoI haven't done it, and the e1000 driver is pretty big, so it's hard to scan quickly, but the general shape is you'd need to support the kernel functions the driver calls, and setup compatible kernel structures for the driver. At least the parts of the driver you call. Things like kernel malloc to setup pages and what not, mapping the device address, allocating interrupts, DMA (maybe), PCI, logging, maybe locking, basic c library stuff (memcpy etc). Some of those, you can probably just stub out, but some if it you have to do (badly or not). Some of that you probably need or want to build anyway. It's a fair bit of work, but if you want to support a lot of hardware, it's probably less work than porting a bunch of drivers.
- voltagex_ 6y agoThe e1000 came to mind because it's a commonly emulated network card. I wonder now what is more common in real servers.
- toast0 6y agoe1000 is pretty common in servers, too. It's got a lot of variations though, which makes the full driver pretty big. virtio-net is a lot easier to write a driver for, of course. :)