first commit

This commit is contained in:
Your Name
2026-02-07 20:22:48 +08:00
commit 1b9711d5e4
2270 changed files with 805872 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#!/bin/bash
if [[ -z $1 ]]; then
user=root
else
user=$1
fi
[[ -d /lib/systemd/system/getty@.service.d/ ]] && rm /lib/systemd/system/getty@.service.d/ -rf
[[ -f /lib/systemd/system/serial-getty@.service.d/override.conf ]] && rm /lib/systemd/system/serial-getty@.service.d/override.conf -f
[[ -d /etc/systemd/system/getty@.service.d/ ]] && rm /etc/systemd/system/getty@.service.d/ -rf
[[ -f /etc/systemd/system/serial-getty@.service.d/override.conf ]] && rm /etc/systemd/system/serial-getty@.service.d/override.conf -f
if [[ $1 == "-d" ]]; then
exit
fi
mkdir -p /etc/systemd/system/getty@.service.d/
mkdir -p /etc/systemd/system/serial-getty@.service.d/
cat <<-EOF > \
/etc/systemd/system/serial-getty@.service.d/override.conf
[Service]
ExecStartPre=/bin/sh -c 'exec /bin/sleep 10'
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin ${user} %I \$TERM
Type=idle
EOF
cp /etc/systemd/system/serial-getty@.service.d/override.conf \
/etc/systemd/system/getty@.service.d/override.conf

View File

@@ -0,0 +1,3 @@
#!/bin/bash
cat /proc/cpuinfo | grep "Serial"

View File

@@ -0,0 +1,20 @@
#!/bin/bash
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev \
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \
libreadline-dev libffi-dev curl libbz2-dev
version=3.9.9
[[ -n $1 ]] && version=$1
# optimize build time with 100% CPU usage
CPUS=$(grep -c 'processor' /proc/cpuinfo)
CTHREADS="-j$((CPUS + CPUS/2))"
wget https://cdn.npmmirror.com/binaries/python/$version/Python-${version}.tgz
tar xvf Python-${version}.tgz
cd Python-${version}
./configure --enable-optimizations
make ${CTHREADS}
sudo make altinstall

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
#!/bin/bash
if [[ -z $1 ]]; then
user=root
else
user=$1
fi
sudo sed -i '/autologin-user=/d' /etc/lightdm/lightdm.conf.d/22-orangepi-autologin.conf
sudo echo autologin-user=${user} >> /etc/lightdm/lightdm.conf.d/22-orangepi-autologin.conf
sudo sed -i 's/root/anything/' /etc/pam.d/lightdm-autologin

View File

@@ -0,0 +1,5 @@
#!/bin/bash
sudo sed -i \
"s/autologin-user=.*/#&/" \
/etc/lightdm/lightdm.conf.d/22-orangepi-autologin.conf

View File

@@ -0,0 +1,77 @@
#!/bin/bash -x
export DISPLAY=${DISPLAY:-:0}
function prepare_env() {
# Try to figure out XAUTHORITY and DISPLAY
for pid in $(pgrep X 2>/dev/null || \
ls /proc|grep -ow "[0-9]*"|sort -rn); do
PROC_DIR=/proc/$pid
# Filter out non-X processes
readlink $PROC_DIR/exe|grep -qwE "X$|Xorg$" || continue
# Parse auth file and display from cmd args
export XAUTHORITY=$(cat $PROC_DIR/cmdline|tr '\0' '\n'| \
grep -w "\-auth" -A 1|tail -1)
export DISPLAY=$(cat $PROC_DIR/cmdline|tr '\0' '\n'| \
grep -w "^:.*" || echo ":0")
logger -t $0 "Found auth: $XAUTHORITY for dpy: $DISPLAY"
return
done
}
function xrandr_wrapper() {
xrandr --screen ${SCREEN:-0} $@
}
if ! xdpyinfo &>/dev/null; then
# Try to setup env
prepare_env
if ! xdpyinfo &>/dev/null; then
# Try to switch to an authorized user
for XUSER in root $(users);do
sudo -u $XUSER xdpyinfo &>/dev/null || continue
logger -t $0 "Switch to user: $XUSER"
sudo -u $XUSER $0; exit 0
done
logger -t $0 "Unable to contact Xserver!"
exit 0
fi
fi
TMP=$(mktemp)
SCREENS=$(xdpyinfo|grep screens|cut -d':' -f2)
for SCREEN in $(seq 0 ${SCREENS:-0}); do
# Get monitors and current mode info
xrandr_wrapper 2>&1|grep -oE "^.*connected|^.*\*"|tee $TMP
# Result:
# eDP-1 connected
# 1536x2048 59.99*
# DP-1 disconnected
# HDMI-1 connected
# 1920x1080 60.00*
#
# "*" means valid current mode.
# Make sure every connected monitors been enabled with a valid mode.
for MONITOR in $(grep -w connected $TMP|cut -d' ' -f1); do
# Find monitors without a valid current mode
if ! grep -w $MONITOR $TMP -A 1|grep "\*"; then
# Ether disabled or wrongly configured
xrandr_wrapper --output $MONITOR --auto
logger -t $0 "Output $MONITOR enabled."
fi
done
done
rm -rf $TMP
exit 0

