mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-24 11:46:30 +00:00
Add Raspberry Pi 4 support
This commit is contained in:
parent
70d6fe9767
commit
8c810e4d81
1
board/raspberrypi4/cleanups.sh
Symbolic link
1
board/raspberrypi4/cleanups.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../raspberrypi/cleanups.sh
|
1
board/raspberrypi4/cmdline.txt
Normal file
1
board/raspberrypi4/cmdline.txt
Normal file
@ -0,0 +1 @@
|
||||
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro rootflags=noload panic=10 quiet loglevel=1 ipv6.disable=1
|
7
board/raspberrypi4/config.txt
Normal file
7
board/raspberrypi4/config.txt
Normal file
@ -0,0 +1,7 @@
|
||||
gpu_mem=128
|
||||
|
||||
dtparam=i2c_arm=on
|
||||
dtparam=i2s=on
|
||||
dtparam=spi=on
|
||||
dtparam=audio=on
|
||||
|
1
board/raspberrypi4/cpinitramfs.sh
Symbolic link
1
board/raspberrypi4/cpinitramfs.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../raspberrypi/cpinitramfs.sh
|
BIN
board/raspberrypi4/initrd.gz
Normal file
BIN
board/raspberrypi4/initrd.gz
Normal file
Binary file not shown.
1
board/raspberrypi4/mkimage.sh
Symbolic link
1
board/raspberrypi4/mkimage.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../raspberrypi/mkimage.sh
|
1
board/raspberrypi4/overlay/etc/board
Normal file
1
board/raspberrypi4/overlay/etc/board
Normal file
@ -0,0 +1 @@
|
||||
raspberrypi4
|
37
board/raspberrypi4/overlay/etc/init.d/S05cpufreq
Executable file
37
board/raspberrypi4/overlay/etc/init.d/S05cpufreq
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
GOV="ondemand"
|
||||
CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||
GOVDIR="/sys/devices/system/cpu/cpufreq/${GOV}"
|
||||
|
||||
|
||||
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||
|
||||
configure() {
|
||||
echo ${GOV} > ${CPUFREQDIR}/scaling_governor
|
||||
if [[ ${GOV} == "ondemand" ]]; then
|
||||
echo 50 > ${GOVDIR}/up_threshold
|
||||
echo 100000 > ${GOVDIR}/sampling_rate
|
||||
echo 50 > ${GOVDIR}/sampling_down_factor
|
||||
echo 1 > ${GOVDIR}/io_is_busy
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
msg_begin "Configuring CPU frequency"
|
||||
configure
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
;;
|
||||
|
||||
stop)
|
||||
true
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $"Usage: $0 {start}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
65
board/raspberrypi4/overlay/etc/init.d/S11throttlewatch
Executable file
65
board/raspberrypi4/overlay/etc/init.d/S11throttlewatch
Executable file
@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
CHECK_INTERVAL=30
|
||||
|
||||
|
||||
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||
|
||||
get_throttled_now() {
|
||||
t=$(vcgencmd get_throttled | cut -d '=' -f 2)
|
||||
test $((t & 1)) -ne 0 && echo -n "under-voltage "
|
||||
test $((t & 2)) -ne 0 && echo -n "arm-frequency-capped "
|
||||
test $((t & 4)) -ne 0 && echo -n "throttled "
|
||||
}
|
||||
|
||||
get_throttled_since_boot() {
|
||||
t=$(vcgencmd get_throttled | cut -d '=' -f 2)
|
||||
test $((t & 65536)) -ne 0 && echo -n "under-voltage "
|
||||
test $((t & 131072)) -ne 0 && echo -n "arm-frequency-capped "
|
||||
test $((t & 262144)) -ne 0 && echo -n "throttled "
|
||||
}
|
||||
|
||||
watch_now() {
|
||||
while true; do
|
||||
t=$(get_throttled_now)
|
||||
if [[ -n "${t}" ]]; then
|
||||
logger -t throttlewatch -s "currently: ${t}"
|
||||
fi
|
||||
|
||||
sleep ${CHECK_INTERVAL}
|
||||
done
|
||||
}
|
||||
|
||||
watch_since_boot() {
|
||||
while true; do
|
||||
t=$(get_throttled_since_boot)
|
||||
if [[ -n "${t}" ]]; then
|
||||
logger -t throttlewatch -s "since boot: ${t}"
|
||||
break
|
||||
fi
|
||||
|
||||
sleep ${CHECK_INTERVAL}
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
msg_begin "Starting throttle watcher"
|
||||
watch_now &
|
||||
watch_since_boot &
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
;;
|
||||
|
||||
stop)
|
||||
msg_begin "Stopping throttle watcher"
|
||||
ps | grep throttlewatch | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
46
board/raspberrypi4/overlay/etc/init.d/S13btuart
Executable file
46
board/raspberrypi4/overlay/etc/init.d/S13btuart
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
SYS_CONF="/etc/bluetooth.conf"
|
||||
BOOT_CONF="/boot/bluetooth.conf"
|
||||
CONF="/data/etc/bluetooth.conf"
|
||||
|
||||
|
||||
test -f ${CONF} || test -f ${BOOT_CONF} || test -f ${SYS_CONF} || exit 0
|
||||
|
||||
test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected
|
||||
|
||||
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||
|
||||
function start() {
|
||||
if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then
|
||||
if [[ "$(wc -c /proc/device-tree/soc/gpio@7e200000/uart0_pins/brcm\,pins | cut -f 1 -d ' ')" = " 16" ]] ; then
|
||||
/usr/bin/hciattach -t5 /dev/serial1 bcm43xx 3000000 flow - &>/dev/null
|
||||
else
|
||||
/usr/bin/hciattach -t5 /dev/serial1 bcm43xx 921600 noflow - &>/dev/null
|
||||
fi
|
||||
else
|
||||
/usr/bin/hciattach -t5 /dev/serial1 bcm43xx 460800 noflow - &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
msg_begin "Attaching UART bluetooth modem"
|
||||
# for some reason, sometimes the hciattach command needs to be run twice
|
||||
(start || start) &>/dev/null &
|
||||
msg_background
|
||||
;;
|
||||
|
||||
stop)
|
||||
msg_begin "Detaching UART bluetooth modem"
|
||||
killall hciattach &>/dev/null
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $"Usage: $0 {start}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
5
board/raspberrypi4/overlay/etc/init.d/boardsn
Executable file
5
board/raspberrypi4/overlay/etc/init.d/boardsn
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
sn=$(cat /proc/cpuinfo | grep Serial | tr -d ' ' | cut -d ':' -f 2)
|
||||
echo ${sn: -8}
|
||||
|
1
board/raspberrypi4/overlay/etc/ld.so.preload
Normal file
1
board/raspberrypi4/overlay/etc/ld.so.preload
Normal file
@ -0,0 +1 @@
|
||||
/usr/lib/libarmmem.so
|
@ -0,0 +1 @@
|
||||
blacklist rtl8192cu
|
3
board/raspberrypi4/overlay/etc/modules
Normal file
3
board/raspberrypi4/overlay/etc/modules
Normal file
@ -0,0 +1,3 @@
|
||||
i2c-bcm2708
|
||||
i2c-dev
|
||||
|
32
board/raspberrypi4/overlay/etc/udev/rules.d/99-com.rules
Normal file
32
board/raspberrypi4/overlay/etc/udev/rules.d/99-com.rules
Normal file
@ -0,0 +1,32 @@
|
||||
SUBSYSTEM=="input", GROUP="input", MODE="0660"
|
||||
SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"
|
||||
SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
|
||||
SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660"
|
||||
|
||||
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\
|
||||
chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
|
||||
chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\
|
||||
chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\
|
||||
'"
|
||||
|
||||
KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
|
||||
ALIASES=/proc/device-tree/aliases; \
|
||||
if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
|
||||
echo 0;\
|
||||
elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
|
||||
echo 1; \
|
||||
else \
|
||||
exit 1; \
|
||||
fi\
|
||||
'", SYMLINK+="serial%c"
|
||||
|
||||
KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
|
||||
ALIASES=/proc/device-tree/aliases; \
|
||||
if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
|
||||
echo 0; \
|
||||
elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
|
||||
echo 1; \
|
||||
else \
|
||||
exit 1; \
|
||||
fi \
|
||||
'", SYMLINK+="serial%c"
|
BIN
board/raspberrypi4/overlay/lib/firmware/BCM43430A1.hcd
Normal file
BIN
board/raspberrypi4/overlay/lib/firmware/BCM43430A1.hcd
Normal file
Binary file not shown.
BIN
board/raspberrypi4/overlay/usr/bin/hciattach
Executable file
BIN
board/raspberrypi4/overlay/usr/bin/hciattach
Executable file
Binary file not shown.
5
board/raspberrypi4/overlay/usr/libexec/fw-prepare-boot
Executable file
5
board/raspberrypi4/overlay/usr/libexec/fw-prepare-boot
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo >> /boot/config.txt
|
||||
echo "initramfs initrd.gz" >> /boot/config.txt
|
||||
|
10
board/raspberrypi4/overlay/usr/libexec/fw-restore-boot-cfg
Executable file
10
board/raspberrypi4/overlay/usr/libexec/fw-restore-boot-cfg
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <old_boot>" 1>&2
|
||||
exit -1
|
||||
fi
|
||||
|
||||
old_boot=$1
|
||||
cp ${old_boot}/config.txt /boot
|
||||
|
14
board/raspberrypi4/postscript.sh
Executable file
14
board/raspberrypi4/postscript.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
RPI_FW_DIR=${TARGET}/../images/rpi-firmware
|
||||
|
||||
cp ${BOARD_DIR}/config.txt ${BOOT_DIR}
|
||||
cp ${BOARD_DIR}/cmdline.txt ${BOOT_DIR}
|
||||
cp ${BOARD_DIR}/initrd.gz ${BOOT_DIR}
|
||||
cp ${IMG_DIR}/zImage ${BOOT_DIR}/kernel.img
|
||||
cp ${IMG_DIR}/bcm2711-rpi-4-b.dtb ${BOOT_DIR}
|
||||
cp ${RPI_FW_DIR}/bootcode.bin ${BOOT_DIR}
|
||||
cp ${RPI_FW_DIR}/start4.elf ${BOOT_DIR}
|
||||
cp ${RPI_FW_DIR}/fixup4.dat ${BOOT_DIR}
|
80
configs/raspberrypi4_defconfig
Normal file
80
configs/raspberrypi4_defconfig
Normal file
@ -0,0 +1,80 @@
|
||||
BR2_arm=y
|
||||
BR2_cortex_a7=y
|
||||
BR2_ARM_FPU_NEON_VFPV4=y
|
||||
BR2_CCACHE=y
|
||||
BR2_CCACHE_DIR="$(TOPDIR)/.buildroot-ccache-raspberrypi4"
|
||||
BR2_OPTIMIZE_2=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TARGET_OPTIMIZATION="-pipe"
|
||||
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
|
||||
BR2_TARGET_TZ_INFO=y
|
||||
BR2_ROOTFS_OVERLAY="board/common/overlay board/raspberrypi4/overlay"
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/common/postscript.sh"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/6e787b87ace9f945f17a9022288e2758ed281cf7.tar.gz"
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
|
||||
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2711-rpi-4-b"
|
||||
BR2_PACKAGE_BUSYBOX_CONFIG="board/common/busybox.config"
|
||||
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
|
||||
BR2_PACKAGE_ALSA_UTILS=y
|
||||
BR2_PACKAGE_ALSA_UTILS_APLAY=y
|
||||
BR2_PACKAGE_GZIP=y
|
||||
BR2_PACKAGE_JQ=y
|
||||
BR2_PACKAGE_E2FSPROGS=y
|
||||
BR2_PACKAGE_NTFS_3G=y
|
||||
BR2_PACKAGE_B43_FIRMWARE=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_7010=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9170=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XX=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XXX=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8797=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8897=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y
|
||||
BR2_PACKAGE_RPI_FIRMWARE=y
|
||||
BR2_PACKAGE_RPI_FIRMWARE_X=y
|
||||
BR2_PACKAGE_RPI_ARMMEM=y
|
||||
BR2_PACKAGE_RPI_USERLAND=y
|
||||
BR2_PACKAGE_USB_MODESWITCH_DATA=y
|
||||
BR2_PACKAGE_CA_CERTIFICATES=y
|
||||
BR2_PACKAGE_LIBSSH2=y
|
||||
BR2_PACKAGE_LIBFUSE=y
|
||||
BR2_PACKAGE_LIBCURL=y
|
||||
BR2_PACKAGE_CURL=y
|
||||
BR2_PACKAGE_LIBCAP=y
|
||||
BR2_PACKAGE_PCRE=y
|
||||
BR2_PACKAGE_PCRE_UCP=y
|
||||
BR2_PACKAGE_AUTOSSH=y
|
||||
BR2_PACKAGE_CRDA=y
|
||||
BR2_PACKAGE_DHCP=y
|
||||
BR2_PACKAGE_DHCP_CLIENT=y
|
||||
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
|
||||
BR2_PACKAGE_IPTABLES=y
|
||||
BR2_PACKAGE_IW=y
|
||||
BR2_PACKAGE_NETCAT=y
|
||||
BR2_PACKAGE_NET_TOOLS=y
|
||||
BR2_PACKAGE_NTP=y
|
||||
BR2_PACKAGE_NTP_NTPDATE=y
|
||||
BR2_PACKAGE_OPENSSH=y
|
||||
BR2_PACKAGE_PPPD=y
|
||||
BR2_PACKAGE_WIRELESS_TOOLS=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_EAP=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_WPS=y
|
||||
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
|
||||
BR2_PACKAGE_BASH=y
|
||||
BR2_PACKAGE_LOGROTATE=y
|
||||
BR2_PACKAGE_TAR=y
|
||||
BR2_PACKAGE_UTIL_LINUX_BINARIES=y
|
||||
BR2_PACKAGE_UTIL_LINUX_PARTX=y
|
||||
BR2_PACKAGE_NANO=y
|
@ -42,9 +42,17 @@ endef
|
||||
endif # INSTALL_VCDBG
|
||||
|
||||
define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
|
||||
cp $(@D)/boot/fixup4cd.dat $(@D)/boot/fixup4_cd.dat
|
||||
cp $(@D)/boot/fixup4x.dat $(@D)/boot/fixup4_x.dat
|
||||
cp $(@D)/boot/fixup4db.dat $(@D)/boot/fixup4_db.dat
|
||||
cp $(@D)/boot/start4cd.elf $(@D)/boot/start4_cd.elf
|
||||
cp $(@D)/boot/start4x.elf $(@D)/boot/start4_x.elf
|
||||
cp $(@D)/boot/start4db.elf $(@D)/boot/start4_db.elf
|
||||
$(INSTALL) -D -m 0644 $(@D)/boot/bootcode.bin $(BINARIES_DIR)/rpi-firmware/bootcode.bin
|
||||
$(INSTALL) -D -m 0644 $(@D)/boot/start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start.elf
|
||||
$(INSTALL) -D -m 0644 $(@D)/boot/fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup.dat
|
||||
$(INSTALL) -D -m 0644 $(@D)/boot/start4$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start4.elf
|
||||
$(INSTALL) -D -m 0644 $(@D)/boot/fixup4$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup4.dat
|
||||
$(INSTALL) -D -m 0644 package/rpi-firmware/config.txt $(BINARIES_DIR)/rpi-firmware/config.txt
|
||||
$(INSTALL) -D -m 0644 package/rpi-firmware/cmdline.txt $(BINARIES_DIR)/rpi-firmware/cmdline.txt
|
||||
$(RPI_FIRMWARE_INSTALL_DTB)
|
||||
|
Loading…
x
Reference in New Issue
Block a user