Repository navigation
Expand file tree
/
Copy pathdkms.html
More file actions
358 lines (344 loc) · 21.7 KB
/
Copy pathdkms.html
File metadata and controls
358 lines (344 loc) · 21.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!DOCTYPE html>
<!--
(The MIT License)
Copyright (c) 2016 Kura
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<html lang="en">
<head id="head">
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="alternate" href="https://nekopy.github.io" hreflang="en" />
<link rel="dns-prefetch" href="https://nekopy.github.io">
<link rel="dns-prefetch" href="//code.getmdl.io">
<link rel="shortcut icon" href="https://nekopy.github.io/favicon.ico">
<title>Automatic Driver Building with DKMS</title>
</head>
<body>
<div class="eevee-layout mdl-layout mdl-js-layout mdl-color--grey-50">
<header class="eevee-header mdl-color--grey-50 mdl-color-text--grey-800"
itemscope itemtype="http://schema.org/WPHeader">
<div class="mdl-layout__header-row" id="top">
<div aria-expanded="false" role="button" tabindex="0"
class="mdl-layout__drawer-button mdl-color-text--accent eevee-mobile-button mdl-layout--small-screen-only">
<i class="material-icons"></i>
</div>
<span class="eevee-logo mdl-color-text--accent mdl-layout-title">
<h2>
<a href="https://nekopy.github.io" rel="bookmark"
title="stderr">
stderr
</a>
</h2>
</span>
<div class="mdl-layout-spacer" role="presentation"></div>
<nav class="eevee-nav mdl-navigation mdl-layout--large-screen-only"
itemscope itemtype="http://schema.org/SiteNavigationElement"
aria-label="Header navigation">
<a class="mdl-color-text--accent mdl-navigation__link"
href="https://github.com/nekopy" itemprop="url" rel="bookmark">
Profile
</a>
</nav>
</div>
</header>
<div class="eevee-mobile-header mdl-layout__drawer mdl-color--white"
aria-hidden="true">
<span class="mdl-layout-title">
<h2 class="eevee-mobile-logo mdl-color-text--accent">
stderr
</h2>
</span>
<div class="mdl-navigation mdl-color--white">
<nav class="eevee-nav mdl-navigation" itemscope
itemtype="http://schema.org/SiteNavigationElement"
aria-label="Header navigation">
<a class="mdl-color-text--accent mdl-navigation__link"
href="https://nekopy.github.io" itemprop="url" rel="bookmark">
Home
</a>
<a class="mdl-color-text--accent mdl-navigation__link"
href="https://github.com/nekopy" itemprop="url" rel="bookmark">
Profile
</a>
</nav>
</div>
</div>
<div class="eevee-ribbon mdl-color--primary-dark" role="presentation">
</div>
<main class="eevee-main mdl-layout__content">
<div class="eevee-container mdl-grid">
<div role="presentation"
class="mdl-cell mdl-cell--2-col mdl-cell--hide-tablet mdl-cell--hide-phone">
</div>
<div class="eevee-content mdl-color--white mdl-shadow--4dp mdl-color-text--grey-800 mdl-cell mdl-cell--8-col"
aria-label="Main content">
<article itemscope itemtype="http://schema.org/BlogPosting">
<meta itemprop="accessibilityControl" content="fullKeyboardControl">
<meta itemprop="accessibilityControl" content="fullMouseControl">
<meta itemprop="accessibilityControl" content="bookmarks">
<meta itemprop="accessibilityControl" content="captions">
<meta itemprop="accessibilityControl" content="alternativeText">
<meta itemprop="accessibilityControl" content="index">
<meta itemprop="accessibilityControl" content="readingOrder">
<meta itemprop="accessibilityControl" content="structuralNavigation">
<meta itemprop="accessibilityControl" content="tableOfContents">
<meta itemprop="accessibilityHazard" content="noFlashingHazard">
<meta itemprop="accessibilityHazard" content="noMotionSimulationHazard">
<meta itemprop="accessibilityHazard" content="noSoundHazard">
<meta itemprop="accessibilityAPI" content="ARIA">
<div itemprop="author" itemscope
itemtype="https://schema.org/Person" role="presentation">
<a href="https://nekopy.github.io/author/nekopy.html" class="hidden"
itemprop="url" role="presentation">
<span class="hidden" itemprop="name" role="presentation">
neko.py
</span>
</a>
</div>
<meta itemprop="keywords"
content="DKMS,linux,kernel modules,Fedora">
<meta itemprop="keywords" content="linux">
<div class="eevee-meta eevee-share">
<div class="mdl-layout-spacer"></div>
<div>
<ul class="social-share mdl-navigation">
<li class="social-share__link social-share__link--twitter">
<a href="https://twitter.com/intent/tweet?text=Automatic%20Driver%20Building%20with%20DKMS&url=https%3A//nekopy.github.io/dkms.html"
title="Share 'Automatic Driver Building with DKMS' on Twitter"
onclick="window.open(this.href, 'twitter-share', 'width=550,height=235'); return false;">
<i class="fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="social-share__link social-share__link--facebook">
<a href="https://www.facebook.com/sharer/sharer.php?u=https%3A//nekopy.github.io/dkms.html"
title="Share 'Automatic Driver Building with DKMS' on Facebook"
onclick="window.open(this.href, 'facebook-share', 'width=580,height=296'); return false;">
<i class="fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="social-share__link social-share__link--google-plus">
<a href="https://plus.google.com/share?url=https%3A//nekopy.github.io/dkms.html"
title="Share 'Automatic Driver Building with DKMS' on Google+"
onclick="window.open(this.href, 'google-plus-share', 'width=490,height=530');return false;">
<i class="fa fa-google" aria-hidden="true"></i>
</a>
</li>
<li class="social-share__link social-share__link--email">
<a href="mailto:?subject=Automatic%20Driver%20Building%20with%20DKMS&body=Automatic%20Driver%20Building%20with%20DKMS%20-%20https%3A//nekopy.github.io/dkms.html%0A%0AQuick%20intro%20to%20setting%20up%20DKMS%20for%20from-source%20kernel%20modules.' via email">
<i class="material-icons" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
<div class="eevee-article">
<div class="eevee-meta mdl-color-text--grey-500">
<time datetime="2017-03-03T22:22:00-08:00"
itemprop="datePublished">
Fri 03 March 2017
</time>
</div>
<h1 itemprop="name">
<a href="https://nekopy.github.io/dkms.html" rel="bookmark"
title="Permalink to 'Automatic Driver Building with DKMS'"
itemprop="url">
Automatic Driver Building with DKMS
</a>
</h1>
<section itemprop="articleBody" class="article-content">
<p>Moving to Fedora on my laptop has been a perpetual learning experience. About half a year ago my Windows install died and I wound up getting so mad I left for Fedora. </p>
<div class="highlight"><pre><span></span> <span class="s s-Atom">/:-------------:\</span> <span class="s s-Atom">neko@</span><span class="nf">catbox</span>
<span class="o">:-</span><span class="s s-Atom">------------------::</span> <span class="nv">OS</span><span class="s s-Atom">:</span> <span class="nv">Fedora</span> <span class="mi">25</span> <span class="nv">TwentyFive</span>
<span class="p">:-</span><span class="s s-Atom">----------/shhOHbmp---:\</span> <span class="nv">Kernel</span><span class="s s-Atom">:</span> <span class="s s-Atom">x86_64</span> <span class="nv">Linux</span> <span class="mf">4.9.12</span><span class="o">-</span><span class="mf">200.</span><span class="s s-Atom">fc25</span><span class="p">.</span><span class="s s-Atom">x86_64</span>
<span class="s s-Atom">/-----------omMMMNNNMMD</span> <span class="s s-Atom">---:</span> <span class="nv">Uptime</span><span class="s s-Atom">:</span> <span class="mi">3</span><span class="s s-Atom">h</span> <span class="mi">49</span><span class="nf">m</span>
<span class="o">:-</span><span class="s s-Atom">----------sMMMMNMNMP</span><span class="p">.</span> <span class="s s-Atom">---:</span> <span class="nv">Packages</span><span class="s s-Atom">:</span> <span class="mi">2423</span>
<span class="p">:-</span><span class="s s-Atom">----------:</span><span class="nv">MMMdP</span><span class="s s-Atom">-------</span> <span class="s s-Atom">---\</span> <span class="nv">Shell</span><span class="s s-Atom">:</span> <span class="s s-Atom">zsh</span> <span class="mf">5.2</span>
<span class="p">,</span><span class="s s-Atom">------------:</span><span class="nv">MMMd</span><span class="s s-Atom">--------</span> <span class="s s-Atom">---:</span> <span class="nv">Resolution</span><span class="s s-Atom">:</span> <span class="mi">3600</span><span class="nf">x1080</span>
<span class="o">:-</span><span class="s s-Atom">-----------:</span><span class="nv">MMMd</span><span class="s s-Atom">-------</span> <span class="p">.</span><span class="s s-Atom">---:</span> <span class="nv">WM</span><span class="s s-Atom">:</span> <span class="nf">i3</span>
<span class="o">:-</span><span class="s s-Atom">---</span> <span class="s s-Atom">oNMMMMMMMMMNho</span> <span class="p">.</span><span class="s s-Atom">----:</span> <span class="nv">CPU</span><span class="s s-Atom">:</span> <span class="nv">Intel</span> <span class="nv">Core</span> <span class="s s-Atom">i7</span><span class="o">-</span><span class="mi">4800</span><span class="nv">MQ</span> <span class="nv">CPU</span> <span class="s s-Atom">@</span> <span class="mf">3.7</span><span class="nv">GHz</span>
<span class="p">:-</span><span class="o">-</span> <span class="p">.</span><span class="o">+</span><span class="s s-Atom">shhhMMMmhhy++</span> <span class="p">.</span><span class="s s-Atom">------/</span> <span class="nv">GPU</span><span class="s s-Atom">:</span> <span class="nv">Gallium</span> <span class="mf">0.4</span> <span class="s s-Atom">on</span> <span class="nv">NVE6</span>
<span class="p">:-</span> <span class="s s-Atom">-------:</span><span class="nv">MMMd</span><span class="s s-Atom">--------------:</span> <span class="nv">RAM</span><span class="s s-Atom">:</span> <span class="mi">1529</span><span class="nv">MiB</span> <span class="o">/</span> <span class="mi">15970</span><span class="nv">MiB</span>
<span class="p">:-</span> <span class="s s-Atom">--------/</span><span class="nv">MMMd</span><span class="s s-Atom">-------------</span><span class="p">;</span>
<span class="p">:-</span> <span class="s s-Atom">------/hMMMy------------:</span>
<span class="p">:-</span><span class="o">-</span> <span class="s s-Atom">:dMNdhhdNMMNo------------</span><span class="p">;</span>
<span class="p">:-</span><span class="s s-Atom">--:</span><span class="nf">sdNMMMMNds</span><span class="o">:-</span><span class="s s-Atom">-----------:</span>
<span class="p">:-</span><span class="s s-Atom">-----:://:-------------::</span>
<span class="p">:-</span><span class="s s-Atom">--------------------://</span>
</pre></div>
<p>Since then I've never looked back. I'm set up to dual-boot with windows, so I still have my games if need be. However one of the biggest issues I had was the incompatiblity of my internal wireless card with available drivers. Instead, I wound up buying myself a usb wireless adapter, which is a pretty mean motherfucker, but it needed me to build the kernel module from source. </p>
<p>With fedora I get very frequent updates to my kernel, however, and this means very frequently I'll boot up and have no internet, because lo and behold, the kernel updated and I need to rebuild my driver. Oh and it doesnt play nice with NetworkManager either. I had to get down and dirty with nm-cli, but that's a story for another day.</p>
<p>So today I finally sucked it up and learned how to use DKMS. What DKMS will do (and I always confuse it with DPKG) is automatically rebuild your kernel modules from source when the kernel upgrades.</p>
<p>Setting it up was extremely simple. I followed a simple tutorial, with only slight modifications.</p>
<p>First off, copy your kernel source to a new folder under /usr/src</p>
<div class="highlight"><pre><span></span>su
mkdir /usr/src/rtl8814AU-4.3.21
cp -R ~/rtl8814AU/* /usr/src/rtl8814AU-4.3.21
</pre></div>
<p>Where the folder you make is in $(module-name)-$(module-version) format. Then we're gonna add a dkms.conf file at the top level of that folder, and fill it with the appropriate content:</p>
<div class="highlight"><pre><span></span><span class="na">PACKAGE_NAME</span><span class="o">=</span><span class="s">"rtl8814AU"</span>
<span class="na">PACKAGE_VERSION</span><span class="o">=</span><span class="s">"4.3.21"</span>
<span class="na">BUILT_MODULE_NAME[0]</span><span class="o">=</span><span class="s">"8814au"</span>
<span class="na">DEST_MODULE_LOCATION[0]</span><span class="o">=</span><span class="s">"/kernel/drivers/net/wireless/"</span>
<span class="na">MAKE[0]</span><span class="o">=</span><span class="s">"make -j12"</span>
<span class="na">AUTOINSTALL</span><span class="o">=</span><span class="s">"yes"</span>
</pre></div>
<p>Probably the most interesting thing going on here is the value of the MAKE[0] key. This is the command that's gonna be called when DKMS enters your module directory to build up your stuff. In my case, the makefile already has everything it needs to build itself. (Except for two lines being backwards which broke DKMS building... in an 1800 line Makefile... took hours to isolate and fix). By default, DKMS will want to build your project with as many jobs as you have cores. Obviously, I know better than the DKMS authors, and the magic job number is 1.5 times the number of cores you have. In my case, that gives us -j12.</p>
<p>Once all that's set, just add that sucker to DKMS with</p>
<div class="highlight"><pre><span></span>dkms add -m rtl8814AU -v <span class="m">4</span>.3.21
</pre></div>
<p>and test building...</p>
<div class="highlight"><pre><span></span>dkms build -m rtl8814AU -v <span class="m">4</span>.3.21
dkms status
</pre></div>
<p>It's about 2am now. Hopefully next time my kernel builds i wont be totally boned. I'll have to post here to update if I am.</p>
</section>
</div>
</article>
</div>
</div>
</main>
<div class="eevee-pagination__container eevee-container mdl-grid">
<div role="presentation"
class="mdl-cell mdl-cell--2-col mdl-cell--hide-tablet mdl-cell--hide-phone">
</div>
<div class="mdl-color-text--grey-800 mdl-cell mdl-cell--8-col">
<nav class="eevee-pagination mdl-cell mdl-cell--12-col" itemscope
itemtype="http://schema.org/SiteNavigationElement"
aria-label="Pagination">
<div class="eevee-spacer"></div>
</nav> </div>
</div>
<footer class="mdl-mega-footer" itemscope
itemtype="http://schema.org/SiteNavigationElement">
<div class="mdl-mega-footer--top-section">
<div class="mdl-mega-footer--drop-down-section">
<ul class="mdl-mega-footer--link-list">
<li>
<a href="#top" itemprop="url"
title="Back to the top of the page">
Back to the top of the page
</a>
</li>
</ul>
</div>
</div>
<div class="mdl-mega-footer--middle-section" itemscope
itemtype="http://schema.org/SiteNavigationElement"
aria-label="Footer navigation">
<div class="mdl-mega-footer--drop-down-section">
<h1 class="mdl-mega-footer--heading">Menu</h1>
<ul class="mdl-mega-footer--link-list">
<li>
<a href="https://github.com/nekopy" itemprop="url" rel="bookmark">
Profile
</a>
</li>
</ul>
</div>
<div class="mdl-mega-footer--drop-down-section">
<h1 class="mdl-mega-footer--heading">Categories</h1>
<ul class="mdl-mega-footer--link-list">
<li>
<a href="https://nekopy.github.io/category/linux.html" itemprop="url"
rel="bookmark">
linux
</a>
</li>
<li>
<a href="https://nekopy.github.io/category/misc.html" itemprop="url"
rel="bookmark">
misc
</a>
</li>
<li>
<a href="https://nekopy.github.io/category/web-analysis.html" itemprop="url"
rel="bookmark">
Web Analysis
</a>
</li>
</ul>
</div>
<div class="mdl-mega-footer--drop-down-section">
<h1 class="mdl-mega-footer--heading">Social</h1>
<ul class="mdl-mega-footer--link-list">
<li>
<a href="https://discord.gg/Baka" itemprop="url" rel="bookmark">
Bakabot Discord
</a>
</li>
</ul>
</div>
<div class="mdl-mega-footer--drop-down-section">
<h1 class="mdl-mega-footer--heading">Links</h1>
<ul class="mdl-mega-footer--link-list">
<li>
<a href="http://getpelican.com/" itemprop="url" rel="bookmark">
Pelican
</a>
</li>
<li>
<a href="https://www.eff.org/" itemprop="url" rel="bookmark">
EFF
</a>
</li>
<li>
<a href="https://fsf.org/" itemprop="url" rel="bookmark">
The Free Software Foundation
</a>
</li>
<li>
<a href="https://creativecommons.org/" itemprop="url" rel="bookmark">
Creative Commons
</a>
</li>
</ul>
</div>
</div> <div class="mdl-mega-footer--bottom-section">
<div class="mdl-logo">
<a href="https://nekopy.github.io" rel="bookmark" itemprop="url"
title="stderr">
stderr
</a>
</div>
<ul class="eevee-footer mdl-mega-footer--link-list">
<li>Powered by love & rainbow sparkles.</li>
<li><a href="https://kura.io/eevee/" title="Eevee">Eevee</a> theme by <a href="https://kura.io/" title="kura.io">kura.io</a></li>
<li>
<iframe src="https://keroserene.net/snowflake/embed.html" width="88" height="16" frameborder="0" scrolling="no"></iframe>
</li>
</ul>
</div>
</footer>
</div>
<link rel="stylesheet"
href="//code.getmdl.io/1.1.3/material.blue_grey-indigo.min.css">
<link rel="stylesheet" type="text/css"
href="https://nekopy.github.io/theme/css/font-awesome.css">
<link rel="stylesheet" type="text/css"
href="https://nekopy.github.io/theme/css/material-icons.css">
<link rel="stylesheet" type="text/css"
href="https://nekopy.github.io/theme/css/pygments.css">
<link rel="stylesheet" type="text/css"
href="https://nekopy.github.io/theme/css/eevee.css">
<link rel="stylesheet" type="text/css"
href="https://nekopy.github.io/theme/css/custom.css">
<script async src="https://nekopy.github.io/theme/js/material.js">
</script>
</body>
</html>