Skip to content

Commit

Permalink
Install overhaul
Browse files Browse the repository at this point in the history
* Address current build issues via patches

* Advise on memory limit on RPi3

* Move all RPi helpers into their own file

* Dependency folder cleanup, formatting and labels

* Provide uninstall.sh to remove linked dependencies
  • Loading branch information
breakingspell committed Jun 7, 2024
1 parent fae99ae commit de214f5
Show file tree
Hide file tree
Showing 8 changed files with 336 additions and 147 deletions.
86 changes: 53 additions & 33 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@ fi
#check if /etc/rpi-issue exists, if not set the install Args to be false
if [ -f /etc/rpi-issue ]
then
rpiModel=$(cat /sys/firmware/devicetree/base/model | awk '{print $3}')
echo "Detected Raspberry Pi Model $rpiModel"
installArgs="-DRPI_BUILD=true"
isRpi=true
else
installArgs=""
isRpi=false
fi

#check for potential resource limit
totalMem=$(free -tm | awk '/Total/ {print $2}')
if [[ $rpiModel -lt 4 && $totalMem -lt 1900 ]]; then
echo "Raspberry Pi Model $rpiModel with "$totalMem"MB RAM detected"
echo "You may run out of memory while compiling with less than 2GB"
echo "Consider raising swap space or compiling on another machine"
sleep 5;
fi

BUILD_TYPE="Release"

#check to see if there are any arguments supplied, if none are supplied run full install
Expand Down Expand Up @@ -191,6 +202,9 @@ if [ $pulseaudio = false ]
then
echo -e skipping pulseaudio '\n'
else
#change to project root
cd $script_path

echo Preparing to compile and install pulseaudio
echo Grabbing pulseaudio deps
sudo sed -i 's/#deb-src/deb-src/g' /etc/apt/sources.list
Expand Down Expand Up @@ -242,6 +256,9 @@ if [ $bluez = false ]
then
echo -e skipping bluez '\n'
else
#change to project root
cd $script_path

echo Installing bluez
sudo apt-get install -y libdbus-1-dev libudev-dev libical-dev libreadline-dev libjson-c-dev
wget www.kernel.org/pub/linux/bluetooth/bluez-5.63.tar.xz
Expand All @@ -258,8 +275,8 @@ fi
if [ $aasdk = false ]; then
echo -e Skipping aasdk '\n'
else
#change to parent directory
cd ..
#change to project root
cd $script_path

#clone aasdk
git clone $aasdkRepo
Expand All @@ -281,6 +298,10 @@ else
echo -e moving to aasdk '\n'
cd aasdk

#apply set_FIPS_mode patch
echo Apply set_FIPS_mode patch
git apply $script_path/patches/aasdk_openssl-fips-fix.patch

#create build directory
echo Creating aasdk build directory
mkdir build
Expand All @@ -303,7 +324,7 @@ else
fi

#beginning make
make -j2
make -j4

if [[ $? -eq 0 ]]; then
echo -e Aasdk Make completed successfully '\n'
Expand All @@ -330,10 +351,10 @@ fi
if [ $h264bitstream = false ]; then
echo -e Skipping h264bitstream '\n'
else
#change to parent directory
cd ..
#change to project root
cd $script_path

#clone aasdk
#clone h264bitstream
git clone $h264bitstreamRepo
if [[ $? -eq 0 ]]; then
echo -e h264bitstream Cloned ok '\n'
Expand Down Expand Up @@ -374,7 +395,7 @@ else
fi

#beginning make
make
make -j4

if [[ $? -eq 0 ]]; then
echo -e h264bitstream Make completed successfully '\n'
Expand Down Expand Up @@ -402,8 +423,8 @@ fi
if [ $gstreamer = true ]; then
echo installing gstreamer

#change to parent directory
cd ..
#change to project root
cd $script_path

#clone gstreamer
echo Cloning Gstreamer
Expand Down Expand Up @@ -435,6 +456,10 @@ if [ $gstreamer = true ]; then
echo Apply greenline patch
git apply $script_path/patches/greenline_fix.patch

#apply atomic patch
echo Apply atomic patch
git apply $script_path/patches/qt-gstreamer_atomic-load.patch

#create build directory
echo Creating Gstreamer build directory
mkdir build
Expand Down Expand Up @@ -493,8 +518,11 @@ if [ $openauto = false ]; then
echo -e skipping openauto'\n'
else
echo Installing openauto
cd ..

#change to project root
cd $script_path

#clone openauto
echo -e cloning openauto'\n'
git clone $openautoRepo
if [[ $? -eq 0 ]]; then
Expand Down Expand Up @@ -535,7 +563,8 @@ else
fi

echo Beginning openauto make
make
make -j4

if [[ $? -eq 0 ]]; then
echo -e Openauto make OK'\n'
else
Expand All @@ -561,6 +590,9 @@ if [ $dash = false ]; then
echo -e Skipping dash'\n'
else

#change to project root
cd $script_path

#create build directory
echo Creating dash build directory
mkdir build
Expand All @@ -584,7 +616,8 @@ else
fi

echo Running Dash make
make
make -j4

if [[ $? -eq 0 ]]; then
echo -e Dash make ok, executable can be found ../bin/dash
echo
Expand All @@ -608,34 +641,21 @@ else
echo Dash make failed with error code $?
exit 1
fi
cd ../

#Setting openGL driver and GPU memory to 128mb
#Raspberry Pi addons
if $isRpi; then
sudo raspi-config nonint do_memory_split 128
if [[ $? -eq 0 ]]; then
echo -e Memory set to 128mb'\n'
read -p "Configure select Raspberry Pi enhancements? (y/N) " choice
if [[ $choice == "y" || $choice == "Y" ]]; then
./rpi.sh
exit 0
else
echo Setting memory failed with error code $? please set manually
exit 1
echo "Continuing"
fi

sudo raspi-config nonint do_gldriver G2
if [[ $? -eq 0 ]]; then
echo -e OpenGL set ok'\n'
else
echo Setting openGL failed with error code $? please set manually
exit 1
fi

echo enabling krnbt to speed up boot and improve stability
cat <<EOT >> /boot/config.txt
dtparam=krnbt
EOT
fi


#Start app
echo Starting app
cd ../bin
./dash
./bin/dash
fi
42 changes: 42 additions & 0 deletions patches/aasdk_openssl-fips-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 885a8c83ef4f813205fa21cd9e96228db94bcdd2 Mon Sep 17 00:00:00 2001
From: "John EVANS (eva0034)" <evansjohn@evansautoelectrics.com.au>
Date: Sat, 6 Jan 2024 16:58:01 +1100
Subject: [PATCH] Update SSLWrapper.cpp:

fix sslwrapper.cpp for newer openssl compilation.
---
src/Transport/SSLWrapper.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/src/Transport/SSLWrapper.cpp b/src/Transport/SSLWrapper.cpp
index 6aca9b44..1c770bf8 100644
--- a/src/Transport/SSLWrapper.cpp
+++ b/src/Transport/SSLWrapper.cpp
@@ -33,13 +33,27 @@ SSLWrapper::SSLWrapper()
{
SSL_library_init();
SSL_load_error_strings();
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
+ /*
+ * ERR_load_*(), ERR_func_error_string(), ERR_get_error_line(), ERR_get_error_line_data(), ERR_get_state()
+ * OpenSSL now loads error strings automatically so these functions are not needed.
+ * SEE FOR MORE:
+ * https://www.openssl.org/docs/manmaster/man7/migration_guide.html
+ *
+ */
+#else
ERR_load_BIO_strings();
+#endif
OpenSSL_add_all_algorithms();
}

SSLWrapper::~SSLWrapper()
{
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ EVP_default_properties_enable_fips(nullptr, 0);
+#else
FIPS_mode_set(0);
+#endif
ENGINE_cleanup();
CONF_modules_unload(1);
EVP_cleanup();
13 changes: 13 additions & 0 deletions patches/qt-gstreamer_atomic-load.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/elements/gstqtvideosink/gstqtvideosinkplugin.h b/elements/gstqtvideosink/gstqtvideosinkplugin.h
index dc04671..a72c572 100644
--- a/elements/gstqtvideosink/gstqtvideosinkplugin.h
+++ b/elements/gstqtvideosink/gstqtvideosinkplugin.h
@@ -27,7 +27,7 @@ GST_DEBUG_CATEGORY_EXTERN(gst_qt_video_sink_debug);
#define DEFINE_TYPE_FULL(cpp_type, type_name, parent_type, additional_initializations) \
GType cpp_type::get_type() \
{ \
- static volatile gsize gonce_data = 0; \
+ static gsize gonce_data = 0; \
if (g_once_init_enter(&gonce_data)) { \
GType type = 0; \
GTypeInfo info; \
Loading

0 comments on commit de214f5

Please sign in to comment.