View File

@@ -0,0 +1,4 @@
#!/bin/bash
sudo systemctl enable docker.service
sudo systemctl start docker.service

View File

@@ -0,0 +1,8 @@
#!/bin/bash
mmc_dev=$(ls -d -1 /dev/mmcblk* | grep -w 'mmcblk[0-9]' | cut -d '/' -f3)
sed -i "s/^rootdev=.*/rootdev=\/dev\/${mmc_dev}p2/" /boot/orangepiEnv.txt
sed -i '/boot/d' /etc/fstab
echo "/dev/${mmc_dev}p1 /boot vfat defaults 0 2" >> /etc/fstab
echo "Done"

View File

@@ -0,0 +1,9 @@
#!/bin/bash
while true; do
gpu_load=$(cat /sys/devices/platform/fb000000.gpu/devfreq/fb000000.gpu/load | cut -d "@" -f 1)
echo $(date "+%H:%M:%S") : GPU load is : ${gpu_load}%
sleep 1
done

View File

@@ -0,0 +1,4 @@
#!/bin/bash
wget -O install.sh \
http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh

View File

@@ -0,0 +1,17 @@
#!/bin/bash
distributor_id=$(lsb_release -is)
distributor_id=${distributor_id,}
sudo apt-get remove -y docker docker-engine docker-ce docker.io
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://repo.huaweicloud.com/docker-ce/linux/${distributor_id}/gpg | sudo apt-key add -
echo "deb [arch=$(dpkg --print-architecture)] https://repo.huaweicloud.com/docker-ce/linux/${distributor_id} $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo groupadd docker
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,19 @@
#!/bin/bash
release=$(lsb_release -cs)
sudo apt update
if [[ $release =~ focal|bionic|buster ]]; then
sudo apt-get -y install qt5-default qttools5-dev-tools qtbase5-doc-html qt5-assistant qt5-doc
elif [[ $release =~ bullseye|bookworm|jammy ]]; then
sudo apt-get -y install qttools5-dev-tools qtbase5-doc-html qt5-assistant qt5-doc qt5-qmake qt5-qmake-bin
else
echo "Unsupported system!"
exit
fi
sudo apt-get -y install qtcreator qmlscene gdb qtdeclarative5-dev qtbase5-examples cmake
sudo chown orangepi:orangepi /usr/lib/aarch64-linux-gnu/qt5/examples -R
qmake -v

View File

@@ -0,0 +1,74 @@
#!/bin/bash
#mirror_url=http://mirrors.ustc.edu.cn
mirror_url=https://repo.huaweicloud.com
if [[ -n $1 && $1 =~ ros1|ros2 ]]; then
version=$1
else
echo "usage: install_ros.sh ros1/ros2"
exit
fi
release=$(lsb_release -cs)
if [[ $version == "ros1" && $release =~ focal ]]; then
[[ -f /etc/apt/sources.list.d/ros-latest.list ]] && sudo rm /etc/apt/sources.list.d/ros-latest.list
sudo sh -c "echo deb ${mirror_url}/ros/ubuntu $(lsb_release -sc) main > /etc/apt/sources.list.d/ros1.list"
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt install -y ros-noetic-desktop-full
sudo sh -c 'echo "source /opt/ros/noetic/setup.bash" >> /root/.bashrc'
echo "source /opt/ros/noetic/setup.bash" >> /home/orangepi/.bashrc
sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
sudo sh -c 'echo "151.101.84.133 raw.githubusercontent.com" >> /etc/hosts'
source /opt/ros/noetic/setup.bash
sudo rosdep init
rosdep update
exit
fi
if [[ $version == "ros2" && $release =~ focal ]]; then
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
echo "deb [arch=$(dpkg --print-architecture)] ${mirror_url}/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt install -y ros-galactic-desktop
sudo apt install -y ros-dev-tools
sudo sh -c 'echo "source /opt/ros/galactic/setup.bash" >> /root/.bashrc'
echo "source /opt/ros/galactic/setup.bash" >> /home/orangepi/.bashrc
source /opt/ros/galactic/setup.bash
ros2 -h
exit
fi
if [[ $version == "ros2" && $release =~ jammy ]]; then
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
echo "deb [arch=$(dpkg --print-architecture)] ${mirror_url}/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt install -y ros-humble-desktop
sudo apt install -y ros-dev-tools
sudo sh -c 'echo "source /opt/ros/humble/setup.bash" >> /root/.bashrc'
echo "source /opt/ros/humble/setup.bash" >> /home/orangepi/.bashrc
source /opt/ros/humble/setup.bash
ros2 -h
exit
fi
echo "Unsupported System!"

