This repository has been archived by the owner on Nov 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
2595 lines (1861 loc) · 125 KB
/
index.html
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Linux geek's scratchpad</title>
<meta name="author" content="">
<meta name="description" content="January 23th Espressif published new ESP IOT SDK on their forum
v0.9.5. My ESP-12 came with
with pretty old version so I decide to update it to …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://pietrushnic.github.io">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="Linux geek's scratchpad" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Fjalla+One' rel='stylesheet' type='text/css'>
<!-- Add fancyBox -->
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39420295-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- AddThis Smart Layers BEGIN -->
<!-- Go to http://www.addthis.com/get/smart-layers to customize -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-534acd39445ac552"></script>
<script type="text/javascript">
addthis.layers({
'theme' : 'gray',
'share' : {
'position' : 'left',
'numPreferredServices' : 5
},
'follow' : {
'services' : [
{'service': 'facebook', 'id': 'piotr.krol.756859'},
{'service': 'twitter', 'id': 'pietrushnic'},
{'service': 'linkedin', 'id': 'krolpiotr'},
{'service': 'google_follow', 'id': '115979497998056410813'}
]
},
'whatsnext' : {},
'recommended' : {}
});
</script>
<!-- AddThis Smart Layers END -->
</head>
<body class="collapse-sidebar sidebar-footer" >
<header role="banner"><hgroup>
<h1><a href="/">Linux geek's scratchpad</a></h1>
<h2>or embedded dreams about productivity, freedom and liberty</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:pietrushnic.github.io" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
<li><a href="/about">About me</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2015/01/25/esp-12-upgrade-to-esp-iot-sdk-v0-dot-9-5-using-esp-open-sdk-toolchain/">ESP-12 update to SDK v0.9.5 and AT v0.21.0.0 - noobs tutorial</a></h1>
<p class="meta">
<time datetime="2015-01-25T22:32:01+01:00" pubdate data-updated="true">Jan 25<span>th</span>, 2015</time>
| <a href="/blog/2015/01/25/esp-12-upgrade-to-esp-iot-sdk-v0-dot-9-5-using-esp-open-sdk-toolchain/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>January 23th Espressif published new ESP IOT SDK on their forum
<a href="http://bbs.espressif.com/viewtopic.php?f=5&t=154">v0.9.5</a>. My ESP-12 came with
with pretty old version so I decide to update it to latest one:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>AT+RST
</span><span class='line'>
</span><span class='line'>OK
</span><span class='line'>y_RSöfJ[úndor:www.ai-thinker.com Version:0.9.2.4]
</span><span class='line'>
</span><span class='line'>ready
</span><span class='line'>AT+GMR
</span><span class='line'>0018000902-AI03
</span><span class='line'>
</span><span class='line'>OK</span></code></pre></td></tr></table></div></figure>
<h2>ESP-12 firmware update pin configuration</h2>
<p><a class="fancybox" rel="group" href="/assets/images/esp-12-update.jpg"><img src="/assets/images/esp-12-update.jpg" alt="" /></a></p>
<p>As picture presents in addition to normal operation we have to pull down GPIO0
and pull up GPIO2.</p>
<h2>Upgrade using binaries from Espressif</h2>
<p>To upgrade you can use binaries that where delivered in zip packaged and python <a href="">esptool</a>. Run following commands:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git clone [email protected]:themadinventor/esptool.git
</span><span class='line'>wget --content-disposition "http://bbs.espressif.com/download/file.php?id=189"
</span><span class='line'>unzip esp_iot_sdk_v0.9.5_15_01_23.zip
</span><span class='line'>cd esp_iot_sdk_v0.9.5/bin
</span><span class='line'>../../esptool/esptool.py write_flash 0x00000 boot_v1.2.bin 0x01000 at/user1.512.new.bin 0x3e000 blank.bin 0x7e000 blank.bin</span></code></pre></td></tr></table></div></figure>
<p>First we clone <code>esptool</code> repository, then we get latest SDK release directly
from forum and finally we ran <code>esptool</code>.</p>
<p>If you will get something like this:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>Connecting...
</span><span class='line'>Traceback (most recent call last):
</span><span class='line'> File "../../esptool/esptool.py", line 408, in <module>
</span><span class='line'> esp.connect()
</span><span class='line'> File "../../esptool/esptool.py", line 143, in connect
</span><span class='line'> raise Exception('Failed to connect')
</span><span class='line'>Exception: Failed to connect</span></code></pre></td></tr></table></div></figure>
<p>You can work around this by toggling power to the module right before executing
<code>esptool</code> command. It works on my side.</p>
<p>Successful flashing looks like this:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>[1:00:21] pietrushnic:bin $ ../../esptool/esptool.py write_flash 0x00000 boot_v1.2.bin 0x01000 at/user1.512.new.bin 0x3e000 blank.bin 0x7e000 blank.bin
</span><span class='line'>Connecting...
</span><span class='line'>Erasing flash...
</span><span class='line'>Writing at 0x00000400... (100 %)
</span><span class='line'>Erasing flash...
</span><span class='line'>Writing at 0x00034800... (100 %)
</span><span class='line'>Erasing flash...
</span><span class='line'>Writing at 0x0003ec00... (100 %)
</span><span class='line'>Erasing flash...
</span><span class='line'>Writing at 0x0007ec00... (100 %)
</span><span class='line'>
</span><span class='line'>Leaving...</span></code></pre></td></tr></table></div></figure>
<p>After disconnecting GPIO0 and GPIO2 you can boot new firmware. Results should
look like this:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>AT+RST
</span><span class='line'>
</span><span class='line'>OK
</span><span class='line'>
</span><span class='line'> ets Jan 8 2013,rst cause:4, boot mode:(3,4)
</span><span class='line'>
</span><span class='line'>wdt reset
</span><span class='line'>load 0x40100000, len 816, room 16
</span><span class='line'>tail 0
</span><span class='line'>chksum 0x8d
</span><span class='line'>load 0x3ffe8000, len 788, room 8
</span><span class='line'>tail 12
</span><span class='line'>chksum 0xcf
</span><span class='line'>ho 0 tail 12 room 4
</span><span class='line'>load 0x3ffe8314, len 288, room 12
</span><span class='line'>tail 4
</span><span class='line'>chksum 0xcf
</span><span class='line'>csum 0xcf
</span><span class='line'>
</span><span class='line'>2nd boot version : 1.2
</span><span class='line'> SPI Speed : 40MHz
</span><span class='line'> SPI Mode : QIO
</span><span class='line'> SPI Flash Size : 4Mbit
</span><span class='line'>jump to run user1
</span><span class='line'>
</span><span class='line'>rNÿ
</span><span class='line'>ready
</span><span class='line'>AT+GMR
</span><span class='line'>AT version:0.21.0.0
</span><span class='line'>SDK version:0.9.5
</span><span class='line'>
</span><span class='line'>OK</span></code></pre></td></tr></table></div></figure>
<p>Of course you will need the toolchain to use new SDK.</p>
<h2>Toolchain</h2>
<p><a href="https://github.com/pfalcon/esp-open-sdk">esp-open-sdk</a> is probably easiest to
use toolchain that I found for ESP8266. <code>esp-open-sdk</code> puts together steps
created by <a href="http://www.esp8266.com/">ESP8266 Community Forum</a> published in
<a href="https://github.com/esp8266/esp8266-wiki/wiki">esp8266-wiki</a> repository.</p>
<p><code>esp-open-sdk</code> at the moment of writing this post didn’t support <code>v0.9.5</code> SDK,
but adding this support was pretty straight forward and can be found on my
github for of the <a href="https://github.com/pietrushnic/esp-open-sdk.git">repo</a>.
There is also <a href="https://github.com/pfalcon/esp-open-sdk/pull/18">pending PR</a> that hopefully will be merged.</p>
<p>Procedure is straight forward to follow:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git clone [email protected]:pietrushnic/esp-open-sdk.git #or use https with https://github.com/pietrushnic/esp-open-sdk.git
</span><span class='line'>cd esp-open-sdk
</span><span class='line'>git co v0.9.5-support
</span><span class='line'>sed -i -e '/\s0.9.4/s/^/#/g' -e '/\s0.9.5/s/^#//g' Makefile
</span><span class='line'>make</span></code></pre></td></tr></table></div></figure>
<p><code>sed</code> command will cause using <code>0.9.5</code> string as <code>VENDOR_SDK</code> for default build.</p>
<p>On my i7-4700 single threaded compilation takes ~20min. BTW I’m trying to
figure out why I cannot use multiple jobs
<a href="https://github.com/pfalcon/esp-open-sdk/issues/19">here</a>.</p>
<p>Final message should contain something like:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>export PATH=/home/pietrushnic/tmp/esp-open-sdk/xtensa-lx106-elf/bin:$PATH</span></code></pre></td></tr></table></div></figure>
<p>Just execute this command in your shell. If you missed that message run <code>make</code>
again it should skip all already compiled parts and display final message
again.</p>
<h2>Toolchain usage</h2>
<p>To use toolchain with example code from <code>v0.9.5</code> SDK you can simply:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cd esp_iot_sdk_v0.9.5 </span></code></pre></td></tr></table></div></figure>
<p>Use package like it was presented in “Upgrade using binaries from Espressif” section. Trying to compile exmaples in <code>esp-open-sdk</code> will give you error like this:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>../../Makefile:154: warning: overriding recipe for target 'clean'
</span><span class='line'>../Makefile:258: warning: ignoring old recipe for target 'clean'
</span><span class='line'>You cloned without --recursive, fetching submodules for you.
</span><span class='line'>git submodule update --init --recursive
</span><span class='line'>make -C crosstool-NG -f ../Makefile _ct-ng
</span><span class='line'>make[1]: *** crosstool-NG: No such file or directory. Stop.
</span><span class='line'>../../Makefile:140: recipe for target 'crosstool-NG/ct-ng' failed
</span><span class='line'>make: *** [crosstool-NG/ct-ng] Error 2</span></code></pre></td></tr></table></div></figure>
<p>When inside <code>esp_iot_sdk_v0.9.5</code>:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cp -r examples/at .
</span><span class='line'>make COMPILE=gcc</span></code></pre></td></tr></table></div></figure>
<p>Ommiting <code>COMPILE=gcc</code> will result in error caused by using differen compiler name:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>make[1]: Entering directory '/home/pietrushnic/src/espressif/esp_iot_sdk_v0.9.5/at/user'
</span><span class='line'>DEPEND: xt-xcc -M -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c
</span><span class='line'>/bin/sh: 2: xt-xcc: not found
</span><span class='line'>xt-xcc -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle -o .output/eagle/debug/obj/user_main.o -c user_main.c
</span><span class='line'>make[1]: xt-xcc: Command not found
</span><span class='line'>../../Makefile:280: recipe for target '.output/eagle/debug/obj/user_main.o' failed
</span><span class='line'>make[1]: *** [.output/eagle/debug/obj/user_main.o] Error 127
</span><span class='line'>make[1]: Leaving directory '/home/pietrushnic/src/espressif/esp_iot_sdk_v0.9.5/at/user'
</span><span class='line'>../Makefile:266: recipe for target '.subdirs' failed
</span><span class='line'>make: *** [.subdirs] Error 2</span></code></pre></td></tr></table></div></figure>
<p>Correct output looks like this:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>make[1]: Entering directory '/home/pietrushnic/src/espressif/esp_iot_sdk_v0.9.5/at/user'
</span><span class='line'>DEPEND: xtensa-lx106-elf-gcc -M -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle user_main.c
</span><span class='line'>xtensa-lx106-elf-gcc -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ../../include -I ../../include/eagle -o .output/eagle/debug/obj/user_main.o -c user_main.c
</span><span class='line'>xtensa-lx106-elf-ar ru .output/eagle/debug/lib/libuser.a .output/eagle/debug/obj/user_main.o
</span><span class='line'>xtensa-lx106-elf-ar: creating .output/eagle/debug/lib/libuser.a
</span><span class='line'>make[1]: Leaving directory '/home/pietrushnic/src/espressif/esp_iot_sdk_v0.9.5/at/user'
</span><span class='line'>xtensa-lx106-elf-gcc -L../lib -nostdlib -T../ld/eagle.app.v6.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lc -lgcc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lmain -ljson -lupgrade user/.output/eagle/debug/lib/libuser.a -lat -Wl,--end-group -o .output/eagle/debug/image/eagle.app.v6.out
</span><span class='line'>
</span><span class='line'>!!!
</span><span class='line'>No boot needed.
</span><span class='line'>Generate eagle.flash.bin and eagle.irom0text.bin successully in folder bin.
</span><span class='line'>eagle.flash.bin-------->0x00000
</span><span class='line'>eagle.irom0text.bin---->0x40000
</span><span class='line'>!!!</span></code></pre></td></tr></table></div></figure>
<p>Now <code>../bin</code> directory contain <code>eagle.flash.bin</code> and <code>eagle.irom0text.bin</code>,
which you can use to flash your ESP8266 using <code>esptool</code>:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>../../esptool/esptool.py write_flash 0x00000 eagle.flash.bin 0x40000 eagle.irom0text.bin</span></code></pre></td></tr></table></div></figure>
<h2>Summary</h2>
<p>Thanks for reading. Hope that this post fill the gap that some of beginner can
experience when goolging through straight forward tutorial about playing with
ESP. If you like this post please share. If you see some bias or you just want
to share some facts, ask question then please leave a comment.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2015/01/24/power-on-of-esp-12/">Power on of ESP-12 (ESP8266)</a></h1>
<p class="meta">
<time datetime="2015-01-24T00:25:05+01:00" pubdate data-updated="true">Jan 24<span>th</span>, 2015</time>
| <a href="/blog/2015/01/24/power-on-of-esp-12/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>ESP8266 is a SoC made by <a href="https://espressif.com">Espressif</a>. For last couple of
months this chip is a rockstar of <a href="http://hackaday.com/">HackADay</a> and makers
community around the Internet. Mostly because of WiFi modules built based on it
(ESP-XX family). Rich interface (GPIO, SPI, SDIO, I2C) give those boards
potential to be standalone MCU with WiFi capability for wide range of
applications. In quantity you can get ESP-01 for $2.7 (for 1kpcs). Of course
there is no free lunch. Documentation is weak (this is no TI), but
<a href="http://www.esp8266.com/">community</a> doing it’s best to change this state.
Native interface of AT commands is also not the friendliest way of
communicating by beginners. But also for that market found solution – namely
<a href="https://github.com/nodemcu/nodemcu-firmware">NodeMCU</a>.</p>
<p>A while ago I bought ESP-01 and experiment a little bit with it. I quickly
realize that to release additional powers from this module I need access to
other pins. ESP-01 expose only 2 GPIOs newer versions of the board provide more
and more. Of course there was a way to hack ESP-01, but using latest version
usually provide better feature set. Latest version known to wide public is
ESP-12 which expose ADC and 9 GPIO pins. Finally I took in possession couple of
them.</p>
<h2>Soldering</h2>
<p>Because this board came in SMD package I found that
<a href="http://www.electrodragon.com/">ElectroDragon</a> provides also adapter to solder
module and easily expose pins.</p>
<p><a class="fancybox" rel="group" href="/assets/images/esp-12-adapter.jpg"><img src="/assets/images/esp-12-adapter.jpg" alt="" /></a></p>
<p>After applying my soldering-fu I get rewarding result.</p>
<p><a class="fancybox" rel="group" href="/assets/images/esp-12-soldered.jpg"><img src="/assets/images/esp-12-soldered.jpg" alt="" /></a></p>
<h2>Wiring</h2>
<p>ESP-12 adapter from ElectroDragon got width of 31mm and pin distance match
ideally to prototype board. There is only one problem that adapter width put
pins into first and last column of the standard 10 column (A-J) breadboard.
Which give no ability to connect parallel wires, which was my initial idea.
Because I didn’t have u shape solderless jumpers to make connection clean I
splitted old Ethernet cable and get this:</p>
<p><a class="fancybox" rel="group" href="/assets/images/u-shape-jumpers.jpg"><img src="/assets/images/u-shape-jumpers.jpg" alt="" /></a></p>
<p><a class="fancybox" rel="group" href="/assets/images/esp-12-breadboard.jpg"><img src="/assets/images/esp-12-breadboard.jpg" alt="" /></a></p>
<p>Check connections couple of time to make sure that everything works fine. As
USB UART I used FT232RL based module. Current provided by USB UART module can
be insufficient that’s why I used lab DC power supply.</p>
<p>NOTE: Both ESP-12 and USB UART should be connected to the same GND.</p>
<h2>Power on</h2>
<p>It wasn’t simple. First I tried minicom with 115200 UART speed:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>minicom -b 115200 -o -D /dev/ttyUSB0</span></code></pre></td></tr></table></div></figure>
<p>This module display bootloader messages at 115200. After booting it switches to
9600. If you booted and can’t communicate but blue LED blinking when you type
this may indicate that you need reset try <code>AT+RST<Ctrl-M><Ctrl-J></code>. You
should get something like this:</p>
<p><a class="fancybox" rel="group" href="/assets/images/esp-12-minicom-1.png"><img src="/assets/images/esp-12-minicom-1.png" /></a></p>
<p>There are lot of other commands like <code>AT+GMR</code> which give you firmware version.
More commands you can find
<a href="http://wiki.iteadstudio.com/ESP8266_Serial_WIFI_Module#AT_Commands">here</a>. Not
every firmware support all commands. To use more robust firmware you can
compile latest version of AT command or even modify it according to your needs.
Some instructions can be found
<a href="https://github.com/esp8266/esp8266-wiki/wiki">here</a>.</p>
<h2>Summary</h2>
<p>I think that ESP8266 has great potential to make pressure on market and
squeeze better solutions. There is a lot of interesting things going on around
ESP like MQTT implementation of firmware or recently released FreeRTOS SDK
from Espressif. I hope to write more about ESP-12 in future. If you think this
post was useful please leave a comment or share with friends.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/10/15/raspberry-pi-kernel-repository-aggregating-patches-for-linux-mainline/">Raspberry Pi kernel repository aggregating patches for Linux mainline</a></h1>
<p class="meta">
<time datetime="2014-10-15T23:23:11+02:00" pubdate data-updated="true">Oct 15<span>th</span>, 2014</time>
| <a href="/blog/2014/10/15/raspberry-pi-kernel-repository-aggregating-patches-for-linux-mainline/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>Since several months I’m trying to find my way to embedded Linux programming.
My hardware set was very limited I had only one board that can be called
“embedded” and it was Raspberry Pi. Because I am more interested in firmware/OS
level then hardware I tried to figure out what is going on with RPi kernel.
After taking brief review of
<a href="https://github.com/raspberrypi/linux">raspberrypi/linux</a> GitHub repository I
realized that close to my heart is upstreaming effort. So with noob attitude I
contacted RPi Upstreaming wiki page author (<a href="https://github.com/notro">notro</a>)
and we started to create some foundation.</p>
<p><em>Disclaimer: These are for testing purposes and considered unstable. Use at your own risk.</em>
<em>Edit: 20/10/2014:</em> minor typo, clone instructions moved to “How to use it ?” section</p>
<h2>What we have now ?</h2>
<p>We created set of repositories to handle upstreaming process.</p>
<p>First there is <a href="https://github.com/pietrushnic/rpi-dt-linux.git">rpi-dt-linux</a>
it is Linux kernel based on
<a href="https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/">linux-stable</a>
with patches on top of every branch. This repository aims to aggregate all
patches required for Raspberry Pi support in upstream kernel. <code>rpi-dt-linux</code>
use <code>bcm2835_defconfig</code> with device tree support. We want to introduce every
driver that supports device tree. Right now a lot of stuff is missing, but I
will dive into it later.</p>
<p>After consulting with
<a href="https://github.com/raspberrypi/linux/issues/698">popcornmix</a> we decide to
rebase all patches to keep them on top of every branch. This of course mean
that repository will be broken, but patches will be more visible in history.</p>
<p>Second <a href="https://github.com/pietrushnic/rpi-dt-firmware">rpi-dt-firmware</a> is ready
to use firmware files for Raspberry Pi with already built modules and kernel.
If you are familiar with <a href="https://github.com/Hexxeh">Hexxeh</a>
<a href="https://github.com/Hexxeh/rpi-update">rpi-update</a> and his repository
<a href="https://github.com/Hexxeh/rpi-firmware">rpi-firmware</a> this should not be
anything new for you.</p>
<p>Third <a href="https://github.com/notro/rpi-bcm2835">rpi-bcm2835</a> which simplifies
build and release process of <code>rpi-dt-linux</code>.</p>
<h2>How to use it ?</h2>
<h2>User</h2>
<p>If you simply want to try new kernel on your RPi then install <code>rpi-update</code>, by:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo apt-get install rpi-update</span></code></pre></td></tr></table></div></figure>
<p>on Raspbian or follow instruction from
<a href="https://github.com/Hexxeh/rpi-update">Readme.md</a> for other distributions.</p>
<p>To install latest release of <code>rpi-dt-firmware</code> use <code>rpi-update</code> on RPi:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo REPO_URI=https://github.com/pietrushnic/rpi-dt-firmware rpi-update</span></code></pre></td></tr></table></div></figure>
<p>After update simply reboot your Pi and enjoy our upstream kernel :).</p>
<h2>Developer</h2>
<p>If you want to play with the code I have few hints that can help.</p>
<p>First please clone <code>rpi-dt-linux</code> and <code>rpi-bcm2835</code> mentioned above.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git clone https://github.com/pietrushnic/rpi-dt-linux.git
</span><span class='line'>git clone https://github.com/notro/rpi-bcm2835.git</span></code></pre></td></tr></table></div></figure>
<p>Then install <a href="https://github.com/notro/rpi-build">rpi-build</a> following
instructions on <a href="https://github.com/notro/rpi-build/wiki">wiki</a>. Then you can
do few things:</p>
<p>Build <code>rpi-dt-linux</code> locally. This will download latest snapshot of
<code>rpi-dt-linux</code> and other dependencies like <code>u-boot</code> and cross-compiler.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cd path/to/rpi-bcm2835
</span><span class='line'>rpi-build rpi-dt-linux clean build</span></code></pre></td></tr></table></div></figure>
<p>You can install already built kernel on your machine over ssh (replace
<code><RPI_IP></code> with your Pi IP address):</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rpi-build rpi-dt-linux install SSHIP=<RPI_IP></span></code></pre></td></tr></table></div></figure>
<p>If you want to use your own kernel repository just use <code>rpi-bcm2835</code> with local
path:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>RPI_DT_LINUX_LOCAL=../../rpi-dt-linux rpi-build rpi-dt-linux clean build</span></code></pre></td></tr></table></div></figure>
<p>NOTE: that additional level of <code>../</code> was added because rpi-build creates
workdir which is reference directory for it.</p>
<p>It is also possible to release your own firmware repository. To help with
process there are two commands:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>FW_REPO=/home/pietrushnic/src/rpi-dt-firmware FW_BRANCH=master rpi-build rpi-dt-linux commit
</span><span class='line'>FW_REPO=/home/pietrushnic/src/rpi-dt-firmware FW_BRANCH=master rpi-build rpi-dt-linux push</span></code></pre></td></tr></table></div></figure>
<p>Obviously <code>FW_REPO</code> is a directory with firmware git repository.</p>
<h2>Changelog</h2>
<p>At the point of writing this post there were 3 releases of <code>rpi-dt-firmware</code>. We
applied v10 of <a href="http://lwn.net/Articles/607424/">mailbox API</a> and Lubomir
Rintel <code>bcm2835-mbox</code>, <code>bcm2835-cpufreq</code> and <code>bcm2835-thermal</code> drivers from his
<a href="https://github.com/hackerspace/rpi-linux/commits/lr-raspberry-pi-new-mailbox">repository</a>.
All updates are published in
<a href="https://github.com/pietrushnic/rpi-dt-firmware/blob/master/README.md">README.md</a>
with every release.</p>
<h2>Summary</h2>
<p>Of course we are happy with every contribution small and big, critique and
process improvement hints. Let us know what you think about this effort.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/09/20/virtualbox-dkms-fix-alloc-netdev-problems-when-compiling-with-3-dot-17-dot-0-rcx-headers/">virtualbox-dkms: fix alloc_netdev problems when compiling with 3.17.0-rcX headers</a></h1>
<p class="meta">
<time datetime="2014-09-20T22:55:00+02:00" pubdate data-updated="true">Sep 20<span>th</span>, 2014</time>
| <a href="/blog/2014/09/20/virtualbox-dkms-fix-alloc-netdev-problems-when-compiling-with-3-dot-17-dot-0-rcx-headers/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><h2>Intro</h2>
<p>Because of my bug hunting approach of using latest kernel I experienced problem
with compiling VirtualBox modules with <code>3.17.0-rc5</code> version on my Debian Jessie. Issue is well
known and described for examples <a href="https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/1358157">here</a>.
Problem manifest itself with:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>------------------------------
</span><span class='line'>Deleting module version: 4.3.14
</span><span class='line'>completely from the DKMS tree.
</span><span class='line'>------------------------------
</span><span class='line'>Done.
</span><span class='line'>Loading new virtualbox-4.3.14 DKMS files...
</span><span class='line'>Building only for 3.17.0-rc5+
</span><span class='line'>Building initial module for 3.17.0-rc5+
</span><span class='line'>Error! Bad return status for module build on kernel: 3.17.0-rc5+ (x86_64)
</span><span class='line'>Consult /var/lib/dkms/virtualbox/4.3.14/build/make.log for more information.
</span><span class='line'>Job for virtualbox.service failed. See 'systemctl status virtualbox.service' and 'journalctl -xn' for details.
</span><span class='line'>invoke-rc.d: initscript virtualbox, action "restart" failed.</span></code></pre></td></tr></table></div></figure>
<p>during <code>virtualbox-dkms</code> package installation or reconfiguration. In <code>make.log</code> you will find compilation error:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
</pre></td><td class='code'><pre><code class=''><span class='line'> CC [M] /var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.o
</span><span class='line'>/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c: In function ‘vboxNetAdpOsCreate’:
</span><span class='line'>/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c:186:48: error: macro "alloc_netdev" requires 4 arguments, but only 3 given
</span><span class='line'> vboxNetAdpNetDevInit);
</span><span class='line'> ^
</span><span class='line'>/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c:184:15: error: ‘alloc_netdev’ undeclared (first use in this function)
</span><span class='line'> pNetDev = alloc_netdev(sizeof(VBOXNETADPPRIV),
</span><span class='line'> ^
</span><span class='line'>/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c:184:15: note: each undeclared identifier is reported only once for each function it appears in
</span><span class='line'>/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c: At top level:
</span><span class='line'>/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c:159:13: warning: ‘vboxNetAdpNetDevInit’ defined but not used [-Wunused-function]
</span><span class='line'> static void vboxNetAdpNetDevInit(struct net_device *pNetDev)
</span><span class='line'> ^
</span><span class='line'>scripts/Makefile.build:257: recipe for target '/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.o' failed
</span><span class='line'>make[2]: *** [/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.o] Error 1
</span><span class='line'>scripts/Makefile.build:404: recipe for target '/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp' failed
</span><span class='line'>make[1]: *** [/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp] Error 2
</span><span class='line'>Makefile:1373: recipe for target '_module_/var/lib/dkms/virtualbox/4.3.14/build' failed
</span><span class='line'>make: *** [_module_/var/lib/dkms/virtualbox/4.3.14/build] Error 2
</span><span class='line'>make: Leaving directory '/usr/src/linux-headers-3.17.0-rc5+'</span></code></pre></td></tr></table></div></figure>
<p>For sure we have to wait for some time before new version of kernel and
VirtualBox will catch up each other in Debian.</p>
<h2>Fix source code of Debian package</h2>
<p>Let’s get get virtualbox package source, fix issues rebuild package and install
in the system. Patch to apply can be found <a href="https://forums.virtualbox.org/viewtopic.php?p=296650#p296650">here</a>.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>apt-get source virtualbox-dkms
</span><span class='line'>cd virtualbox-4.3.14-dfsg</span></code></pre></td></tr></table></div></figure>
<p>Now we can patch the sources with:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
</pre></td><td class='code'><pre><code class='diff'><span class='line'><span class="gh">diff --git a/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c b/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c</span>
</span><span class='line'><span class="gh">index c6b21a9cc199..9ccce6f32218 100644</span>
</span><span class='line'><span class="gd">--- a/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c</span>
</span><span class='line'><span class="gi">+++ b/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c</span>
</span><span class='line'><span class="gu">@@ -52,6 +52,25 @@</span>
</span><span class='line'>
</span><span class='line'> #define VBOXNETADP_FROM_IFACE(iface) ((PVBOXNETADP) ifnet_softc(iface))
</span><span class='line'>
</span><span class='line'><span class="gi">+/*******************************</span>
</span><span class='line'><span class="gi">+source for the 4th parameter alloc_netdev fix for kernel 3.17-rc1 is:</span>
</span><span class='line'><span class="gi">+https://github.com/proski/madwifi/commit/c5246021b7b8580c2aeb0a145903acc07d246ac1</span>
</span><span class='line'><span class="gi">+*/</span>
</span><span class='line'><span class="gi">+#ifndef NET_NAME_UNKNOWN</span>
</span><span class='line'><span class="gi">+#undef alloc_netdev</span>
</span><span class='line'><span class="gi">+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)</span>
</span><span class='line'><span class="gi">+#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \</span>
</span><span class='line'><span class="gi">+ alloc_netdev(sizeof_priv, name, setup)</span>
</span><span class='line'><span class="gi">+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)</span>
</span><span class='line'><span class="gi">+#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \</span>
</span><span class='line'><span class="gi">+ alloc_netdev_mq(sizeof_priv, name, setup, 1)</span>
</span><span class='line'><span class="gi">+#else</span>
</span><span class='line'><span class="gi">+#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \</span>
</span><span class='line'><span class="gi">+ alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)</span>
</span><span class='line'><span class="gi">+#endif</span>
</span><span class='line'><span class="gi">+#endif</span>
</span><span class='line'><span class="gi">+/*******************************/</span>
</span><span class='line'><span class="gi">+</span>
</span><span class='line'> /*******************************************************************************
</span><span class='line'> * Internal Functions *
</span><span class='line'> *******************************************************************************/
</span><span class='line'><span class="gu">@@ -183,6 +202,7 @@ int vboxNetAdpOsCreate(PVBOXNETADP pThis, PCRTMAC pMACAddress)</span>
</span><span class='line'> /* No need for private data. */
</span><span class='line'> pNetDev = alloc_netdev(sizeof(VBOXNETADPPRIV),
</span><span class='line'> pThis->szName[0] ? pThis->szName : VBOXNETADP_LINUX_NAME,
</span><span class='line'><span class="gi">+ NET_NAME_UNKNOWN,</span>
</span><span class='line'> vboxNetAdpNetDevInit);
</span><span class='line'> if (pNetDev)
</span><span class='line'> {
</span><span class='line'><span class="gh">diff --git a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c</span>
</span><span class='line'><span class="gh">index 21e124bda039..2a046a3b254a 100644</span>
</span><span class='line'><span class="gd">--- a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c</span>
</span><span class='line'><span class="gi">+++ b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c</span>
</span><span class='line'><span class="gu">@@ -191,7 +191,7 @@ static PRTMEMHDR rtR0MemAllocExecVmArea(size_t cb)</span>
</span><span class='line'> struct page **papPagesIterator = papPages;
</span><span class='line'> pVmArea->nr_pages = cPages;
</span><span class='line'> pVmArea->pages = papPages;
</span><span class='line'><span class="gd">- if (!map_vm_area(pVmArea, PAGE_KERNEL_EXEC, &papPagesIterator))</span>
</span><span class='line'><span class="gi">+ if (!map_vm_area(pVmArea, PAGE_KERNEL_EXEC, papPagesIterator))</span>
</span><span class='line'> {
</span><span class='line'> PRTMEMLNXHDREX pHdrEx = (PRTMEMLNXHDREX)pVmArea->addr;
</span><span class='line'> pHdrEx->pVmArea = pVmArea;
</span></code></pre></td></tr></table></div></figure>
<p>Assuming you save above code in <code>my_patch</code> file and you are in <code>virtualbox</code>
dpkg source directory:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'>patch -p1 < my_patch
</span></code></pre></td></tr></table></div></figure>
<p>Install packages required to build:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'>sudo apt-get build-dep virtualbox
</span></code></pre></td></tr></table></div></figure>
<p>And build with:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'>dpkg-buildpackage -uc -b
</span></code></pre></td></tr></table></div></figure>