Compiling new driver - is there a best practices place to put the files?

Hello,

I have added a new card to my computer (Centon InifiniTV 6) and I had to download and compile a driver. So far I have source code files in /opt/ceton_infinitv_linux_driver.

Is there a better place to put these driver files?
Maybe if setup correctly they’ll get compiled automatically when needed. Is there a way to do that?

Thanks,
Reg

On 2015-05-04 10:16, Reg gie wrote:
>
> Hello,
>
> I have added a new card to my computer (Centon InifiniTV 6) and I had to
> download and compile a driver. So far I have source code files in
> /opt/ceton_infinitv_linux_driver.
>
> Is there a better place to put these driver files?

Typically, you place the source files somewhere in your home. Say
/home/myname/mysources/cetondriver. It really makes no difference.
It is the result of building the driver that has to be copied to a
precise place.

> Maybe if setup correctly they’ll get compiled automatically when needed.
> Is there a way to do that?

No, not that easy.

The driver you downloaded surely contains instructions. And you will
find another set of instructions in the kernel sources, something like
readme.suse (I don’t have them in this laptop, can’t verify). You have
to read the instructions.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

I didn’t know about the instructions for the kernel sources, I of course followed the instructions to get the driver installed.

It seems strange that sources would go in an individual’s home directory. It seems to me that if you are compiling something to the kernel then it’s a global type thing you are doing so you would want to put the files in a global type place, not in an individual’s area.

Oh well, in /opt I guess is good enough then.

Sources are not part of the binary and generally not done as root. Installing is done as root and has to go to the proper locations. You could delete the source one the object is created and installed it is no longer needed for purposes of running.

On 2015-05-05 04:46, Reg gie wrote:
>
> I didn’t know about the instructions for the kernel sources, I of course
> followed the instructions to get the driver installed.
>
> It seems strange that sources would go in an individual’s home
> directory. It seems to me that if you are compiling something to the
> kernel then it’s a global type thing you are doing so you would want to
> put the files in a global type place, not in an individual’s area.

Yes, because it is you, a user, who builds the sources. You should not
do it as root.

And once you build the driver, the sources are not used by the system at
all. The binary that you built will go to
/lib/modules/kernelversion/somewhere.

> Oh well, in /opt I guess is good enough then.

/opt is normally formatted or erased completely when you install the
next release, whereas /home is not. You would lose the sources and your
adjustments, if any.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

When you use /opt for the source, you still have to use root for building. That is not a good idea.

Building should be done in user space, simply because it can be done in user space. The rule is: when you do not need root for something, do not do it as root.

I can imagine that you hesitate to put those sources you need for the system in the home directory of a user that only wants do use the system as end-user: banking, browsing, play music, whatever.

Then you better create a new user, just for the purpose of doing system management things that do not need root. It is a very good practice to create different users for different roles. E.g. when you are secretary of a club, you will want to separate that role from your personal data. Thus create a user for it. Like you will create a user for your wife if she also needs to use the system.

Unix/Linux systems are multi user systems. Take advantage of that.

On 2015-05-05 17:06, hcvv wrote:

> Then you better create a new user, just for the purpose of doing system
> management things that do not need root. It is a very good practice to
> create different users for different roles. E.g. when you are secretary
> of a club, you will want to separate that role from your personal data.
> Thus create a user for it.

Good point!


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

Setting up a user just for this purpose sounds like the right way to go. Thanks!