-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_system.sh
More file actions
169 lines (131 loc) Β· 4.9 KB
/
Copy pathsetup_system.sh
File metadata and controls
169 lines (131 loc) Β· 4.9 KB
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
#!/bin/bash
set -euo pipefail
# =============================================================================
# Raspberry Pi 5 - Hailo System Preparation
# =============================================================================
# Prepares Raspberry Pi 5 for running Hailo AI applications
echo "π Starting Raspberry Pi 5 Hailo System Preparation..."
# =============================================================================
# 1. Update OS
# =============================================================================
echo "π¦ Updating system packages..."
sudo apt update
sudo apt upgrade -y
# =============================================================================
# 2. Install Essential Dependencies
# =============================================================================
echo "π§ Installing essential dependencies..."
sudo apt install -y \
python3 \
python3-pip \
python3-venv \
python3-gi \
python3-gi-cairo \
gstreamer1.0-tools \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
git \
curl \
wget
# =============================================================================
# 3. Install Hailo Packages
# =============================================================================
echo "π€ Installing Hailo packages..."
# Install Hailo packages
sudo apt install -y hailo-all
# Check if HailoRT driver is available
echo "π Checking HailoRT driver installation..."
if ! lsmod | grep -q "hailo" && ! command -v hailortcli &> /dev/null; then
echo "β οΈ HailoRT driver not found, installing manually..."
# Install build dependencies
sudo apt install -y build-essential linux-headers-$(uname -r) raspberrypi-kernel-headers
# Clone and build HailoRT drivers
echo "π₯ Cloning HailoRT drivers..."
git clone --depth 1 -b v4.20.0 https://github.com/hailo-ai/hailort-drivers.git
cd hailort-drivers/linux/pcie
echo "π¨ Building HailoRT drivers..."
make clean && make all
sudo make install
# Install udev rules
sudo install -m644 51-hailo-udev.rules /etc/udev/rules.d/
# Update kernel modules
sudo depmod -a
# Reload udev rules
sudo udevadm control --reload-rules && sudo udevadm trigger
# Load Hailo PCI module
sudo modprobe hailo_pci
cd ../..
echo "β
HailoRT drivers installed manually"
else
echo "β
HailoRT drivers already available"
fi
# =============================================================================
# 4. PCIe Gen 3 Enablement (Raspberry Pi 5)
# =============================================================================
echo "π Enabling PCIe Gen 3 speed..."
# Enable PCIe Gen 3 in config.txt (newer Raspberry Pi OS)
if ! grep -q "pcie_gen3=1" /boot/firmware/config.txt; then
echo "pcie_gen3=1" | sudo tee -a /boot/firmware/config.txt
echo "β
PCIe Gen 3 enabled in /boot/firmware/config.txt"
else
echo "β
PCIe Gen 3 already enabled"
fi
# =============================================================================
# 5. Device Access Setup
# =============================================================================
echo "π Setting up device access..."
# Create udev rules for radar devices
cat << 'EOF' | sudo tee /etc/udev/rules.d/99-radar.rules
# Radar device rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d3", MODE="0666",SYMLINK+="ttyACMr"
EOF
# Reload udev rules
sudo udevadm control --reload-rules
sudo udevadm trigger
# Add user to video and dialout groups for device access
sudo usermod -a -G video,dialout $USER
echo "β
Device access configured (Radar)"
# =============================================================================
# 6. Verification
# =============================================================================
echo "π Verifying installation..."
# Check HailoRT
if command -v hailortcli &> /dev/null; then
echo "β
HailoRT CLI available"
else
echo "β HailoRT CLI not found"
fi
# Check TAPPAS
if dpkg -l | grep -q hailo-tappas-core; then
echo "β
Hailo TAPPAS installed"
else
echo "β Hailo TAPPAS not found"
fi
# Check GStreamer
if command -v gst-launch-1.0 &> /dev/null; then
echo "β
GStreamer available"
else
echo "β GStreamer not found"
fi
# Check Python
if command -v python3 &> /dev/null; then
echo "β
Python3 available"
else
echo "β Python3 not found"
fi
# =============================================================================
# 7. Final Instructions
# =============================================================================
echo
echo "π Raspberry Pi 5 Hailo preparation completed!"
echo
echo "Your system is now ready to run Hailo AI applications."
echo
echo "Next steps:"
echo "1. Reboot your system: sudo reboot"
echo "2. Connect your Hailo device"
echo "3. Run your Hailo applications"
echo
echo "Happy AI development! π"