USB-c on CentOS7 ?

A few years ago (when I started work at TSOHost) I was given a Dell Notebook to use as my workstation which came with a few gadgets including a USB-c dock. To my surprise this notebook came with Ubuntu Linux (which as you might have figured out is not my thing because i’m a Gentoo Linux kind of person) so within minutes of receiving the thing I was installing Fedora Core on it. (needed a rpm / systemd based distro running on it because most companies use CentosOS / RHEL / Suse on their servers and this one is no exception to this “rule”).

After installing everything I discovered that the USB-c doc I had worked BUT some stuff on it did not (for example I was unable to use the HDMI ports on the dock as well as the ones available on the notebook itself). Did not really give it much thought at that time and continued using the notebook like that for a while.

Now I got my hands on a newer generation of Dell Notebooks and wanted to have it running almost like a server (to test all sorts of crazy setups locally and once I have something working simply roll it out on stating environments as close to production as possible) so I decided to install CentOS7 on it this time.

After installing the OS on it I discovered nothing worked on USB-c and knew this was due to the old crappy kernel it comes with by default (fucking 3.x!)

Being a Gentoo Linux kind of person I knew I could always do things the Gentoo way – install latest LTS from sources – and that is what I did next.

Grabbed latest LTS kernel i could get my hands on at that time

wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.34.tar.xz

unpacked it in /usr/src/kernels (to keep things as close to the way shit is done on this Linux distro)

tar xf linux-4.19.34.tar.xz

tinkered with its configuration (added a ton of drivers including USB-c stuff, added netfilter stuff, added all sorts of drivers for network cards and other gadgets) by running

make menuconfig

(the kernel config file for the curious and brave is here: https://cristian.seceleanu.co.uk/config/ ) then I saved the config and installed the required development tools to be able to compile stuff

yum groupinstall “Development Tools” and yum install ncurses-devel

then started compiling the kernel

make -j12 bzimage

make -j12 modules

make

make install

make modules_install

If you’re asking yourselves why i used -j12 answer is because i could!

When this process was complete (kernel compiled successfully) i ran the mighty grub command to add it to my boot menu

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

and rebooted the notebook.

To my surprise it booted ok and not only that, USB-c magically started working as it was designed to.

I’m certain that there may be some obscure repos out there which when used one could simply do a yum install kernel and get a recent enough version of a running kernel that covers this and much more BUT then – after trying a few of them and discovering that they either break some stuff or make the machine unstable – why not simply diy?

My “motto” when using Linux is: if shit is not there by default just get it there!


Posted

in

by

Tags: