Skip to content

Commit bc04659

Browse files
committed
Install overhaul
Limit AASDK build jobs on RPi3, and raise default
1 parent fae99ae commit bc04659

File tree

9 files changed

+295
-127
lines changed

9 files changed

+295
-127
lines changed

install.sh

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ fi
3333
#check if /etc/rpi-issue exists, if not set the install Args to be false
3434
if [ -f /etc/rpi-issue ]
3535
then
36+
rpiModel=$(cat /sys/firmware/devicetree/base/model | awk '{print $3}')
37+
echo "Detected Raspberry Pi Model $rpiModel"
3638
installArgs="-DRPI_BUILD=true"
3739
isRpi=true
3840
else
@@ -191,6 +193,9 @@ if [ $pulseaudio = false ]
191193
then
192194
echo -e skipping pulseaudio '\n'
193195
else
196+
#change to project root
197+
cd $script_path
198+
194199
echo Preparing to compile and install pulseaudio
195200
echo Grabbing pulseaudio deps
196201
sudo sed -i 's/#deb-src/deb-src/g' /etc/apt/sources.list
@@ -242,6 +247,9 @@ if [ $bluez = false ]
242247
then
243248
echo -e skipping bluez '\n'
244249
else
250+
#change to project root
251+
cd $script_path
252+
245253
echo Installing bluez
246254
sudo apt-get install -y libdbus-1-dev libudev-dev libical-dev libreadline-dev libjson-c-dev
247255
wget www.kernel.org/pub/linux/bluetooth/bluez-5.63.tar.xz
@@ -258,8 +266,8 @@ fi
258266
if [ $aasdk = false ]; then
259267
echo -e Skipping aasdk '\n'
260268
else
261-
#change to parent directory
262-
cd ..
269+
#change to project root
270+
cd $script_path
263271

264272
#clone aasdk
265273
git clone $aasdkRepo
@@ -281,6 +289,10 @@ else
281289
echo -e moving to aasdk '\n'
282290
cd aasdk
283291

292+
#apply set_FIPS_mode patch
293+
echo Apply set_FIPS_mode patch
294+
git apply $script_path/patches/aasdk_openssl-fips-fix.patch
295+
284296
#create build directory
285297
echo Creating aasdk build directory
286298
mkdir build
@@ -303,7 +315,12 @@ else
303315
fi
304316

305317
#beginning make
306-
make -j2
318+
if [[ $rpiModel -lt 4 ]]; then
319+
#limit jobs on RPi 3 and below to prevent OOM freeze
320+
make -j1
321+
else
322+
make -j4
323+
fi
307324

308325
if [[ $? -eq 0 ]]; then
309326
echo -e Aasdk Make completed successfully '\n'
@@ -330,10 +347,10 @@ fi
330347
if [ $h264bitstream = false ]; then
331348
echo -e Skipping h264bitstream '\n'
332349
else
333-
#change to parent directory
334-
cd ..
350+
#change to project root
351+
cd $script_path
335352

336-
#clone aasdk
353+
#clone h264bitstream
337354
git clone $h264bitstreamRepo
338355
if [[ $? -eq 0 ]]; then
339356
echo -e h264bitstream Cloned ok '\n'
@@ -402,8 +419,8 @@ fi
402419
if [ $gstreamer = true ]; then
403420
echo installing gstreamer
404421

405-
#change to parent directory
406-
cd ..
422+
#change to project root
423+
cd $script_path
407424

408425
#clone gstreamer
409426
echo Cloning Gstreamer
@@ -435,6 +452,10 @@ if [ $gstreamer = true ]; then
435452
echo Apply greenline patch
436453
git apply $script_path/patches/greenline_fix.patch
437454

455+
#apply atomic patch
456+
echo Apply atomic patch
457+
git apply $script_path/patches/qt-gstreamer_atomic-load.patch
458+
438459
#create build directory
439460
echo Creating Gstreamer build directory
440461
mkdir build
@@ -493,8 +514,11 @@ if [ $openauto = false ]; then
493514
echo -e skipping openauto'\n'
494515
else
495516
echo Installing openauto
496-
cd ..
497517

518+
#change to project root
519+
cd $script_path
520+
521+
#clone openauto
498522
echo -e cloning openauto'\n'
499523
git clone $openautoRepo
500524
if [[ $? -eq 0 ]]; then
@@ -561,6 +585,9 @@ if [ $dash = false ]; then
561585
echo -e Skipping dash'\n'
562586
else
563587

588+
#change to project root
589+
cd $script_path
590+
564591
#create build directory
565592
echo Creating dash build directory
566593
mkdir build
@@ -608,34 +635,21 @@ else
608635
echo Dash make failed with error code $?
609636
exit 1
610637
fi
638+
cd ../
611639

612-
#Setting openGL driver and GPU memory to 128mb
640+
#Raspberry Pi addons
613641
if $isRpi; then
614-
sudo raspi-config nonint do_memory_split 128
615-
if [[ $? -eq 0 ]]; then
616-
echo -e Memory set to 128mb'\n'
642+
read -p "Configure select Raspberry Pi enhancements? (y/N) " choice
643+
if [[ $choice == "y" || $choice == "Y" ]]; then
644+
./rpi.sh
645+
exit 0
617646
else
618-
echo Setting memory failed with error code $? please set manually
619-
exit 1
647+
echo "Continuing"
620648
fi
621-
622-
sudo raspi-config nonint do_gldriver G2
623-
if [[ $? -eq 0 ]]; then
624-
echo -e OpenGL set ok'\n'
625-
else
626-
echo Setting openGL failed with error code $? please set manually
627-
exit 1
628-
fi
629-
630-
echo enabling krnbt to speed up boot and improve stability
631-
cat <<EOT >> /boot/config.txt
632-
dtparam=krnbt
633-
EOT
634649
fi
635650

636651

637652
#Start app
638653
echo Starting app
639-
cd ../bin
640-
./dash
654+
./bin/dash
641655
fi

