How to build and use Linux device drivers on FreeBSD

Linux has a large amount of device drivers for hardware not supported on FreeBSD, especially USB devices (see here for a related discussion). Not rarely, such drivers have been written based on information derived by protocol sniffing, reverse engineering and the like. This makes the code highly undocumented, and renders the porting effort extremely error prone.

ADVERTISEMENTS

To help with this task, I decided to start working on an emulation layer that would let us recompile the linux source code on FreeBSD, and provide a sufficiently complete emulation of the kernel APIs so that device drivers (or at least certain classes) could be used without modifications to their source code.

=> Building Linux Device Drivers on FreeBSD

This will help to run few things. I can try out my TVTunner card and Intel wireless card under FreeBSD.

The methodology is not new – FreeBSD has always offered emulation of different APIs at the syscall level, and also some emulation of the Windows API is available for network device drivers. So I am just repplying the concept to another area which is currently lacking native support. My initial focus was on usb webcam drivers, and so this emulation layer contains enough to create a character driver using the services of the USB stack.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.