How to compile driver in FreeBSD

ralphbsz Man, you know from where I am! Do you think that they will give me my money? Besides, it works on Kali. Yes, I have been using Kali Linux, and I can say that it's one of the better distros EVER.
Now you probably gonna think: "this assh0le is using a device which isn't supported here". Calm: I explain it...
I don't know which is your level of knowing in Linux. I started on FBSD a few months ago. I've been using Linux since I throw Winsh1t through the window (never better said). That was, aproximately, form 3 to 5 years ago. I have very, but very clear from which could be used Kali. In fact, I used its tools more than one time, but because I'm not a hacker, I used it mostly for its estability and because, god don't leave it, but some cr4p that is rounding from the Web gets the brilliant idea of try to f*ck me (or use your imagination), I will prepared for that.
That's why I installed RHEL. That's why I use FBSD. The first was because of the two s**** defects on the processors: "spectre" and "meltdown". I read that RHEL has one (if not the most) of the higher level of security in its system. That they were patched those cr4p. And FBSD was for the same reason, but with a little exception: it is free. I can't pay for software which I didn't used. So, despite of my low level of knowing informatic, I can sort both sh1t here and there: something that I can't in Winsh1t because...well...if you wait for REAL help from those who make the code of one of the most unsafe and unstable systems...you're bad bro...you could be watched with no problems there. Here can occur that? Yes. But despite it, at least you *have the facility to defend yourself and don't wait that a dark company helps you god knows when*.
 
ralphbsz This would be probably touching the illegal...but I could "copy" the drivers from Kali or another OS and adapt 'em for use here?
Edit: if you couldn't give me that answer don't worry: I understand perfectly why.
 
You could *port* the driver. That's nothing like copying. Fundamentally, you would be writing a new FreeBSD driver, but following the logic from the OpenBSD or Linux drivers. If you read the blog posts by Adrian Chadd (the maintainer of many of the wireless drivers in FreeBSD), that's actually how he works: He uses knowledge gleaned from reading other drivers to write the FreeBSD drivers. I don't know what the copyright situation would be with the Linux driver (it is probably GPL, so you can't copy code from it, but you can read it and learn from it). As the OpenBSD driver is under BSD copyright, it would be perfectly legal to just copy it, but it wouldn't work at all, without a complete rewrite.

This is something that would be "easy" for an experienced driver developer, who understands USB and wireless (easy doesn't mean an hour or two, but the concepts would be understandable). It would be hard for a generic kernel developer. It would be virtually impossible for a generic user-space programmer. I won't even attempt to guess how long it would take; don't have enough kernel experience to make sensible estimates.

(You asked about my level of knowing Linux: I've been using Linux since about 1994 or 1995 (I can date it from which job I was working at), with kernel version 0.99.13. There is a little bit of code I have contributed to the Linux kernel, about that time; a few lines to fix an obscure SCSI card.)
 
What if I try to learn how to do it? You will help me?
If not, it doesn't matter: I can by myself.
Besides, I really want to make a program/diver/etc, something that could be used for me or I and others.
 
Sensucht94
Thanks, but you don't need to remind me that I was aggressive and offensive. You know how old I am, I know perfectly what I had done well either what I done bad.
Crivens Of course I can be much more offensive without using "bad words". And for your information, in that case, no one can ban me. I really don't know to offend, I don't need to write like a marine speaks in a tavern who have drink some beers. No.

StarBucks and your mac thats all what you need
 
What if I try to learn how to do it?
Start as follows:
Find an OS that has good support for this card (OpenBSD, Linux, whatever) and is open source. Install it and verify that it works. Download the source code. Read the driver for the card. This will require learning about the ToO (theory of operation) of USB and of 802.11. It also requires excellent C skills, and kernel programming skills.

Download the source code for FreeBSD. Find the driver that is closest to matching this card. I would start by looking at Adrian Chadd's blog, then send him an e-mail. Completely understand the driver, so perfectly that you are willing to modify it. Get a card that is supported by that driver without modifications, to use as a gold standard. Now for a practice exercise, without having to write a new driver, simply modify the driver for the existing card, like adding debug statements, or adding some new functionality (like support for 802.11n). Spend some time making sure you are comfortable doing kernel programming.

Once you are there, take all the ideas and algorithms from the other OS, and put them into a new FreeBSD driver for this card. I have no idea how long this step will take, but it depends massively on how experienced the person is. (Side remark: If you look at the software engineering literature, it is generally accepted that the productivity of software engineers varies by a factor of 10 from person to person and project to project. That's why schedule estimates for software are so difficult.)

Unfortunately, I can't help with this: I have never done any serious driver development, and never any FreeBSD kernel development (never even compiled a FreeBSD kernel). My only serious kernel work has been file systems, and then only Linux and closed-source operating systems.
 
ralphbsz
This will require learning about the ToO (theory of operation) of USB and of 802.11. It also requires excellent C skills, and kernel programming skills.
Exactly what I want. Can you tell me, if I study C++, it would be the same, or not?
 
Guys, I came to FreeBSD knowing what I should treat ;)
I didn't came to here looking for a "ubuntu" nor "winsh1t". I know EXACTLY what I'm dealing. This separates incompetents from experts ;)
You have only 1 option to survive and get success in *BSD: fight and win. If you can't fight or you give up, it's better that you get off ;)
 