patches/aasdk_openssl-fips-fix.patch

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 885a8c83ef4f813205fa21cd9e96228db94bcdd2 Mon Sep 17 00:00:00 2001
2+
From: "John EVANS (eva0034)" <[email protected]>
3+
Date: Sat, 6 Jan 2024 16:58:01 +1100
4+
Subject: [PATCH] Update SSLWrapper.cpp:
5+
6+
fix sslwrapper.cpp for newer openssl compilation.
7+
---
8+
src/Transport/SSLWrapper.cpp | 14 ++++++++++++++
9+
1 file changed, 14 insertions(+)
10+
11+
diff --git a/src/Transport/SSLWrapper.cpp b/src/Transport/SSLWrapper.cpp
12+
index 6aca9b44..1c770bf8 100644
13+
--- a/src/Transport/SSLWrapper.cpp
14+
+++ b/src/Transport/SSLWrapper.cpp
15+
@@ -33,13 +33,27 @@ SSLWrapper::SSLWrapper()
16+
{
17+
SSL_library_init();
18+
SSL_load_error_strings();
19+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
20+
+ /*
21+
+ * ERR_load_*(), ERR_func_error_string(), ERR_get_error_line(), ERR_get_error_line_data(), ERR_get_state()
22+
+ * OpenSSL now loads error strings automatically so these functions are not needed.
23+
+ * SEE FOR MORE:
24+
+ * https://www.openssl.org/docs/manmaster/man7/migration_guide.html
25+
+ *
26+
+ */
27+
+#else
28+
ERR_load_BIO_strings();
29+
+#endif
30+
OpenSSL_add_all_algorithms();
31+
}
32+
33+
SSLWrapper::~SSLWrapper()
34+
{
35+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
36+
+ EVP_default_properties_enable_fips(nullptr, 0);
37+
+#else
38+
FIPS_mode_set(0);
39+
+#endif
40+
ENGINE_cleanup();
41+
CONF_modules_unload(1);
42+
EVP_cleanup();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/elements/gstqtvideosink/gstqtvideosinkplugin.h b/elements/gstqtvideosink/gstqtvideosinkplugin.h
2+
index dc04671..a72c572 100644
3+
--- a/elements/gstqtvideosink/gstqtvideosinkplugin.h
4+
+++ b/elements/gstqtvideosink/gstqtvideosinkplugin.h
5+
@@ -27,7 +27,7 @@ GST_DEBUG_CATEGORY_EXTERN(gst_qt_video_sink_debug);
6+
#define DEFINE_TYPE_FULL(cpp_type, type_name, parent_type, additional_initializations) \
7+
GType cpp_type::get_type() \
8+
{ \
9+
- static volatile gsize gonce_data = 0; \
10+
+ static gsize gonce_data = 0; \
11+
if (g_once_init_enter(&gonce_data)) { \
12+
GType type = 0; \
13+
GTypeInfo info; \

rpi.sh

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
#!/bin/bash
22

33
#check if Raspian OS is active, otherwise kill script
4-
if [ -f /etc/rpi-issue ];
4+
if [ ! -f /etc/rpi-issue ]
55
then
6-
echo "Great this script works for RaspberryPI OS"
7-
else
8-
echo "This script works only for an RaspberryPI OS"
6+
echo "This script works only for Raspberry Pi OS"
97
exit 1;
108
fi
119

1210
display_version(){
13-
echo "Version 0.2 RaspberryPI Dash additional install helpers"
11+
echo "Version 0.3 Raspberry Pi Dash additional install helpers"
1412
}
1513

1614
#########################
@@ -22,6 +20,9 @@ display_help() {
2220
echo " -arb, --addrulebrightness Add udev rules for brightness"
2321
echo " -adi, --adddesktopicon Add desktop icon"
2422
echo " -asd, --autostartdaemon Add autostart daemon"
23+
echo " -mem, --memorysplit Set memory split"
24+
echo " -gl, --gldriver Set GL driver"
25+
echo " -krn, --krnbt Set krnbt flag"
2526
echo " -v, --version Show version of script"
2627
echo " -h, --help Show help of script"
2728
echo
@@ -35,6 +36,16 @@ display_help() {
3536
echo "Example: Add autostart daemon on your RPI."
3637
echo " rpi -asd"
3738
echo
39+
echo "Example: Set memory split on your RPI."
40+
echo " rpi -mem 128"
41+
echo
42+
echo "Example: Set GL driver on your RPI."
43+
echo " rpi -gl [G2|G1]"
44+
echo " KMS (G2) / Fake KMS (G1)"
45+
echo
46+
echo "Example: Set krnbt flag on your RPI."
47+
echo " rpi -krn"
48+
echo
3849
exit 1
3950
}
4051

@@ -47,19 +58,35 @@ do
4758
#echo "$1"
4859
case "$1" in
4960
-arb | --addrulebrightness)
50-
/bin/bash src/bash/brightness.sh
61+
/bin/bash src/bash/rpi_helpers.sh setup_brightness_udev_rule
5162
exit 0
5263
;;
5364
-adi | --adddesktopicon)
54-
/bin/bash src/bash/desktop.sh
65+
/bin/bash src/bash/rpi_helpers.sh add_desktop_icon
5566
exit 0
5667
;;
5768
-asd | --autostartdaemon)
5869
if [ $# -ne 0 ]; then
59-
/bin/bash src/bash/autostartdaemon.sh $2
70+
/bin/bash src/bash/rpi_helpers.sh create_autostart_daemon $2
71+
exit 0
72+
fi
73+
;;
74+
-mem | --memorysplit)
75+
if [ $# -ne 0 ]; then
76+
/bin/bash src/bash/rpi_helpers.sh set_memory_split $2
6077
exit 0
6178
fi
6279
;;
80+
-gl | --gldriver)
81+
if [ $# -ne 0 ]; then
82+
/bin/bash src/bash/rpi_helpers.sh set_opengl $2
83+
exit 0
84+
fi
85+
;;
86+
-krn | --krnbt)
87+
/bin/bash src/bash/rpi_helpers.sh enable_krnbt
88+
exit 0
89+
;;
6390
-h | --help)
6491
display_help # Call your function
6592
exit 0
@@ -68,7 +95,10 @@ do
6895
display_version # Call your function
6996
exit 0
7097
;;
71-
98+
"") # If $1 is blank, run display_help
99+
display_help
100+
exit 0
101+
;;
72102
--) # End of all options
73103
shift
74104
break

src/bash/autostartdaemon.sh

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/bash/brightness.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)