# Manually Backporting Drivers?



## Shadow53 (Apr 6, 2019)

My laptop uses the RTL8188EE chipset for WiFi, which recently landed support in FreeBSD with this commit.

I'd like to be able to use this new driver on my laptop while remaining as close to a "stable" system as possible. What's the best way to go about doing this? I'm not sure if the driver currently only exists in 13-CURRENT or if its been backported to 12-STABLE, if I can fairly easily build it into a 12.0-RELEASE system by compiling the kernel from source, or what.

I don't really have the time to constantly tinker with a system that can crash on me at any moment (I'm a student in college), so staying as close to an official release as possible is important for me. I'm willing to put in some work at the beginning to get things working, though.


----------



## tingo (Apr 6, 2019)

An easy (for some values of "easy") way to test if it works:
0. download source for the FreeBSD version you are running
1. build world per the procedure in the handbook (to verify that you have a working setup)
2. add the necessary patches and files from the commit in question
3. perform the 'make kernel' step of build world - if it succeeds, proceed with next step
4. test the new kernel, and see if your network chip works

If it doesn't go back to the previous kernel.


----------



## Phishfry (Apr 6, 2019)

I would put this at the top of my list: Contact Farhan and ask him if there are any blockers to adding this to earlier versions.
Might save you some legwork.

Also I see MFC - 4 days.
What does that mean exactly? Will it 'Merge from Current' to FreeBSD12 Stable In 4 days time?


----------



## Phishfry (Apr 6, 2019)

Looking here I was on the right path:
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/freebsd-glossary.html#mfc-glossary

So I would recommend you start at FreeBSD Stable for this task.

Side question:
Are these Merges automatic or is there a revision version for the merge to Stable??
In other words is there a way to tell if this was merged to Stable?


----------



## Shadow53 (Apr 6, 2019)

Phishfry said:


> In other words is there a way to tell if this was merged to Stable?



This gave me the idea to try manually browsing the SVN repository for 12-STABLE and found this commit. I did not find the same commit in 12.0-RELEASE, though, so it looks like I'd have to run 12-STABLE to get the new driver.



Phishfry said:


> I would put this at the top of my list: Contact Farhan and ask him if there are any blockers to adding this to earlier versions.
> Might save you some legwork.



I may do that.

Another question, then, is how safe is it to run a STABLE release? The handbook is careful to remind that it's still a development branch, just slower-moving than CURRENT. So is it similar to running, say, Arch Linux? Debian Testing or Unstable? More specifically, if I'm passively paying attention to the freebsd-stable and/or svn-src-stable-12 mailing lists, how likely is it my system will crash on me?


----------



## malavon (Apr 6, 2019)

I haven't tried this myself (never needed to use something from -STABLE), but if someone could hop in to verify feasability it'd be appreciated:

You might try compiling 12-STABLE and copy the module for your network card without installing the entire new kernel. Assuming the ABI is still compatible (very likely), 
I think this should actually just work. It's a bit hackish though, but that way you'd keep the RELEASE kernel with just an extra/modified driver.


----------



## Shadow53 (Apr 6, 2019)

malavon said:


> You might try compiling 12-STABLE and copy the module for your network card without installing the entire new kernel. Assuming the ABI is still compatible (very likely),
> I think this should actually just work. It's a bit hackish though, but that way you'd keep the RELEASE kernel with just an extra/modified driver.



That sounds like it would theoretically work, but I find myself wondering if mixing modules isn't asking for more trouble than running entirely 12-STABLE.

To be fair, running 12-STABLE sounds like a good way to give back to FreeBSD, so long as any odd issues don't interfere with me getting homework done for classes.


----------



## malavon (Apr 6, 2019)

Well, since you'd have to build 12-STABLE anyway I guess it's worth a shot. No need to replace more than strictly needed if it's stable.


----------



## rigoletto@ (Apr 7, 2019)

Shadow53 said:


> I did not find the same commit in 12.0-RELEASE



Just to clarify, there is no commits in -RELEASE after the release. The improvements/fixes from -STABLE are later merged to releng.


----------



## Phishfry (Apr 7, 2019)

rigoletto@ said:


> The improvements/fixes from -STABLE are later amerged to releng.


I thought the Stable merges would occur at the next point release not releng?

I thought releng was security patched releases.


----------



## Phishfry (Apr 7, 2019)

I need to ammend that. releng contains security patches and regular patches. Just not new drivers.
These drivers will hit in FreeBSD 12.1


----------



## Shadow53 (Apr 7, 2019)

Phishfry said:


> I need to ammend that. releng contains security patches and regular patches. Just not new drivers.
> These drivers will hit in FreeBSD 12.1



Looks like I'm going to try running 12-STABLE for a bit and, if the drivers work, eventually switch to using 12.1-RELEASE when it gets released.

Thanks everyone for helping me figure this out.


----------



## rigoletto@ (Apr 7, 2019)

In short, after a release everything went from -STABLE to releng until the next RELEASE, what include dot RELEASEs. But yeah, revisons (aka -pNUMBER) are not supposed to bring new features but fixes, mostly security ones.


----------



## PMc (Apr 7, 2019)

Shadow53 said:


> That sounds like it would theoretically work, but I find myself wondering if mixing modules isn't asking for more trouble than running entirely 12-STABLE.



The difficulty with mixing is: it it works, its fine, but if it does strange things, you just dont know if it happens because there is a flaw in it, or if it happens because of mixing. If you go for full -STABLE installation, then you can report flaws to the developers, and that may help all parties.
I was running my machines on -STABLE for long times without any problems. It is a matter of luck and it all depends on the very moment when you grab the sources: it may be something that is perfectly fine, or it may be something that is a bit unpleasant to operate.


----------