BIN
external/packages/bsp/rk3588/usr/local/bin/io vendored Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
#!/bin/bash
sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server

View File

@@ -0,0 +1,4 @@
#!/bin/bash
sudo bash -c "echo device > /sys/kernel/debug/usb/fc000000.usb/mode"
sudo systemctl restart usbdevice

View File

@@ -0,0 +1,37 @@
#!/bin/bash
if [[ -n $1 && $1 =~ left|right|inverted|none ]]; then
type=$1
else
echo "usage: set_lcd_rotate.sh [left|right|inverted|none]"
exit
fi
case $1 in
left)
rotate=3
matrix="0 -1 1 1 0 0 0 0 1"
;;
right)
rotate=1
matrix="0 1 0 -1 0 1 0 0 1"
;;
inverted)
rotate=2
matrix="-1 0 1 0 -1 1 0 0 1"
;;
none)
rotate=0
matrix="1 0 0 0 1 0 0 0 1"
;;
esac
sudo sed -i '/TransformationMatrix/d' /usr/share/X11/xorg.conf.d/40-libinput.conf
sudo sed -i "/libinput touchscreen catchall/a Option \"TransformationMatrix\" \"${matrix}\"" /usr/share/X11/xorg.conf.d/40-libinput.conf
sudo sed -i '/extraargs=fbcon=rotate/d' /boot/orangepiEnv.txt
sudo bash -c "echo extraargs=fbcon=rotate:${rotate} >> /boot/orangepiEnv.txt"
sudo sed -i 's/bootlogo=true/bootlogo=false/g' /boot/orangepiEnv.txt
sudo sync
sudo reboot

View File

@@ -0,0 +1,9 @@
#!/bin/bash
sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
sudo chmod 0600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo sed -i '/swapfile/d' /etc/fstab
sudo bash -c 'echo "/swapfile swap swap sw 0 0" >> /etc/fstab'

View File

@@ -0,0 +1,21 @@
#!/bin/bash
[[ -d ~/.vnc ]] && rm -rf ~/.vnc
vncserver
vncserver -kill :1
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
cat <<-EOF > \
~/.vnc/xstartup
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
EOF
chmod +x ~/.vnc/xstartup
vncserver
sudo chown orangepi:root .Xauthority
sync

Binary file not shown.

View File

@@ -0,0 +1,38 @@
#!/bin/bash
export DISPLAY=:0.0
#export GST_DEBUG=*:5
#export GST_DEBUG_FILE=/tmp/2.txt
echo "Start MIPI CSI Camera Preview!"
export XDG_RUNTIME_DIR=/run/user/1000
patterns="rkisp0-vir0 rkisp0-vir1 rkisp0-vir2 rkisp1-vir0 rkisp1-vir1 rkisp1-vir2"
devices_info=$(v4l2-ctl --list-devices)
#devices_id=("/dev/video44" "/dev/video53" "/dev/video62" "/dev/video71")
for pattern in $patterns; do
devices_id+=("$(echo "$devices_info" | awk -v pattern="$pattern" '$0 ~ pattern {getline; print $NF}')")
done
for device_id in "${devices_id[@]}"; do
if [[ -c "$device_id" ]]; then
gst-launch-1.0 v4l2src device=$device_id io-mode=4 ! \
video/x-raw,format=NV12,width=720,height=576,framerate=15/1 ! xvimagesink > /dev/null 2>&1 &
fi
done
echo "[Ctrl + C] exit"
while true
do
sleep 10
done
trap 'onCtrlC' INT
function onCtrlC () {
echo 'Ctrl+C is captured'
killall gst-launch-1.0
exit 0
}

View File

@@ -0,0 +1,11 @@
#!/bin/bash
export DISPLAY=:0.0
#export GST_DEBUG=*:5
#export GST_DEBUG_FILE=/tmp/2.txt
# xv vo
while true
do
mpv --hwdec=rkmpp --vd-lavc-software-fallback=no --vo=xv /usr/local/test.mp4
done

View File

@@ -0,0 +1,14 @@
#!/bin/bash
export DISPLAY=:0.0
if [[ -z $1 ]]; then
video=/usr/local/test.mp4
else
video=$1
fi
while true
do
gst-play-1.0 $video --videosink=xvimagesink
done

View File

