-
Notifications
You must be signed in to change notification settings - Fork 9
/
configure
executable file
·1595 lines (1440 loc) · 44.1 KB
/
configure
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
#!/bin/bash
env_clean(){
for i in DIR MAJOR MINOR OS RELEASE FIRST_DIGIT SECOND_DIGIT EXTRA_DIGIT CONCURRENCY_LEVEL FFDECSA_EXTRA FFFAIL CX23885 VERSION GCCCHANGE CONFIG
do
if ! [ -z ${i+x} ]; then
unset $i
fi
done
}
die(){
echo -en "
\E[1;33;44m$1, aborting...\E[0m
"
env_clean
exit 1
}
die_unknown(){
echo -en "
\E[1;33;44mUnknown option \"$1\".
run ./configure --help for valid options\E[0m
"
env_clean
exit 1
}
_patch(){
if ! [ "$?" -eq 0 ]; then
echo "
Could not apply the patch.
Aborting...
"
env_clean
exit 1
fi
}
confirmno(){
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
confirmyes(){
# call with a prompt string or use a default
read -r -p "${1:-Continue? [Y/n]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
[nN][oO]|[nN])
false
;;
*)
true
;;
esac
}
kernelconfig(){
echo -en "
Choise: use supplied config file or
do 'make oldconfig'. Do you want to
use supplied kernel config?
If you hit 'n', 'make oldconfig' starts.
"
# call with a prompt string or use a default
read -r -p "${1:-Yes, use it. [Y/n]} " response
case $response in
[yY][eE][sS]|[yY])
cp -f ../kernelconfig/amd64/$MAJOR.$MINOR/config ./.config
;;
[nN][oO]|[nN])
make oldconfig
;;
*)
cp -f ../kernelconfig/amd64/$MAJOR.$MINOR/config ./.config
;;
esac
}
ubuntukernelconfig(){
echo -en "
Choise: use supplied config file or
do 'make oldconfig'. Do you want to
use supplied kernel config?
If you hit 'n', 'make oldconfig' starts.
"
# call with a prompt string or use a default
read -r -p "${1:-Yes, use it. [Y/n]} " response
case $response in
[yY][eE][sS]|[yY])
cp -f ../kernelconfig/amd64/ubuntu/$MAJOR.$MINOR/config ./.config
;;
[nN][oO]|[nN])
make oldconfig
;;
*)
cp -f ../kernelconfig/amd64/ubuntu/$MAJOR.$MINOR/config ./.config
;;
esac
}
show_help(){
echo " Usage: ./configure --opt1=<opt> --opt2=<opt>"
echo " "
echo " Options: [default], if any, in brackets after option."
echo " "
echo " --help Print this message"
echo " "
echo " --stock=<opt> [yes] When running a Debian/Ubuntu stock kernel,"
echo " recompile it with dvbloopback driver and dvb-core patch."
echo " "
echo " --vanilla=<bool> Specify a the vanilla kernel version you"
echo " want to compile. Like --vanilla=4.1.8"
echo " This disables the --stock= flag."
echo " "
echo " --headers=<opt> [no] yes: install kernel headers package(s)."
echo " "
echo " --next=<opt> [no] 4.1 : compile linux-next."
echo " This version number should be >= current RC version."
echo " disables --vanilla and --stock flags, no headers."
echo " Warning: using the --next flag can corrupt your system"
echo " "
echo " --adapters=<opt> [16] Set max number of adapters that are allowed,"
echo " twice the number of your physical adapters is needed."
echo " "
echo " --update=<opt> [yes] no: don't auto-update or clean this repo."
echo " "
echo " --drivers=<opt> [yes] no: don't add support for TBS 6281/6285"
echo " and DVBSky T982 cards."
echo " "
echo " --dvb=<opt> [dvbc] Set si2168 primary mode to DVB-C permanently."
echo " dvbt: same, but set it to DVB-T."
echo " dvbt2: set it to DVB-T2."
echo " no: don't do anything to s2168."
echo " This is only for progs like MythTV, that can't handle"
echo " multistandard frontends."
echo " MythTV only sees the primary DVB system."
echo " "
echo " --abi=<opt> [900] Debian/Ubuntu only kernel version tweak."
echo " Only set this option if you realy know what you do."
echo " "
echo " --debug=<opt> [no] yes: pause to review (almost) each and every step."
echo " "
echo " --ffdecsawrapper=<opt> [yes] no: don't offer to compile ffdecsawrapper binary,"
echo " even if you don't have it."
echo " "
echo " --ffdecsaconf=<opt> If you know what you are doing, you can pass any flag to"
echo " ./configure of FFdecsawrapper you like."
echo " "
echo " --ffbranch=<opt> [master] you can opt for stable or oldstable."
echo " "
echo " --firmware=<opt> [yes] no: don't install the included firmware files."
echo " "
echo " --config=<opt> [big] small: use localmodconfig for tiny vanilla kernels."
echo " "
echo " --gcc=<opt> [gcc] or set the number."
echo " "
echo " --genpix=<opt> [no] yes: add 2g modulation capability to genpix drivers"
echo " "
exit 0
}
stock_opt="yes"
vanilla_opt=""
headers_opt="no"
next_opt="no"
adapters_opt="16"
update_opt="yes"
abi_opt="900"
debug_opt="no"
drivers_opt="yes"
dvb_opt="dvbc"
ffdecsawrapper_opt="yes"
ffdecsaconf_opt=""
ffbranch_opt="master"
firmware_opt="yes"
config_opt="big"
gcc_opt=""
genpix_opt="no"
dvbloopback_opt="yes"
for opt do
optval="${opt#*=}"
case "$opt" in
--help) show_help
;;
--stock=*) stock_opt="$optval"
;;
--vanilla=*) stock_opt="no"; vanilla_opt="$optval"
;;
--headers=*) headers_opt="$optval"
;;
--next=*) stock_opt="no"; headers_opt="no"; next_opt="$optval"; vanilla_opt="$next_opt"
;;
--adapters=*) adapters_opt="$optval"
;;
--update=*) update_opt="$optval"
;;
--abi=*) abi_opt="$optval"
;;
--debug=*) debug_opt="$optval"
;;
--drivers=*) drivers_opt="$optval"
;;
--dvb=*) dvb_opt="$optval"
;;
--ffdecsawrapper=*) ffdecsawrapper_opt="$optval"
;;
--ffdecsaconf=*) ffdecsaconf_opt="$optval"
;;
--ffbranch=*) ffbranch_opt="$optval"
;;
--firmware=*) firmware_opt="$optval"
;;
--config=*) config_opt="$optval"
;;
--gcc=*) gcc_opt="$optval"
;;
--genpix=*) genpix_opt="$optval"
;;
--driversonly) dvbloopback_opt="no"; ffdecsawrapper_opt="no"; adapters_opt="8"
;;
*)
die_unknown $opt
;;
esac
done
export abi_opt
DIR=`pwd`
# Check git status
if [ "x$update_opt" = "xyes" ]; then
rm -rf linux* > /dev/null 2>&1
rm -rf media* > /dev/null 2>&1
rm -rf descrambler > /dev/null 2>&1
git clean -xfd > /dev/null
git reset --hard HEAD > /dev/null
git remote update > /dev/null 2>&1
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###################################
Error(s) encountered while updating
the status from remote git repo.
Aborting...
####################################
\E[0m
"
env_clean
exit 1
fi
LOCAL=$(git rev-parse @{0})
REMOTE=$(git rev-parse @{u})
BASE=$(git merge-base @{0} @{u})
if [ $LOCAL = $REMOTE ]; then
GITSTATUS="0" # "Up-to-date"
elif [ $LOCAL = $BASE ]; then
GITSTATUS="1" # "Need to pull"
elif [ $REMOTE = $BASE ]; then
GITSTATUS="2" # "Need to push"
else
GITSTATUS="3" # "Diverged"
fi
if [ "$GITSTATUS" -eq "0" ]; then
echo "
Your local clone is clean and up-to-date
"
if [ "x$debug_opt" = "xno" ]; then
sleep 3
else
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
elif [ "$GITSTATUS" -eq "1" ]; then
echo "
Going to sync your local clone with updated remote repo.
"
sleep 3
git pull > /dev/null
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###################################
Error(s) encountered while syncing
local with remote git repo
Aborting...
####################################
\E[0m
"
env_clean
exit 1
else
echo -en "
############################################################
Synced with remote repo successfully! Please rerun
./configure to complete installation of dvbloopback drivers.
Arrow up and enter will get you there.
############################################################
"
env_clean
exit 0
fi
elif [ "$GITSTATUS" -eq 2 -o "$GITSTATUS" -eq 3 ]; then
echo -en "
\E[1;33;44m
######################################
Your local clone cannot be synced with
remote repo. Please get a fresh clone.
Aborting...
######################################
\E[0m
"
env_clean
exit 1
fi
fi
# Make sure that we are running as root
if ! echo "$(whoami)" | grep "root" > /dev/null 2>&1; then
echo -en "
\E[1;33;44m
You should run as root.
Aborting...
\E[0m
"
env_clean
exit 0
fi
# Make sure that a chosen non default gcc version actualy exists
if [ "x$gcc_opt" != "x" ]; then
if ! [ -e /usr/bin/gcc-$gcc_opt ]; then
echo -en "
\E[1;33;44m
You have chosen to compile your vanilla kernel with
gcc-$gcc_opt, but it does not exist on your system.
Aborting...
\E[0m
"
env_clean
exit 0
fi
fi
# Get info on what distro we are running
apt-get install lsb-release -y > /dev/null 2>&1
if [ -f /usr/bin/lsb_release ]; then
OS=$( lsb_release -si )
RELEASE=$( lsb_release -sc )
if ! [ "$OS" = "Debian" -o "$OS" = "Ubuntu" -o "$OS" = "Devuan" ]; then
if ! [ -f "/etc/arch-release" ] > /dev/null 2>&1; then
drivers_opt="no"
fi
fi
else
if ! [ -f "/etc/arch-release" ] > /dev/null 2>&1; then
drivers_opt="no"
fi
fi
# Check for a supported kernelversion
if ! [ "x$vanilla_opt" = "x" ]; then
MAJOR=$(echo "$vanilla_opt" | cut -d'.' -f1)
MINOR=$(echo "$vanilla_opt" | cut -d'.' -f2 | cut -d'-' -f1)
export MAJOR
export MINOR
if [ "$MAJOR" -lt 3 ]; then
echo -en "
You requested a build for a $vanilla_opt kernel.
Minimum supported kernelseries is 3.10.x
Aborting...
"
env_clean
exit 0
fi
if [ "x$drivers_opt" = "xyes" ]; then
if [ "$MAJOR" -eq 3 ]; then
if ! [ "$MINOR" -eq 10 -o "$MINOR" -eq 16 ]; then
echo -en "
You are trying to compile TBS 6281/6285 and DVBSky T982 drivers directly
into a $vanilla_opt vanilla kernel, using the --drivers=yes flag.
I only backported the DVBSky T982 driver to 3.10.x and 3.16.x kernels.
Aborting...
"
env_clean
exit 0
fi
fi
else
if [ "$MAJOR" -eq 3 ]; then
if [ "$MINOR" -lt 10 ]; then
echo "
Your are trying to build a $vanilla_opt kernel.
Minimum supported version is 3.10.x
Aborting...
"
env_clean
exit 0
fi
fi
fi
fi
# Check for proper use of --stock= flag
if ! [ "$OS" = "Debian" -o "$OS" = "Ubuntu" -o "$OS" = "Devuan" ]; then
if [ "x$stock_opt" = "xyes" ]; then
echo "
Compiling a distro's stock kernel is supported
in Debian, Devuan and Ubuntu only. You can compile the
v4l tree or a vanilla kernel. Aborting....
"
env_clean
exit 0
fi
fi
# Get build-deps, Debian, Devuan and Ubuntu only.
if [ "$OS" = "Debian" -o "$OS" = "Ubuntu" -o "$OS" = "Devuan" ]; then
if ! dpkg-query -l build-essential | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency build-essential, marking for installation.
"
apt-get install build-essential -y || die "Error installing dependency build-essential"
fi
if ! dpkg-query -l asciidoc | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency asciidoc, marking for installation.
"
apt-get install asciidoc --no-install-recommends -y || die "Error installing dependency asciidoc"
fi
if ! dpkg-query -l binutils-dev | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency binutils-dev, marking for installation.
"
apt-get install binutils-dev --no-install-recommends -y || die "Error installing dependency binutils-dev"
fi
if ! dpkg-query -l bison | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency bison, marking for installation.
"
apt-get install bison --no-install-recommends -y || die "Error installing dependency bison"
fi
if ! dpkg-query -l devscripts | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency devscripts, marking for installation.
"
apt-get install devscripts --no-install-recommends -y || die "Error installing dependency devscripts"
fi
if ! dpkg-query -l libelf-dev | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libelf-dev, marking for installation.
"
apt-get install libelf-dev --no-install-recommends -y || die "Error installing dependency libelf-dev"
fi
if ! dpkg-query -l fakeroot | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency fakeroot, marking for installation.
"
apt-get install fakeroot --no-install-recommends -y || die "Error installing dependency fakeroot"
fi
if ! dpkg-query -l flex | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency flex, marking for installation.
"
apt-get install flex --no-install-recommends -y || die "Error installing dependency flex"
fi
if ! dpkg-query -l initramfs-tools | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency initramfs-tools, marking for installation.
"
apt-get install initramfs-tools --no-install-recommends -y || die "Error installing dependency initramfs-tools"
fi
if ! dpkg-query -l kernel-package | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency kernel-package, marking for installation.
"
apt-get install kernel-package --no-install-recommends -y || die "Error installing dependency kernel-package"
fi
if ! dpkg-query -l kernel-wedge | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency kernel-wedge, marking for installation.
"
apt-get install kernel-wedge --no-install-recommends -y || die "Error installing dependency kernel-wedge"
if [ "$OS" = "Debian" -o "$OS" = "Devuan" ]; then
apt-get -t $RELEASE-backports install kernel-wedge --no-install-recommends -y > /dev/null 2>&1
apt-get -t $RELEASE-backports install linux-base --no-install-recommends -y > /dev/null 2>&1
apt-get -t $RELEASE-backports install irqbalance --no-install-recommends -y > /dev/null 2>&1
apt-get -t $RELEASE-backports install firmware-linux-free --no-install-recommends -y > /dev/null 2>&1
fi
else
if [ "$OS" = "Debian" -o "$OS" = "Devuan" ]; then
apt-get -t $RELEASE-backports install kernel-wedge --no-install-recommends -y > /dev/null 2>&1
fi
fi
if ! dpkg-query -l libdigest-sha-perl | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libdigest-sha-perl, marking for installation.
"
apt-get install libdigest-sha-perl --no-install-recommends -y || die "Error installing dependency libdigest-sha-perl"
fi
if ! dpkg-query -l libfile-fcntllock-perl | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libfile-fcntllock-perl, marking for installation.
"
apt-get install libfile-fcntllock-perl --no-install-recommends -y || die "Error installing dependency libfile-fcntllock-perl"
fi
if ! dpkg-query -l libproc-processtable-perl | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libproc-processtable-perl, marking for installation.
"
apt-get install libproc-processtable-perl --no-install-recommends -y || die "Error installing dependency libproc-processtable-perl"
fi
if ! dpkg-query -l bin86 | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency bin86, marking for installation.
"
apt-get install bin86 --no-install-recommends -y || die "Error installing dependency bin86"
fi
if ! dpkg-query -l makedumpfile | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency makedumpfile, marking for installation.
"
apt-get install makedumpfile --no-install-recommends -y || die "Error installing dependency makedumpfile"
fi
if ! dpkg-query -l libncurses5 | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libncurses5, marking for installation.
"
apt-get install libncurses5 --no-install-recommends -y || die "Error installing dependency libncurses5"
fi
if ! dpkg-query -l libncurses5-dev | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libncurses5-dev, marking for installation.
"
apt-get install libncurses5-dev --no-install-recommends -y || die "Error installing dependency libncurses5-dev"
fi
if ! dpkg-query -l patch | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency patch, marking for installation.
"
apt-get install patch --no-install-recommends -y || die "Error installing dependency patch"
fi
if ! dpkg-query -l patchutils | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency patchutils, marking for installation.
"
apt-get install patchutils --no-install-recommends -y || die "Error installing dependency patchutils"
fi
if ! dpkg-query -l g++ | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency g++, marking for installation.
"
apt-get install g++ --no-install-recommends -y || die "Error installing dependency g++"
fi
if ! dpkg-query -l gawk | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency gawk, marking for installation.
"
apt-get install gawk --no-install-recommends -y || die "Error installing dependency gawk"
fi
apt-get build-dep --no-install-recommends linux -y
if ! [ "$?" -eq 0 ]; then
echo "
Error(s) while installing build dependencies
Aborting...
"
env_clean
exit 1
fi
fi
#
# Download descrambler repo and run ./configure
#
if [ "x$ffdecsawrapper_opt" = "xyes" ]; then
FFDECSA_EXTRA=""
if [ -f /usr/bin/ffdecsawrapper ]; then
echo "
/usr/bin/ffdecsawrapper exists.
Do you want to recompile it?
"
confirmno "Recompile ffdecsawrapper binary [N/y]"
if ! [ "$?" -eq 0 ]; then
FFDECSA_EXTRA="A"
echo "
Nothing to do. Aborting...
"
else
FFDECSA_EXTRA="--replace=yes"
echo "
Going to replace /usr/bin/ffdecsawrapper
"
fi
fi
if ! [ "$FFDECSA_EXTRA" = "A" ]; then
FFFAIL="0"
git clone -b $ffbranch_opt https://github.com/bas-t/descrambler.git && cd descrambler
./configure $ffdecsaconf_opt $FFDECSA_EXTRA 2>&1 | tee ../buildlog_ffdecsawrapper
if ! [ "$?" -eq 0 ]; then
FFFAIL="1"
echo -en "
Error(s) encountered while (re)compiling ffdecsawrapper binary.
Continue anyway?
"
confirmyes
if ! [ "$?" -eq 0 ]; then
cd $DIR
env_clean
exit 0
fi
fi
if [ "x$debug_opt" = "xyes" ]; then
if [ "$FFFAIL" -eq 0 ]; then
echo "
ffdecsawrapper binary is (re)compiled and installed.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
cd $DIR
env_clean
exit 0
fi
fi
fi
cd $DIR
fi
fi
#
# Get the source
#
# Debian
if [ "x$stock_opt" = "xyes" ]; then
echo "
Going to download the kernel source.
"
sleep 3
apt-get source linux -y || die "Error(s) while fetching Debian Linux source"
cd linux-*
FIRST_DIGIT=$(echo `pwd` | awk -F/ '{print $NF}' | grep -o '[[:digit:]]\+' | head -n1 | awk 'NR==1')
SECOND_DIGIT=$(echo `pwd` | awk -F/ '{print $NF}' | grep -o '[[:digit:]]\+' | head -n2 | awk 'NR==2')
if [ "$FIRST_DIGIT" -lt 4 ]; then
echo "
You requested a (re)build of a Debian/Ubuntu $FIRST_DIGIT.$SECOND_DIGIT kernel.
Minimum supported kerneseries is 4.4.x
Aborting...
"
env_clean
exit 1
elif [ "$FIRST_DIGIT" -eq 4 -a "$SECOND_DIGIT" -lt 4 ]; then
echo "
You requested a (re)build of a Debian/Ubuntu $FIRST_DIGIT.$SECOND_DIGIT kernel.
Minimum supported kerneseries is 4.4.x
Aborting...
"
env_clean
exit 1
fi
if [ "x$debug_opt" = "xyes" ]; then
echo "
Source is downloaded.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
fi
# Vanilla
if [ "x$vanilla_opt" != "x" ]; then
echo "
Going to download the kernel source.
"
sleep 3
if [ "x$next_opt" = "xno" ]; then
if echo "$vanilla_opt" | grep "rc" > /dev/null 2>&1; then
wget https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-$vanilla_opt.tar.gz || die "Error(s) while fetching Linux source"
else
wget https://www.kernel.org/pub/linux/kernel/v$MAJOR.x/linux-$vanilla_opt.tar.xz || die "Error(s) while fetching Linux source"
fi
if echo "$vanilla_opt" | grep "rc" > /dev/null 2>&1; then
tar -xzf linux-$vanilla_opt.tar.gz
else
tar -xJf linux-$vanilla_opt.tar.xz
fi
cd linux-$vanilla_opt
FIRST_DIGIT=$(echo `pwd` | awk -F/ '{print $NF}' | grep -o '[[:digit:]]\+' | head -n1 | awk 'NR==1')
SECOND_DIGIT=$(echo `pwd` | awk -F/ '{print $NF}' | grep -o '[[:digit:]]\+' | head -n2 | awk 'NR==2')
if [ "$FIRST_DIGIT" -lt 4 ]; then
echo "
You requested a (re)build of a Debian/Ubuntu $FIRST_DIGIT.$SECOND_DIGIT kernel.
Minimum supported kerneseries is 4.4.x
Aborting...
"
env_clean
exit 1
elif [ "$FIRST_DIGIT" -eq 4 -a "$SECOND_DIGIT" -lt 4 ]; then
echo "
You requested a (re)build of a Debian/Ubuntu $FIRST_DIGIT.$SECOND_DIGIT kernel.
Minimum supported kerneseries is 4.4.x
Aborting...
"
env_clean
exit 1
fi
if [ "x$debug_opt" = "xyes" ]; then
echo "
Source is downloaded.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
make clean && make mrproper
fi
fi
# linux-next
if ! [ "x$next_opt" = "xno" ]; then
git clone --depth=1 git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git ./linux-$next_opt || die "Error(s) while fetching Linux source"
cd linux-$next_opt
make clean && make mrproper
if [ "x$debug_opt" = "xyes" ]; then
echo "
Source is downloaded.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
fi
#
# Patch the source
#
# Common (stock and vanilla kernels)
FIRST_DIGIT=$(echo `pwd` | awk -F/ '{print $NF}' | grep -o '[[:digit:]]\+' | head -n1 | awk 'NR==1')
SECOND_DIGIT=$(echo `pwd` | awk -F/ '{print $NF}' | grep -o '[[:digit:]]\+' | head -n2 | awk 'NR==2')
EXTRA_DIGIT="0"
VERSION="$FIRST_DIGIT$SECOND_DIGIT"
chars=`echo -n $SECOND_DIGIT | wc -c`
if ! [ "$chars" -eq 2 ]; then
VERSION="$FIRST_DIGIT$EXTRA_DIGIT$SECOND_DIGIT"
fi
# Common (stock and vanilla kernels)
# add saa716x driver
if [ "x$drivers_opt" = "xyes" ];then
mkdir drivers/media/pci/saa716x
cp -f ../drivers/media/pci/saa716x/* drivers/media/pci/saa716x/
if [ "$VERSION" -lt 405 ]; then
patch -p0 < ../Kconfig-4.2.patch
_patch
elif [ "$VERSION" -lt 410 ]; then
patch -p0 < ../Kconfig-4.5.patch
_patch
else
patch -p0 < ../Kconfig-4.10.patch
_patch
fi
if [ "x$debug_opt" = "xyes" ]; then
echo "
saa716x added, Kconfig patched for saa716x.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
patch -p0 < ../Makefile-4.2.patch
_patch
if [ "x$debug_opt" = "xyes" ]; then
echo "
Makefile is patched for saa716x.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
fi
# Common (stock and vanilla kernels)
# insert dvbloopback driver
if [ "x$dvbloopback_opt" = "xyes" ]; then
mkdir drivers/media/pci/dvbloopback
cp -f ../dvbloopback/* drivers/media/pci/dvbloopback/
patch -p1 < ../dvbloopback.patch
_patch
patch -p0 < ../3.13-dvb-core.patch
_patch
if [ "x$debug_opt" = "xyes" ]; then
echo "
dvb-core is patched, dvbloopback added.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
if [ "$VERSION" -gt 415 ]; then
sed -i "s/include \"dvbdev.h\"/include \<media\/dvbdev.h\>/" drivers/media/pci/dvbloopback/dvblb_internal.h
sed -i "s/include \"dvbdev.h\"/include \<media\/dvbdev.h\>/" drivers/media/pci/dvbloopback/dvb_loopback.c
fi
# 4.5-linux patch
if [ "$VERSION" -gt 404 ]; then
patch -p0 < ../4.5-linux.patch
_patch
if [ "x$debug_opt" = "xyes" ]; then
echo "
dvbloopback module is patched for kernel series 4.5.x and up.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
fi
fi
# Common (stock and vanilla)
# Kernel series 5.6.x and up patches
if [ "$VERSION" -gt 505 ]; then
patch -p0 < ../5.6-linux.patch
_patch
if [ "x$debug_opt" = "xyes" ]; then
echo "
dvbloopback module is patched for kernel series 5.6.x and up.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
if [ "x$drivers_opt" = "xyes" ];then
patch -p0 < ../saa716x-linux-5.6.x.patch
_patch
if [ "x$debug_opt" = "xyes" ]; then
echo "
saa716x driver is patched for kernel series 5.6.x and up.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
fi
fi
# Common (stock and vanilla kernels)
# silabs si2157 and si2168 patch
if [ "x$drivers_opt" = "xyes" ];then
if [ "$VERSION" -lt 404 ]; then
cp -f ../drivers/media/tuners/* drivers/media/tuners/
cp -f ../drivers/media/dvb-frontends/* drivers/media/dvb-frontends/
if [ "x$debug_opt" = "xyes" ]; then
echo "
si2168 and si2157 added/updated.
"
confirmyes
if ! [ "$?" -eq 0 ]; then
env_clean
exit 0
fi
fi
fi
fi
# Common (stock and vanilla kernels)
# kernel-package patch for linux-4.10.x and up
touch REPORTING-BUGS
# Common (stock and vanilla kernels)
# silabs si2168 DVB-C/T patch
if [ "x$dvb_opt" = "xdvbc" ]; then
sed -i 's/SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A/SYS_DVBC_ANNEX_A, SYS_DVBT, SYS_DVBT2/' drivers/media/dvb-frontends/si2168.c
elif [ "x$dvb_opt" = "xdvbt" ]; then
sed -i 's/SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A/SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A/' drivers/media/dvb-frontends/si2168.c
elif [ "x$dvb_opt" = "xdvbt2" ]; then
sed -i 's/SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A/SYS_DVBT2, SYS_DVBT, SYS_DVBC_ANNEX_A/' drivers/media/dvb-frontends/si2168.c
fi
if [ "x$dvb_opt" = "xdvbc" -o "x$dvb_opt" = "xdvbt" -o "x$dvb_opt" = "xdvbt2" ]; then
if [ "x$debug_opt" = "xyes" ]; then
echo "
Primary DVB system for si2168 is set to $dvb_opt
"