-
-
Notifications
You must be signed in to change notification settings - Fork 501
/
dietpi-set_hardware
executable file
·2399 lines (1958 loc) · 81.4 KB
/
dietpi-set_hardware
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
{
#////////////////////////////////////
# DietPi Function:
# - Enables control and applies settings for specific hardware.
#
#////////////////////////////////////
# Created by Daniel Knight / [email protected] / dietpi.com
#
#////////////////////////////////////
#
# Usage:
readonly FP_SCRIPT='/boot/dietpi/func/dietpi-set_hardware'
readonly AVAIABLE_COMMANDS="
Available commands:
$FP_SCRIPT enableipv6 enable/disable
$FP_SCRIPT eth-forcespeed 10/100/1000/disable
$FP_SCRIPT wifimodules enable/disable/onboard_enable/onboard_disable
$FP_SCRIPT wificountrycode GB/US/DE/...
$FP_SCRIPT bluetooth enable/disable
$FP_SCRIPT serialconsole enable/disable [(tty(S|AMA|SAC|AML|SC|GS|FIQ|MV)|hvc)[0-9]] (optional Serial/UART device)
$FP_SCRIPT i2c enable/disable/khz
$FP_SCRIPT spi enable/disable
$FP_SCRIPT soundcard target_card (non-matching name for reset to default). Add '-eq' to target_card string to enable ALSA equalizer on card. HW:x,x (specify target card and device index eg: HW:9,1)
$FP_SCRIPT remoteir odroid_remote/justboom_ir_remote # Odroid/RPi only
$FP_SCRIPT lcdpanel target_panel (\"none\" to remove all)
$FP_SCRIPT headless enable/disable
$FP_SCRIPT gpumemsplit 64/128/256... Range: 16-944, RPi only
$FP_SCRIPT rpi-camera enable/disable
$FP_SCRIPT rpi-codec enable/disable
$FP_SCRIPT rpi-opengl vc4-kms-v3d/vc4-fkms-v3d/disable
$FP_SCRIPT rpi3_usb_boot enable
$FP_SCRIPT rpi-eeprom Update RPi 4/5 EEPROM bootloader and USB firmware
$FP_SCRIPT vf2-spi-update Update StarFive VisionFive 2 SPI bootloader
$FP_SCRIPT flash-u-boot-mmc [<device_path>] Flash U-Boot binary to eMMC/SD card, taking device path as optional argument, else flashes to /boot drive
$FP_SCRIPT gpudriver none|intel|nvidia|amd|custom
$FP_SCRIPT qemu-guest-agent|qga enable/disable
" #////////////////////////////////////
# Grab Inputs
INPUT_DEVICE_NAME=${1,,}
INPUT_DEVICE_VALUE=${2,,}
# - Support for 1/0 inputs to enable/disable.
if [[ $INPUT_DEVICE_VALUE == '1' ]]
then
INPUT_DEVICE_VALUE='enable'
elif [[ $INPUT_DEVICE_VALUE == '0' ]]
then
INPUT_DEVICE_VALUE='disable'
fi
INPUT_ADDITIONAL=$3
# Import DietPi-Globals --------------------------------------------------------------
. /boot/dietpi/func/dietpi-globals
readonly G_PROGRAM_NAME='DietPi-Set_hardware'
G_CHECK_ROOT_USER
G_CHECK_ROOTFS_RW
G_INIT
# Import DietPi-Globals --------------------------------------------------------------
ARMBIAN=0
DIETPIENV=0
# New mainline kernel U-Boot images with dietpiEnv.txt
if [[ -f '/boot/dietpiEnv.txt' ]]
then
DIETPIENV=1
FP_UENV='/boot/dietpiEnv.txt'
# Armbian uses armbianEnv.txt instead which requires different syntax
elif [[ -f '/boot/armbianEnv.txt' ]]
then
ARMBIAN=1
FP_UENV='/boot/armbianEnv.txt'
# Sparky SBC uEnv.txt has been renamed to uenv.txt, lets support both variants
else
FP_UENV='/boot/uEnv.txt'
[[ -f '/boot/uenv.txt' ]] && FP_UENV='/boot/uenv.txt'
fi
EXIT_CODE=0
Unknown_Input_Name()
{
G_DIETPI-NOTIFY 1 "Unknown input name ($INPUT_DEVICE_NAME). Nothing has been applied."
echo "$AVAIABLE_COMMANDS"
EXIT_CODE=1
}
Unknown_Input_Mode()
{
G_DIETPI-NOTIFY 1 "Unknown input value ($INPUT_DEVICE_VALUE). Nothing has been applied."
echo "$AVAIABLE_COMMANDS"
EXIT_CODE=1
}
Unsupported_Input_Name()
{
G_DIETPI-NOTIFY 2 "Input name ($INPUT_DEVICE_NAME) is not supported on your system. Nothing has been applied."
}
Unsupported_Input_Mode()
{
G_DIETPI-NOTIFY 2 "Input value ($INPUT_DEVICE_VALUE) is not supported on your system. Nothing has been applied."
}
#/////////////////////////////////////////////////////////////////////////////////////
# rpi-camera
#/////////////////////////////////////////////////////////////////////////////////////
RPi_Camera_Main(){
(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi
if [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then
# Remove modules blacklist
[[ -f '/etc/modprobe.d/dietpi-disable_rpi_camera.conf' ]] && G_EXEC rm /etc/modprobe.d/dietpi-disable_rpi_camera.conf
# Enable video devices via extended start
G_CONFIG_INJECT 'start_x=' 'start_x=1' /boot/config.txt
# Requires 96 MiB memory split at least
local gpu_mem=$(sed -n '/^[[:blank:]]*gpu_mem_1024=/{s/^[^=]*=//p;q}' /boot/config.txt)
(( ${gpu_mem:-76} < 96 )) && INPUT_DEVICE_VALUE=96 Gpu_Memory_Split_Main
# Enable V4L2 codec as well
INPUT_DEVICE_VALUE='enable' RPi_Codec_Main
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then
# Comment extended start setting
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*start_x=/c\#start_x=1' /boot/config.txt
# Add modules blacklist, which are otherwise loaded by default since kernel 4.19/5.10
G_EXEC eval "echo -e 'blacklist bcm2835_v4l2\nblacklist bcm2835_isp' > /etc/modprobe.d/dietpi-disable_rpi_camera.conf"
else
Unknown_Input_Mode
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# rpi-codec
#/////////////////////////////////////////////////////////////////////////////////////
RPi_Codec_Main()
{
(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi
if [[ $INPUT_DEVICE_VALUE == 'enable' ]]
then
# Remove module blacklist
[[ -f '/etc/modprobe.d/dietpi-disable_rpi_codec.conf' ]] && G_EXEC rm /etc/modprobe.d/dietpi-disable_rpi_codec.conf
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]
then
# Add module blacklist, which is otherwise loaded by default
G_EXEC eval "echo 'blacklist bcm2835_codec' > /etc/modprobe.d/dietpi-disable_rpi_codec.conf"
else
Unknown_Input_Mode
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# rpi3_usb_boot
#/////////////////////////////////////////////////////////////////////////////////////
RPi_USB_Boot_Main(){
[[ $G_HW_MODEL == 3 && $G_HW_MODEL_NAME != *'+'* ]] || { Unsupported_Input_Name; return 1; } # Exit path for non-RPi3 nonplus
if [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then
G_CONFIG_INJECT 'program_usb_boot_mode=' 'program_usb_boot_mode=1' /boot/config.txt
cat << '_EOF_' > /etc/systemd/system/dietpi-rm_program_usb_boot_mode.service
[Unit]
Description=DietPi-rm_program_usb_boot_mode.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/bin/sed --follow-symlinks -i '/^[[:blank:]]*program_usb_boot_mode=/d' /boot/config.txt
ExecStartPre=/bin/systemctl disable dietpi-rm_program_usb_boot_mode
ExecStart=/bin/rm /etc/systemd/system/dietpi-rm_program_usb_boot_mode.service
[Install]
WantedBy=multi-user.target
_EOF_
G_EXEC systemctl daemon-reload
G_EXEC systemctl enable dietpi-rm_program_usb_boot_mode
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*program_usb_boot_mode=/d' /boot/config.txt
if [[ -f '/etc/systemd/system/dietpi-rm_program_usb_boot_mode.service' ]]; then
G_EXEC systemctl disable --now dietpi-rm_program_usb_boot_mode
G_EXEC rm /etc/systemd/system/dietpi-rm_program_usb_boot_mode.service
fi
else
Unknown_Input_Mode
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# rpi-eeprom: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#automaticupdates
#/////////////////////////////////////////////////////////////////////////////////////
RPi_EEPROM()
{
(( $G_HW_MODEL > 3 && $G_HW_MODEL < 10 )) || { Unsupported_Input_Name; return 1; } # Exit path for non-RPi 4/5
# Install required APT package
G_AG_CHECK_INSTALL_PREREQ rpi-eeprom
# Update/flash new bootloader and VL805 USB firmware to EEPROM
rpi-eeprom-update -a
# Failsafe
G_EXEC systemctl enable rpi-eeprom-update
}
#/////////////////////////////////////////////////////////////////////////////////////
# vf2-spi-update: https://doc-en.rvspace.org/VisionFive2/PDF/VisionFive2_QSG.pdf
#/////////////////////////////////////////////////////////////////////////////////////
VF2_SPI_Update()
{
(( $G_HW_MODEL == 81 || $G_HW_MODEL == 84 )) || { Unsupported_Input_Name; return 1; } # Exit path for non-VisionFive 2
G_AG_CHECK_INSTALL_PREREQ mtd-utils
local version=$(curl -sSf 'https://api.github.com/repos/starfive-tech/VisionFive2/releases/latest' | mawk -F\" '/"tag_name": /{print $4}')
G_EXEC curl -sSfLO "https://github.com/starfive-tech/VisionFive2/releases/download/$version/u-boot-spl.bin.normal.out"
G_EXEC curl -sSfLO "https://github.com/starfive-tech/VisionFive2/releases/download/$version/visionfive2_fw_payload.img"
G_EXEC_OUTPUT=1 G_EXEC flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
G_EXEC_OUTPUT=1 G_EXEC flashcp -v visionfive2_fw_payload.img /dev/mtd2
G_EXEC rm u-boot-spl.bin.normal.out visionfive2_fw_payload.img
}
#/////////////////////////////////////////////////////////////////////////////////////
# flash-u-boot-mmc
#/////////////////////////////////////////////////////////////////////////////////////
Flash_U-Boot_MMC()
{
[[ -f '/usr/lib/u-boot/platform_install.sh' ]] || { G_DIETPI-NOTIFY 1 'Flash script /usr/lib/u-boot/platform_install.sh not found. Aborting ...'; return 1; }
[[ $INPUT_DEVICE_VALUE ]] || INPUT_DEVICE_VALUE=$(lsblk -npo PKNAME "$(findmnt -Ufnro SOURCE -T /boot)")
[[ -b $INPUT_DEVICE_VALUE ]] || { G_DIETPI-NOTIFY 1 "Block device \"$INPUT_DEVICE_VALUE\" not found. Aborting ..."; return 1; }
# shellcheck disable=SC1091
. /usr/lib/u-boot/platform_install.sh || return 1
# Do not mute progress and error messages
eval "$(declare -f write_uboot_platform | sed -e 's| > /dev/null 2>&1||g' -e 's|status=none|status=progress|g')"
# shellcheck disable=SC2154
write_uboot_platform "$DIR" "$INPUT_DEVICE_VALUE"
}
#/////////////////////////////////////////////////////////////////////////////////////
# gpumemsplit
#/////////////////////////////////////////////////////////////////////////////////////
Gpu_Memory_Split_Main()
{
(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi
# https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md
if disable_error=1 G_CHECK_VALIDINT "$INPUT_DEVICE_VALUE" 16 944
then
# Remove overridden "gpu_mem" setting
grep -q '^[[:blank:]]*gpu_mem=' /boot/config.txt && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*gpu_mem=/d' /boot/config.txt
local gpu_mem=$INPUT_DEVICE_VALUE
G_CONFIG_INJECT 'gpu_mem_1024=' "gpu_mem_1024=$gpu_mem" /boot/config.txt
(( $gpu_mem > 448 )) && gpu_mem=448
G_CONFIG_INJECT 'gpu_mem_512=' "gpu_mem_512=$gpu_mem" /boot/config.txt
(( $gpu_mem > 192 )) && gpu_mem=192
G_CONFIG_INJECT 'gpu_mem_256=' "gpu_mem_256=$gpu_mem" /boot/config.txt
# Disable VideoCore CMA Shared Memory Driver if less than 32 MiB are applied, as it is doomed to fail with cut-down firmware loaded.
if (( $gpu_mem < 32 ))
then
G_EXEC eval 'echo '\''blacklist vc_sm_cma'\'' > /etc/modprobe.d/dietpi-disable_vcsm.conf'
elif [[ -f '/etc/modprobe.d/dietpi-disable_vcsm.conf' ]]
then
G_EXEC rm /etc/modprobe.d/dietpi-disable_vcsm.conf
fi
else
Unknown_Input_Mode
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# headless
#/////////////////////////////////////////////////////////////////////////////////////
Headless_Main()
{
(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi
if [[ $INPUT_DEVICE_VALUE == 'enable' ]]
then
# Prevent any framebuffer from being allocated
G_CONFIG_INJECT 'max_framebuffers=' 'max_framebuffers=0' /boot/config.txt
# Splash cannot be seen anyway without video output
G_CONFIG_INJECT 'disable_splash=' 'disable_splash=1' /boot/config.txt
# hdmi_blanking should not play a role, however mode 1 should be generally preferred, which on idle disables HDMI output completely instead of just blanking the screen
G_CONFIG_INJECT 'hdmi_blanking=' 'hdmi_blanking=1' /boot/config.txt
# Disable HDMI hotplug detection, which requires it to be generally responsive/active
G_CONFIG_INJECT 'hdmi_ignore_hotplug=' 'hdmi_ignore_hotplug=1' /boot/config.txt
# Disable SDTV on RPi 4 (default)
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*enable_tvout=/c\#enable_tvout=0' /boot/config.txt
# dietpi.txt flag
G_CONFIG_INJECT 'AUTO_SETUP_HEADLESS=' 'AUTO_SETUP_HEADLESS=1' /boot/dietpi.txt
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]
then
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*max_framebuffers=/c\#max_framebuffers=2' /boot/config.txt
#G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*disable_splash=/c\#disable_splash=0' /boot/config.txt
#G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_blanking=/c\#hdmi_blanking=0' /boot/config.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_ignore_hotplug=/c\#hdmi_ignore_hotplug=0' /boot/config.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*enable_tvout=/c\#enable_tvout=0' /boot/config.txt
G_CONFIG_INJECT 'AUTO_SETUP_HEADLESS=' 'AUTO_SETUP_HEADLESS=0' /boot/dietpi.txt
else
Unknown_Input_Mode
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# remoteir
#/////////////////////////////////////////////////////////////////////////////////////
RemoteIR_Reset()
{
# Disable JustBoom
if (( $G_HW_MODEL < 10 ))
then
if [[ -f '/etc/systemd/system/justboom-ir-mpd.service' ]]
then
G_EXEC systemctl disable --now justboom-ir-mpd
G_EXEC rm /etc/systemd/system/justboom-ir-mpd.service
fi
[[ -d '/etc/systemd/system/justboom-ir-mpd.service.d' ]] && G_EXEC rm -R /etc/systemd/system/justboom-ir-mpd.service.d
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=gpio-ir/d' /boot/config.txt
# Disable Odroids
elif (( $G_HW_MODEL < 20 ))
then
if systemctl -q is-active lircd || systemctl -q is-enabled lircd 2> /dev/null
then
G_EXEC systemctl disable --now lircd
fi
G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*(gpio-ir-recv|meson_ir)[[:blank:]]*$/d' /etc/modules
fi
}
RemoteIR_Main()
{
(( $G_HW_MODEL > 19 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-Odroid/non-RPi
RemoteIR_Reset
if [[ $INPUT_DEVICE_VALUE == 'odroid_remote' ]]
then
(( $G_HW_MODEL > 9 )) || { Unsupported_Input_Mode; return 1; } # Exit path for non-Odroid
G_AG_CHECK_INSTALL_PREREQ lirc
# Kernel modules
# - XU4 CloudShell
if (( $G_HW_MODEL == 11 ))
then
G_CONFIG_INJECT 'gpio-ir-recv' 'gpio-ir-recv' /etc/modules
# - C2
elif (( $G_HW_MODEL == 12 ))
then
G_CONFIG_INJECT 'meson_ir' 'meson_ir' /etc/modules
fi
# Config
cat << '_EOF_' > /etc/lirc/lircd.conf
begin remote
name lircd.conf
bits 16
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 9000 4500
one 563 1688
zero 563 564
ptrail 563
pre_data_bits 16
pre_data 0x4DB2
repeat 9000 2250
toggle_bit_mask 0x0
begin codes
KEY_LEFT 0x9966
KEY_RIGHT 0x837C
KEY_UP 0x53AC
KEY_DOWN 0x4BB4
KEY_ENTER 0x738C
KEY_HOME 0x41BE
KEY_MUTE 0x11EE
KEY_MENU 0xA35C
KEY_BACK 0x59A6
KEY_VOLUMEDOWN 0x817E
KEY_VOLUMEUP 0x01FE
KEY_POWER 0x3BC4
end codes
end remote
_EOF_
# Service
G_EXEC systemctl enable --now lircd
elif [[ $INPUT_DEVICE_VALUE == 'justboom_ir_remote' ]]
then
(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi
G_AG_CHECK_INSTALL_PREREQ lirc mpc
# Device tree overlay
G_CONFIG_INJECT 'dtoverlay=gpio-ir' 'dtoverlay=gpio-ir,gpio_pin=25' /boot/config.txt
# Config
cat << '_EOF_' > /etc/lirc/hardware.conf
LIRCD_ARGS="--uinput"
LOAD_MODULES=true
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
LIRCD_CONF=""
LIRCMD_CONF=""
_EOF_
cat << '_EOF_' > /etc/lirc/lircd.conf
begin remote
name lircd.conf
bits 5
flags RC5|CONST_LENGTH
eps 30
aeps 100
one 921 855
zero 921 855
plead 936
pre_data_bits 8
pre_data 0xA0
gap 114211
toggle_bit_mask 0x800
suppress_repeat 5
duty_cycle 300
begin codes
KEY_HOME 0x10
KEY_POWER 0x11
KEY_MUTE 0x12
KEY_LEFT 0x13
KEY_RIGHT 0x14
KEY_ENTER 0x15
KEY_MENU 0x16
KEY_BACK 0x17
KEY_VOLUMEDOWN 0x18
KEY_VOLUMEUP 0x19
KEY_UP 0x1A
KEY_DOWN 0x1B
end codes
end remote
_EOF_
cat << '_EOF_' > /root/.lircrc
begin
prog = irexec
button = KEY_ENTER
config = mpc toggle
end
begin
prog = irexec
button = KEY_VOLUMEUP
config = mpc volume +2
end
begin
prog = irexec
button = KEY_VOLUMEDOWN
config = mpc volume -2
end
begin
prog = irexec
button = KEY_RIGHT
config = mpc next
end
begin
prog = irexec
button = KEY_LEFT
config = mpc prev
end
begin
prog = irexec
button = KEY_UP
config = mpc seek +00:00:10
end
begin
prog = irexec
button = KEY_DOWN
config = mpc seek -00:00:10
end
begin
prog = irexec
button = KEY_BACK
config = mpc repeat on
end
begin
prog = irexec
button = KEY_MENU
config = mpc repeat off
end
_EOF_
# Service
cat << _EOF_ > /etc/systemd/system/justboom-ir-mpd.service
[Unit]
Description=justboom-ir-mpd (DietPi)
After=sound.target lircd.service lirc.service
[Service]
ExecStart=$(command -v irexec)
[Install]
WantedBy=default.target
_EOF_
G_EXEC systemctl daemon-reload
G_EXEC systemctl enable --now justboom-ir-mpd
elif [[ $INPUT_DEVICE_VALUE != 'none' ]]
then
Unknown_Input_Mode
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# eth-forcespeed: Ethernet force link speed
#/////////////////////////////////////////////////////////////////////////////////////
Eth_Force_Speed_Main()
{
if disable_error=1 G_CHECK_VALIDINT "$INPUT_DEVICE_VALUE" 1
then
local speed_mbit=$INPUT_DEVICE_VALUE
local iface=$(G_GET_NET -t eth iface)
cat << _EOF_ > /etc/systemd/system/ethtool_force_speed.service
[Unit]
Description=Enforce $speed_mbit Mbit on $iface via ethtool (DietPi)
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=$(command -v ethtool) -s $iface speed $speed_mbit duplex full autoneg off
[Install]
WantedBy=ifup@$iface.service
_EOF_
G_EXEC systemctl daemon-reload
G_EXEC systemctl enable --now ethtool_force_speed
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]] # 0 is converted to "disable"
then
if [[ -f '/etc/systemd/system/ethtool_force_speed.service' ]]
then
G_EXEC systemctl disable --now ethtool_force_speed
G_EXEC rm /etc/systemd/system/ethtool_force_speed.service
fi
[[ -d '/etc/systemd/system/ethtool_force_speed.service.d' ]] && G_EXEC rm -R /etc/systemd/system/ethtool_force_speed.service.d
else
Unknown_Input_Mode
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# RPi OpenGL
#/////////////////////////////////////////////////////////////////////////////////////
RPi_OpenGL_Main(){
(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi
# Get overlay params
local params=$(sed -En '/^[[:blank:]]*dtoverlay=vc4-f?kms-v3d(-pi4)?,/{s/^[^,]*//p;q}' /boot/config.txt)
# Always remove previous VC4 overlay entry
G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*dtoverlay=vc4-f?kms-v3d/d' /boot/config.txt
if [[ $INPUT_DEVICE_VALUE == 'vc4-kms-v3d' || $INPUT_DEVICE_VALUE == 'vc4-fkms-v3d' ]]; then
if [[ $INPUT_DEVICE_VALUE == 'vc4-fkms-v3d' ]]
then
# Fake KMS supports CMA params only
[[ $params ]] && params=$(mawk -F, '{for(i=1; i<=NF; i++) {if($i~/^cma-*/){print $i;exit}}}' <<< "$params")
else
# Disable VC4 HDMI audio if onboard HDMI is disabled
[[ $params != *',noaudio'* ]] && { ! grep -q '^[[:blank:]]*dtparam=audio=on' /boot/config.txt || grep -Eq '(^|[[:blank:]])snd_bcm2835.enable_hdmi=0([[:blank:]]|$)' /boot/cmdline.txt; } && params+=',noaudio'
fi
# Use additional argument for CMA size
if [[ $INPUT_ADDITIONAL ]]
then
if [[ $params =~ ',cma-'[^,]*(,|$) ]]
then
params=$(sed -E "s/,cma-[^,]*(,|$)/,cma-$INPUT_ADDITIONAL\1/" <<< "$params")
else
params+=",cma-$INPUT_ADDITIONAL"
fi
fi
G_CONFIG_INJECT "dtoverlay=$INPUT_DEVICE_VALUE" "dtoverlay=$INPUT_DEVICE_VALUE$params" /boot/config.txt
elif [[ $INPUT_DEVICE_VALUE != 'disable' ]]; then
Unknown_Input_Mode
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# lcdpanel: All non-HDMI/VGA based displays and monitors
#/////////////////////////////////////////////////////////////////////////////////////
Lcd_Panel_Main()
{
(( $G_HW_MODEL > 19 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi/non-Odroid
# Reset all LCDs
Lcd_Panel_Waveshare32_Disable
Lcd_Panel_Odroidcloudshell_Disable
Lcd_Panel_Odroidcloudshell2_Disable
Lcd_Panel_OdroidLCD35_Disable
Lcd_Panel_ESP01215E_Disable
OLED_Allo_Boss2_Disable
case $INPUT_DEVICE_VALUE in
'odroid-lcd35') Lcd_Panel_OdroidLCD35_Enable || return 1;;
'waveshare32') Lcd_Panel_Waveshare32_Enable || return 1;;
'odroid-cloudshell') Lcd_Panel_Odroidcloudshell_Enable || return 1;;
'odroid-cloudshell2') Lcd_Panel_Odroidcloudshell2_Enable || return 1;;
'esp01215e') Lcd_Panel_ESP01215E_Enable || return 1;;
'allo-boss2-oled') OLED_Allo_Boss2_Enable || return 1;;
'none') :;;
*) Unknown_Input_Mode; return 1;;
esac
# Update dietpi.txt entry
G_CONFIG_INJECT 'CONFIG_LCDPANEL=' "CONFIG_LCDPANEL=$INPUT_DEVICE_VALUE" /boot/dietpi.txt
}
Lcd_Panel_ESP01215E_Enable(){
(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi
G_CONFIG_INJECT 'framebuffer_width=' 'framebuffer_width=1024' /boot/config.txt
G_CONFIG_INJECT 'framebuffer_height=' 'framebuffer_height=600' /boot/config.txt
G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_X=' "SOFTWARE_CHROMIUM_RES_X=1024" /boot/dietpi.txt
G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_Y=' "SOFTWARE_CHROMIUM_RES_Y=600" /boot/dietpi.txt
G_CONFIG_INJECT 'hdmi_force_hotplug=' 'hdmi_force_hotplug=1' /boot/config.txt
G_CONFIG_INJECT 'hdmi_group=' 'hdmi_group=2' /boot/config.txt
G_CONFIG_INJECT 'hdmi_mode=' 'hdmi_mode=87' /boot/config.txt
G_CONFIG_INJECT 'hdmi_cvt=' 'hdmi_cvt=1024 600 60 6 0 0 0' /boot/config.txt
G_CONFIG_INJECT 'hdmi_drive=' 'hdmi_drive=1' /boot/config.txt
}
Lcd_Panel_ESP01215E_Disable(){
(( $G_HW_MODEL > 9 )) && return 0 # Skip on non-RPi
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_force_hotplug=/c\#hdmi_force_hotplug=1' /boot/config.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_group=/c\#hdmi_group=2' /boot/config.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_mode=/c\#hdmi_mode=87' /boot/config.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_cvt=/c\#hdmi_cvt=1024 600 60 6 0 0 0' /boot/config.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_drive=/c\#hdmi_drive=1' /boot/config.txt
}
Lcd_Panel_Xorg_All_Enable(){
# Xinput calibrator, fbset for con2fbmap
G_AG_CHECK_INSTALL_PREREQ fbset xinput-calibrator xserver-xorg-input-evdev
G_EXEC mkdir -p /etc/X11/xorg.conf.d
}
# Waveshare32
Lcd_Panel_Waveshare32_Enable_X11(){
cat << '_EOF_' > /etc/X11/xorg.conf.d/99-waveshare32_calibration.conf
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "219 3835 3984 219"
Option "SwapAxes" "1"
Driver "evdev"
EndSection
_EOF_
}
Lcd_Panel_Waveshare32_Enable(){
# Disable 1st to reset any existing installations
Lcd_Panel_Waveshare32_Disable
# X11
Lcd_Panel_Xorg_All_Enable
Lcd_Panel_Waveshare32_Enable_X11
# RPi
if (( $G_HW_MODEL < 10 )); then
G_EXEC curl -sSfL 'https://raw.githubusercontent.com/waveshare/LCD-show/master/waveshare32b-overlay.dtb' -o /boot/overlays/waveshare32b.dtbo
#consoleblank=0 no effect
G_EXEC sed --follow-symlinks -i 's/rootwait/rootwait fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo/' /boot/cmdline.txt
G_CONFIG_INJECT 'dtparam=i2c_arm=' 'dtparam=i2c_arm=on' /boot/config.txt
G_CONFIG_INJECT 'dtparam=spi=' 'dtparam=spi=on' /boot/config.txt
# Set FB to match res
G_CONFIG_INJECT 'framebuffer_width=' 'framebuffer_width=320' /boot/config.txt
G_CONFIG_INJECT 'framebuffer_height=' 'framebuffer_height=240' /boot/config.txt
G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_X=' "SOFTWARE_CHROMIUM_RES_X=320" /boot/dietpi.txt
G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_Y=' "SOFTWARE_CHROMIUM_RES_Y=240" /boot/dietpi.txt
G_CONFIG_INJECT 'dtoverlay=waveshare32b' 'dtoverlay=waveshare32b:rotate=270' /boot/config.txt
# Move fb0 xorg.conf out the way: https://github.com/MichaIng/DietPi/issues/767
[[ -f '/usr/share/X11/xorg.conf.d/99-fbturbo.conf' ]] && G_EXEC mv /usr/share/X11/xorg.conf.d/99-fbturbo.conf /usr/share/X11/99-fbturbo.conf
# X11
cat << '_EOF_' > /etc/X11/xorg.conf.d/99-waveshare32_xorg.conf
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "fbdev"
Option "fbdev" "/dev/fb1"
Option "SwapbuffersWait" "true"
EndSection
_EOF_
# Odroids
else
# con2fbmap, maps console (1) to panel(2). Run during boot.
cat << _EOF_ > /etc/systemd/system/con2fbmap.service
[Unit]
Description=con2fbmap
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=$(command -v con2fbmap) 1 2
ExecStop=$(command -v con2fbmap) 1 0
[Install]
WantedBy=multi-user.target
_EOF_
G_EXEC systemctl daemon-reload
G_EXEC systemctl enable con2fbmap
G_CONFIG_INJECT 'spicc' 'spicc' /etc/modules
G_CONFIG_INJECT 'fbtft_device' 'fbtft_device' /etc/modules
echo 'options fbtft_device name=odroidc_tft32 rotate=270 gpios=reset:116,dc:115 speed=32000000 cs=0' > /etc/modprobe.d/waveshare32.conf
# X11
cat << '_EOF_' > /etc/X11/xorg.conf.d/99-waveshare32_xorg.conf
Section "Device"
Identifier "FBDEV"
Driver "fbdev"
Option "fbdev" "/dev/fb2"
EndSection
_EOF_
fi
}
Lcd_Panel_Waveshare32_Disable(){
# All
[[ -f '/etc/X11/xorg.conf.d/99-waveshare32_calibration.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/99-waveshare32_calibration.conf
[[ -f '/etc/X11/xorg.conf.d/99-waveshare32_xorg.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/99-waveshare32_xorg.conf
[[ -f '/usr/share/applications/xinput_calibrator.desktop' ]] && G_EXEC rm /usr/share/applications/xinput_calibrator.desktop
# RPi
if (( $G_HW_MODEL < 10 )); then
[[ -f '/boot/overlays/waveshare32b.dtbo' ]] && G_EXEC rm /boot/overlays/waveshare32b.dtbo
G_EXEC sed --follow-symlinks -i 's/ fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo//' /boot/cmdline.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=waveshare32b/d' /boot/config.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=ads7846,cs=1,penirq=17/d' /boot/config.txt
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=w1-gpio-pullup,gpiopin=4,extpullup=1/d' /boot/config.txt
# Leave these enabled, just in case the user has other hardware that may use them.
#G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtparam=i2c_arm=/c\dtparam=i2c_arm=on' /boot/config.txt
#G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtparam=spi=/c\dtparam=spi=on' /boot/config.txt
# Move fb0 xorg.conf back: https://github.com/MichaIng/DietPi/issues/767
[[ -f '/usr/share/X11/99-fbturbo.conf' && ! -f '/usr/share/X11/xorg.conf.d/99-fbturbo.conf' ]] && G_EXEC mv /usr/share/X11/99-fbturbo.conf /usr/share/X11/xorg.conf.d/99-fbturbo.conf
# Odroids
elif (( $G_HW_MODEL < 20 )); then
if [[ -f '/etc/systemd/system/con2fbmap.service' ]]
then
G_EXEC systemctl disable --now con2fbmap
G_EXEC rm /etc/systemd/system/con2fbmap.service
fi
[[ -d '/etc/systemd/system/con2fbmap.service.d' ]] && G_EXEC rm -R /etc/systemd/system/con2fbmap.service.d
[[ -f '/etc/modprobe.d/waveshare32.conf' ]] && G_EXEC rm /etc/modprobe.d/waveshare32.conf
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*spicc/d' /etc/modules
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*fbtft_device/d' /etc/modules
fi
}
# Odroid CloudShell: ToDo: Broken after fbtft_device kernel module does not exist anymore with Linux 5.4/6.1/6.6...
Lcd_Panel_Odroidcloudshell_Enable()
{
(( $G_HW_MODEL == 11 )) || { Unsupported_Input_Mode; return 1; } # Odroid XU4 only
G_CONFIG_INJECT 'spi_s3c64xx' 'spi_s3c64xx' /etc/modules
}
Lcd_Panel_Odroidcloudshell_Disable()
{
(( $G_HW_MODEL == 11 )) || return 0
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*spi_s3c64xx[[:blank:]]*/d' /etc/modules
}
# Odroid CloudShell 2
Lcd_Panel_Odroidcloudshell2_Enable()
{
(( $G_HW_MODEL == 11 )) || { Unsupported_Input_Mode; return 1; } # Odroid XU4 only
# Device tree overlay
G_CONFIG_INJECT 'setenv[[:blank:]]+cs2enable[[:blank:]]' 'setenv cs2enable "true"' /boot/boot.ini 'ODROIDXU-UBOOT-CONFIG'
# udev rule to enable backlight power
G_EXEC eval 'echo '\''SUBSYSTEM=="backlight", KERNEL=="fb_hktft32", ACTION=="add", ATTR{bl_power}="1"'\'' > /etc/udev/rules.d/dietpi-odroid-cloudshell2.rules'
}
Lcd_Panel_Odroidcloudshell2_Disable()
{
(( $G_HW_MODEL == 11 )) || return 0
# udev rule to enable backlight power
[[ -f '/etc/udev/rules.d/dietpi-odroid-cloudshell2.rules' ]] && G_EXEC rm /etc/udev/rules.d/dietpi-odroid-cloudshell2.rules
# Device tree overlay
G_CONFIG_INJECT 'setenv[[:blank:]]+cs2enable[[:blank:]]' '#setenv cs2enable "false"' /boot/boot.ini 'ODROIDXU-UBOOT-CONFIG'
}
# Odroid LCD 3.5
Lcd_Panel_OdroidLCD35_Enable(){
(( $G_HW_MODEL > 9 )) || { Unsupported_Input_Mode; return 1; } # Exit path for non-Odroid
# Reset to disabled
Lcd_Panel_OdroidLCD35_Disable
Lcd_Panel_Xorg_All_Enable
# SPI needs to be disabled: https://github.com/MichaIng/DietPi/issues/4154
cat << '_EOF_' > /etc/modprobe.d/odroid-lcd35.conf
blacklist spidev
blacklist spi_gpio
blacklist spi_bitbang
options fbtft_device name=flexpfb rotate=90
options flexfb chip=ili9488
_EOF_
local amodules=('fbtft_device' 'flexfb' 'sx865x')
# C1/2
(( $G_HW_MODEL == 11 )) || amodules+=('aml_i2c' 'pwm-meson' 'pwm-ctrl')
for i in "${amodules[@]}"
do
# Enable modules now, as we need to detect PWM path for service
G_EXEC modprobe "$i"
G_CONFIG_INJECT "$i" "$i" /etc/modules
done
# Rebuild initramfs to exclude SPI modules: https://github.com/MichaIng/DietPi/issues/4154
G_EXEC update-initramfs -u
# Service
# - XU4
if (( $G_HW_MODEL == 11 )); then
cat << _EOF_ > /etc/systemd/system/odroid-lcd35.service
[Unit]
Description=Odroid LCD 3.5
[Path]
PathExists=/dev/fb2
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=$(command -v setterm) -blank 0 -powersave off
ExecStart=$(command -v con2fbmap) 1 2
StandardOutput=tty
[Install]
WantedBy=multi-user.target
_EOF_
# - C1/2
else
# Detect correct control files: https://github.com/MichaIng/DietPi/issues/2256
local fp_control='/sys/devices/platform/pwm-ctrl'
[[ -e '/sys/devices/pwm-ctrl/enable0' ]] && fp_control='/sys/devices/pwm-ctrl'
cat << _EOF_ > /etc/systemd/system/odroid-lcd35.service
[Unit]
Description=Odroid LCD 3.5
[Path]
PathExists=/dev/fb2
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/dash -c 'echo 500000 > $fp_control/freq0'
ExecStart=/bin/dash -c 'echo 1 > $fp_control/enable0'
ExecStart=/bin/dash -c 'echo 1023 > $fp_control/duty0'
ExecStart=$(command -v setterm) -blank 0 -powersave off
ExecStart=$(command -v con2fbmap) 1 2
StandardOutput=tty
[Install]
WantedBy=multi-user.target
_EOF_
fi
G_EXEC systemctl daemon-reload
G_EXEC systemctl enable odroid-lcd35
# X11
[[ -f '/etc/X11/xorg.conf.d/exynos.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/exynos.conf # XU4
G_EXEC mkdir -p /etc/X11/xorg.conf.d
cat << '_EOF_' > /etc/X11/xorg.conf.d/99-odroid-lcd35.conf
Section "Device"
Identifier "C fbdev"
Driver "fbdev"
Option "fbdev" "/dev/fb2"
EndSection
_EOF_
# Default calibration
cat << '_EOF_' > /etc/X11/xorg.conf.d/99-calibration.conf
Section "InputClass"
Identifier "calibration"
MatchProduct "SX865X Touchscreen"
Option "Calibration" "3854 155 3880 262"
Option "SwapAxes" "0"
EndSection
_EOF_
}
Lcd_Panel_OdroidLCD35_Disable()
{
(( $G_HW_MODEL > 9 )) || return 0 # Skip on non-Odroid
[[ -f '/etc/X11/xorg.conf.d/99-calibration.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/99-calibration.conf
[[ -f '/etc/modprobe.d/odroid-lcd35.conf' ]] && G_EXEC rm /etc/modprobe.d/odroid-lcd35.conf
if [[ -f '/etc/systemd/system/odroid-lcd35.service' ]]
then
G_EXEC systemctl disable --now odroid-lcd35
G_EXEC rm /etc/systemd/system/odroid-lcd35.service
fi
[[ -d '/etc/systemd/system/odroid-lcd35.service.d' ]] && G_EXEC rm -R /etc/systemd/system/odroid-lcd35.service.d
[[ -f '/etc/X11/xorg.conf.d/99-odroid-lcd35.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/99-odroid-lcd35.conf
}
OLED_Allo_Boss2_Enable(){
(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi
# Enable I2C
INPUT_DEVICE_VALUE='enable' I2c_Main
# Install further requirements
G_AG_CHECK_INSTALL_PREREQ python3-{rpi.gpio,pil}
# Download and install Python 3 script
G_EXEC curl -sSfLO https://raw.githubusercontent.com/allocom/allo_boss2_oled_p3/main/boss2_oled_p3.tar.gz
G_EXEC tar xf boss2_oled_p3.tar.gz
[[ -d '/opt/allo_boss2_oled' ]] && G_EXEC rm -R /opt/allo_boss2_oled
G_EXEC mv boss2_oled_p3 /opt/allo_boss2_oled