@@ -0,0 +1,63 @@
#!/bin/bash
if [[ -n $1 && $1 =~ main|headset ]]; then
type=$1
else
echo "usage: test_record.sh main/headset"
exit
fi
source /etc/orangepi-release
card=$(aplay -l | grep "es8388" | cut -d ':' -f 1 | cut -d ' ' -f 2)
hdmi0_card=$(aplay -l | grep "hdmi0" | cut -d ':' -f 1 | cut -d ' ' -f 2)
if [[ ${BOARD} == orangepi5ultra ]]; then
hdmi1_card=$(aplay -l | grep "hdmi1" | cut -d ':' -f 1 | cut -d ' ' -f 2)
fi
if [[ $type == "main" ]]; then
amixer -c $card cset name='ALC Capture Max PGA' 4 >/dev/null
amixer -c $card cset name='ALC Capture Min PGA' 2 >/dev/null
amixer -c $card cset name='Capture Digital Volume' 192 >/dev/null
amixer -c $card cset name='Left Channel Capture Volume' 4 >/dev/null
amixer -c $card cset name='Right Channel Capture Volume' 4 >/dev/null
if [[ ${BOARD} == orangepi900 ]]; then
amixer -c $card cset name='Left Line Mux' 'Line 2L' >/dev/null
amixer -c $card cset name='Right Line Mux' 'Line 2R' >/dev/null
amixer -c $card cset name='Left Mixer Left Playback Switch' 'on' >/dev/null
else
amixer -c $card cset name='Left PGA Mux' 'Line 2L' >/dev/null
amixer -c $card cset name='Right PGA Mux' 'Line 2R' >/dev/null
amixer -c $card cset name='Differential Mux' 'Line 2' >/dev/null
fi
else
amixer -c $card cset name='ALC Capture Max PGA' 2 >/dev/null
amixer -c $card cset name='ALC Capture Min PGA' 1 >/dev/null
amixer -c $card cset name='Capture Digital Volume' 192 >/dev/null
amixer -c $card cset name='Left Channel Capture Volume' 4 >/dev/null
amixer -c $card cset name='Right Channel Capture Volume' 4 >/dev/null
if [[ ${BOARD} == orangepi900 ]]; then
amixer -c $card cset name='Left Line Mux' 'Line 1L' >/dev/null
amixer -c $card cset name='Right Line Mux' 'Line 1R' >/dev/null
amixer -c $card cset name='Left Mixer Left Playback Switch' 'off' >/dev/null
else
amixer -c $card cset name='Left PGA Mux' 'Line 1L' >/dev/null
amixer -c $card cset name='Right PGA Mux' 'Line 1R' >/dev/null
amixer -c $card cset name='Differential Mux' 'Line 1' >/dev/null
fi
fi
echo "Start recording: /tmp/test.wav"
arecord -D hw:${card},0 -d 5 -f cd -t wav /tmp/test.wav
echo "Start playing"
aplay /tmp/test.wav -D hw:${card},0
if [[ ${BOARD} == orangepi5ultra ]]; then
aplay /tmp/test.wav -D hw:${hdmi1_card},0
else
aplay /tmp/test.wav -D hw:${hdmi0_card},0
fi

View File

@@ -0,0 +1,7 @@
#!/bin/sh
echo "Start RKNN_DEMO Camera Preview!"
echo performance | tee $(find /sys/ -name *governor)
sudo service lightdm stop
/usr/bin/npu_transfer_proxy&
rknn_demo

View File

@@ -0,0 +1,29 @@
#!/bin/bash
if [[ -f /opt/ros/noetic/setup.bash ]]; then
source /opt/ros/noetic/setup.bash
roscore &
sleep 5
rosrun turtlesim turtlesim_node &
rosrun turtlesim turtle_teleop_key
fi
if [[ -f /opt/ros/galactic/setup.bash ]]; then
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_cpp talker &
ros2 run demo_nodes_py listener
fi
if [[ -f /opt/ros/humble/setup.bash ]]; then
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker &
ros2 run demo_nodes_py listener
fi

View File

@@ -0,0 +1,13 @@
#!/bin/sh
export DISPLAY=:0.0
#export GST_DEBUG=*:5
#export GST_DEBUG_FILE=/tmp/2.txt
# server:
# vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-width=640 \
# :v4l2-height=480 --sout="#transcode{vcodec=h264,vb=800,scale=1,\
# acodec=mp4a,ab=128,channels=2,samplerate=44100}:rtp{sdp=rtsp://:8554/}" -I dummy
gst-launch-1.0 rtspsrc location=rtsp://192.168.31.163:8554/ ! \
! rtph264depay ! h264parse ! mppvideodec ! rkximagesink sync=false

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
#!/bin/bash
echo host > /sys/kernel/debug/usb/fc000000.usb/mode

View File

@@ -0,0 +1,5 @@
#!/bin/bash
sudo bash -c "echo 0x100 > /sys/module/rk_vcodec/parameters/mpp_dev_debug"
sudo dmesg -c > /dev/null
dmesg -w