Says someone who gets offended when someone tells him do his homework.
You had said it: do your homework. You know why I choose "apprentice" by my user name? Because I always been studying this system. And you: you know about it? Better: how much do you know about it?
 
On a NetBSD mailing list, there is interest in porting a Broadcom bcm43142 driver. http://mail-index.netbsd.org/netbsd-users/2018/04/29/msg020666.html

I realize it's a different OS and different hardware, but the goal is very much similar.

It doesn't matter: I'll give you a program, and you must follow a procedure to initialize it in a specific OS. Until here, everything's ok. Now, what you will do, if you haven't that system, but you have the program? You MUST know the procedure. Once you get the idea, adapt and modify it according to the system that you're using. A user, I think that he was ShelLuser , told me that it's a nice effort of memory memorize a few commands, but they will function for a few time. Then, you must go to the root: know where and how you can learn how to do the same.
That applies to what you give me: I don't have the OS neither the hardware. So, I must get what it's the procedure, commands, etc, and replicate 'em here with what I have. Do you get what I mean?
 
ralphbsz
Exactly what I want. Can you tell me, if I study C++, it would be the same, or not?
No.
When C++ is taught, the focus is typically on object-oriented analysis and design (also known as OOA&D). That is actually very important for engineering large projects, and the best way to create complex software that's known today. The important thing to learn there is how to express the class hierarchy and object relationships in the C++ language. While clearly the procedural basis of the language need to be part of knowing C++, that's typically not the emphasis in learning C++. Typically, that is taught in a C class.

For a typical software engineer, learning OOA&D is vitally important, as is learning engineering practices (such as source control, software process, testing, ...). Personally, I think that C++ is not the best language to learn these things (and not even the best language to implement most systems). But kernel device drivers are not a typical software engineering process; only a tiny fraction of all software engineering effort goes into kernels, and much of that isn't even device drivers.

A kernel device driver is not a large software project, and it is constrained by the interfaces that the kernel proscribes for device drivers, which are not really object oriented. Furthermore, the FreeBSD (and Linux and OpenBSD ...) kernels are written in straight non-object-oriented C, not in C++. So learning C++ misses the goal.

In reality, the problem of writing a device drivers is really elsewhere. The first single largest task is to learn about the problem domain: How does USB work? How are USB messages passed around, what is their content and semantics? How is error handling done? The second task is to learn about 802.11: how are packets send and received, what are all the complex settings and parameters of a device, how are wireless connections established and managed? I would think that about 70% of the knowledge required to write a driver for this chip is to learn the basics of USB and wireless, and the exact interfaces of this chip. The next 20% of the task is learning how to function in the somewhat unusual software development environment of the kernel, which has unusual memory management, debugging facilities, and interesting restrictions. Only the last 10% are learning mastery of C.
 
In FreeBSD things get slow but very slow, be patient, after another 10 years will write a driver for this chip.
That's not really a fair comment to make in my opinion. You're talking here as if we're dealing with this big bad organization which can't be bothered to do this but that is a completely false depiction of this situation.

Fact of the matter is that anyone can pick up this problem, start coding and then present their solution as a PR with a request to have it included with the official source tree. And trust me: if it's a good solution you can bet that it'll be included.

Heck, if you feel so strong about this then have a go at it yourself. The FreeBSD developers handbook gives you a full overview on how the development process works, how the source tree is connected together and gives a good explanation on the OS basics such as socket handling, kernel architecture and it even gives a rough impression on how you'd set up a driver.

The full source code (not just the kernel, but the whole OS) is also merely one checkout away so....

All the tools you might need are already in place.

Well, we both know that this isn't going to happen and there also lies the problem. FreeBSD, as an organization, is depending on programmers who are familiar enough with the hardware and motivated enough to actually code a driver for it. But it is depending on good will, it does not have enough resources to task or hire people to develop support for specific hardware "just because".

Which indeed means that sometimes a driver is never going to get developed and you'll never be able to use certain hardware on FreeBSD. Sucks, for sure, but that's the way it is.

Yet it has nothing to do with people being unwilling to help yet more so with being unable to.

Never forget that no one gets paid for doing what they do, in the end this is one huge voluntary effort. And I get the impression that some people sometimes totally ignore that.
 
Back
Top