[Sigmastar] Add initial support for infinity6e platform (#674)

Co-authored-by: Viktor <viktorxda@users.noreply.github.com>
pull/677/head
viktorxda 2023-03-16 17:32:29 +01:00 committed by GitHub
parent 91bbc3fb54
commit eb6ea6e785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 866512 additions and 1 deletions

View File

@ -33,6 +33,7 @@ source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/rtl8192eu-openipc/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/rtl8733bu-openipc/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/sigmastar-osdrv-msc313e/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/sigmastar-osdrv-ssc335/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/sigmastar-osdrv-infinity6e/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/ssw101b/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/uacme-openipc/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/vtund-openipc/Config.in"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,104 @@
# Architecture
BR2_arm=y
BR2_cortex_a7=y
BR2_ARM_EABIHF=y
BR2_ARM_FPU_NEON_VFPV4=y
BR2_ARM_INSTRUCTIONS_THUMB2=y
BR2_KERNEL_HEADERS_VERSION=y
BR2_DEFAULT_KERNEL_VERSION="4.9.84"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
# Toolchain
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_GCC_VERSION_9_X=y
BR2_TOOLCHAIN_USES_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_LIBC="glibc"
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_TOOLCHAIN_BUILDROOT_USE_SSP=y
# Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.9.84"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_SIGMASTAR_PATH)/board/infinity6e/kernel/ssc338q.sdcard.config.camhi"
BR2_LINUX_KERNEL_UIMAGE=y
BR2_LINUX_KERNEL_XZ=y
BR2_LINUX_KERNEL_EXT_SIGMASTAR_PATCHER=y
BR2_LINUX_KERNEL_EXT_SIGMASTAR_PATCHER_LIST="$(BR2_EXTERNAL_SIGMASTAR_PATH)/board/infinity6e/kernel/patches/ $(BR2_EXTERNAL_SIGMASTAR_PATH)/board/infinity6e/kernel/overlay"
BR2_LINUX_KERNEL_EXT_SIGMASTAR_INITRAMFS=y
# Filesystem
# BR2_TARGET_TZ_INFO is not set
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_SQUASHFS=y
BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y
BR2_ROOTFS_OVERLAY="$(TOPDIR)/../general/overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(TOPDIR)/../scripts/executing_commands_for_$(BR2_TOOLCHAIN_BUILDROOT_LIBC).sh"
# OpenIPC configuration
BR2_TOOLCHAIN_BUILDROOT_VENDOR="openipc"
BR2_TARGET_GENERIC_ISSUE="Welcome to OpenIPC"
BR2_TARGET_GENERIC_HOSTNAME="openipc-ssc338q"
BR2_GLOBAL_PATCH_DIR="$(TOPDIR)/../general/package/all-patches"
# OpenIPC packages
BR2_PACKAGE_BUSYBOX_CONFIG="$(TOPDIR)/../general/package/busybox/busybox.config"
BR2_PACKAGE_DROPBEAR_OPENIPC=y
# BR2_PACKAGE_FDK_AAC_OPENIPC is not set
BR2_PACKAGE_FWPRINTENV_OPENIPC=y
BR2_PACKAGE_HASERL=y
BR2_PACKAGE_IPCTOOL=y
BR2_PACKAGE_JSON_C=y
BR2_PACKAGE_JSONFILTER=y
BR2_PACKAGE_LIBCURL_OPENIPC=y
BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y
# BR2_PACKAGE_LIBCURL_OPENIPC_VERBOSE is not set
# BR2_PACKAGE_LIBCURL_OPENIPC_PROXY_SUPPORT is not set
# BR2_PACKAGE_LIBCURL_OPENIPC_COOKIES_SUPPORT is not set
# BR2_PACKAGE_LIBCURL_OPENIPC_EXTRA_PROTOCOLS_FEATURES is not set
BR2_PACKAGE_LIBCURL_OPENIPC_MBEDTLS=y
BR2_PACKAGE_LIBEVENT_OPENIPC=y
BR2_PACKAGE_LIBEVENT_OPENIPC_REMOVE_PYSCRIPT=y
BR2_PACKAGE_LIBOGG_OPENIPC=y
BR2_PACKAGE_LIBYAML=y
# BR2_PACKAGE_MAJESTIC_FONTS is not set
# BR2_PACKAGE_MAJESTIC is not set
BR2_PACKAGE_MBEDTLS_OPENIPC=y
# BR2_PACKAGE_MBEDTLS_OPENIPC_PROGRAMS is not set
# BR2_PACKAGE_MBEDTLS_OPENIPC_COMPRESSION is not set
BR2_PACKAGE_MICROBE_WEB=y
# BR2_PACKAGE_MINI_SNMPD is not set
# BR2_PACKAGE_MOTORS is not set
BR2_PACKAGE_OPUS_OPENIPC=y
BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y
BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E=y
BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR="imx415"
BR2_PACKAGE_SIGMASTAR_SENSOR_OPENIPC=y
BR2_PACKAGE_DOSFSTOOLS=y
BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT=y
# BR2_PACKAGE_SSHPASS is not set
BR2_PACKAGE_UACME_OPENIPC=y
BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_ZLIB=y
# Wireless
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y
BR2_PACKAGE_WPA_SUPPLICANT_NL80211=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
BR2_PACKAGE_RTL8733BU_OPENIPC=y
BR2_PACKAGE_WIRELESS_CONFIGURATION=y
# Wireguard
# BR2_PACKAGE_WIREGUARD_LINUX_COMPAT is not set
# BR2_PACKAGE_WIREGUARD_TOOLS is not set
# Debug
BR2_PACKAGE_HOST_GDB=y
BR2_PACKAGE_GDB=y

View File

@ -0,0 +1 @@
../../general/package/sigmastar-osdrv-infinity6e

View File

@ -159,7 +159,7 @@ should_fit() {
}
rename() {
if grep -q ultimate_defconfig ./output/.config || grep -q fpv_defconfig ./output/.config; then
if grep -q ultimate_defconfig ./output/.config || grep -q fpv_defconfig ./output/.config || grep -q sdcard_defconfig ./output/.config; then
should_fit uImage $MAX_KERNEL_SIZE_ULTIMATE
should_fit rootfs.squashfs $MAX_ROOTFS_SIZE_ULTIMATE
else

View File

@ -13,6 +13,15 @@ grep -q overlay /proc/filesystems || exit
if ! grep -q 'root=.*nfs\|mmcblk\|ram' /proc/cmdline; then
if grep -q ubifs /proc/cmdline; then
mount -t ubifs ubi0:rootfs_data /overlay
elif grep -q loop /proc/devices; then
mount -t devtmpfs devtmpfs /dev
mount -t tmpfs tmpfs /overlay
sleep 1
mkdir -p /overlay/sdcard
mount -r /dev/mmcblk0p1 /overlay/sdcard
tar -xf /overlay/sdcard/settings.tar -C /overlay && echo OpenIPC: Extract settings from sdcard
umount /overlay/sdcard
rmdir /overlay/sdcard
else
mtdblkdev=$(awk -F ':' '/rootfs_data/ {print $1}' /proc/mtd | sed 's/mtd/mtdblock/')
mtdchrdev=$(grep 'rootfs_data' /proc/mtd | cut -d: -f1)

View File

@ -0,0 +1,5 @@
#!/bin/sh
if grep -q loop /proc/devices; then
tar -cf /tmp/settings.tar -C /overlay root
mv -f /tmp/settings.tar /mnt/mmcblk0p1 && echo OpenIPC: Save settings to sdcard
fi

View File

@ -0,0 +1,9 @@
config BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E
bool "sigmastar-osdrv-infinity6e"
help
sigmastar-osdrv-infinity6e - SigmaStar kernel modules and libs
config BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR
depends on BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E
string "Camera sensor"
default "imx415"

View File

@ -0,0 +1,84 @@
#!/bin/sh
# DAY mode
ir_cut_enable() {
# Pin_mux
[ ! -d /sys/class/gpio/gpio$gpio_0 ] && echo "$gpio_0" >/sys/class/gpio/export
[ ! -d /sys/class/gpio/gpio$gpio_1 ] && echo "$gpio_1" >/sys/class/gpio/export
# Dir
echo "out" >/sys/class/gpio/gpio$gpio_0/direction
echo "out" >/sys/class/gpio/gpio$gpio_1/direction
# Data, gpio_1: 0, gpio_0: 1 (day mode)
echo "1" >/sys/class/gpio/gpio$gpio_0/value
echo "0" >/sys/class/gpio/gpio$gpio_1/value
# Sleep 1s
sleep 1
# Back to original
echo "0" >/sys/class/gpio/gpio$gpio_0/value
echo "0" >/sys/class/gpio/gpio$gpio_1/value
}
# NIGHT mode
ir_cut_disable() {
# Pin_mux
[ ! -d /sys/class/gpio/gpio$gpio_0 ] && echo "$gpio_0" >/sys/class/gpio/export
[ ! -d /sys/class/gpio/gpio$gpio_1 ] && echo "$gpio_1" >/sys/class/gpio/export
# Dir
echo "out" >/sys/class/gpio/gpio$gpio_0/direction
echo "out" >/sys/class/gpio/gpio$gpio_1/direction
# Data, gpio_1: 1, gpio_0: 0 (night mode)
echo "0" >/sys/class/gpio/gpio$gpio_0/value
echo "1" >/sys/class/gpio/gpio$gpio_1/value
# Sleep 1s
sleep 1
# Back to original
echo "0" >/sys/class/gpio/gpio$gpio_0/value
echo "0" >/sys/class/gpio/gpio$gpio_1/value
}
gpio_0=0
gpio_1=0
if [ $# -lt 2 ]; then
echo "Usage: ircut_demo <vendor> <mode>"
echo "For example:"
echo "NIGHT: ircut_demo anjoy 1"
else
if [ $1 = "anjoy" ]; then
gpio_0=78
gpio_1=79
elif [ $1 = "brovotech" ]; then
gpio_0=78
gpio_1=79
elif [ $1 = "camhi" ]; then
gpio_0=23
gpio_1=24
elif [ $1 = "gospell" ]; then
gpio_0=78
gpio_1=79
elif [ $1 = "uniview" ]; then
gpio_0=78
gpio_1=79
else
echo -e "Wrong vendor name: $1\nPlease select: anjoy, brovotech, camhi, gospell, uniview"
exit
fi
if [ $2 -eq 0 ]; then
echo "DAY mode, ir_cut on"
ir_cut_enable >/dev/null
elif [ $2 -eq 1 ]; then
echo "NIGHT mode, ir_cut off"
ir_cut_disable >/dev/null
else
echo "Invalid mode, please slect 0 or 1"
fi
fi

View File

@ -0,0 +1,101 @@
#!/bin/sh
#
# OpenIPC.org | 2023.03.01
#
# Usage: load_sigmastar [-r|-i|-a]
# -r : remove all modules
# -i : insert all modules
# default : remove and insert all modules
PATH_MODULE=/lib/modules/4.9.84/sigmastar
PATH_FIRMWARE=/etc/sensors/venc_fw/chagall.bin
# Sensor
sensor=
# Watchdog
watchdog -t 10 /dev/watchdog
insert_ko() {
insmod ${PATH_MODULE}/mhal.ko
insmod ${PATH_MODULE}/mi_common.ko
insmod ${PATH_MODULE}/mi_sys.ko cmdQBufSize=768 logBufSize=256
insmod ${PATH_MODULE}/mi_rgn.ko
insmod ${PATH_MODULE}/mi_ldc.ko
insmod ${PATH_MODULE}/mi_ai.ko
insmod ${PATH_MODULE}/mi_ao.ko
insmod ${PATH_MODULE}/mi_mipitx.ko
insmod ${PATH_MODULE}/mi_sensor.ko
insmod ${PATH_MODULE}/mi_shadow.ko
insmod ${PATH_MODULE}/mi_divp.ko thread_priority=98
insmod ${PATH_MODULE}/mi_vif.ko thread_priority=98
insmod ${PATH_MODULE}/mi_vpe.ko thread_priority=98
case $sensor in
imx415)
insmod ${PATH_MODULE}/mi_venc.ko fw_path=${PATH_FIRMWARE};
;;
*)
echo -e "\n\e[1;31mAn UNSUPPORTED sensor type is specified - ${sensor}\e[0m\n" | logger -s -t OpenIPC;
;;
esac
if [ ! -e /dev/mi_poll ]; then
major=$(awk '$2=="mi_poll" {print $1}' /proc/devices | head -n 1)
mknod /dev/mi_poll c $major 0
fi
# Change iqfile folder
echo isproot /etc/sensors/iqfile > /dev/ispmid
case $sensor in
imx415)
insmod ${PATH_MODULE}/sensor_${sensor}_mipi.ko chmap=1;
;;
*)
echo -e "\n\e[1;31mAn UNSUPPORTED sensor type is specified - ${sensor}\e[0m\n" | logger -s -t OpenIPC;
;;
esac
mdev -s
}
remove_ko() {
rmmod -w drv_ms_cus_${sensor}_MIPI
rmmod -w mi_venc
rmmod -w mi_shadow
rmmod -w mi_sensor
rmmod -w mi_mipitx
rmmod -w mi_ao
rmmod -w mi_ai
rmmod -w mi_vpe
rmmod -w mi_vif
rmmod -w mi_divp
rmmod -w mi_ldc
rmmod -w mi_rgn
rmmod -w mi_sys
rmmod -w mi_common
rmmod -w mhal
}
if [ -z ${sensor} ]; then
echo -e "\n\e[1;31mThe sensor parameter is MISSING\e[0m\n" | logger -s -t OpenIPC
exit 1
else
echo -e "\n\e[1;32mThe sensor is assigned - ${sensor}\e[0m\n" | logger -s -t OpenIPC
fi
if [ "$1" = "-i" ]; then
insert_ko
fi
if [ "$1" = "-r" ]; then
remove_ko
fi
if [ $# -eq 0 ] || [ "$1" = "-a" ]; then
remove_ko
insert_ko
fi
exit 0

View File

@ -0,0 +1,72 @@
#!/bin/sh
DAEMON="majestic"
PIDFILE="/var/run/$DAEMON.pid"
DAEMON_ARGS="-s"
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
load_majestic() {
printf 'Starting %s: ' "$DAEMON"
[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, "
[ -f /etc/coredump.conf ] && . /etc/coredump.conf
if [ "$coredump_enabled" ]; then
[ "$(yaml-cli -i /etc/majestic.yaml -g .watchdog.timeout)" -lt "30" ] && yaml-cli -i /etc/majestic.yaml -s .watchdog.timeout 30
ulimit -c unlimited && echo "|/usr/sbin/sendcoredump.sh" >/proc/sys/kernel/core_pattern
fi
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \
-- $DAEMON_ARGS
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
# The daemon does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one.
start() {
logger -s -p daemon.info -t sigmastar "Check MAC for Sigmastar devices"
if [ "$(fw_printenv -n ethaddr)" = "00:00:23:34:45:66" ]; then
logger -s -p daemon.info -t sigmastar "The eth0 interface has a lousy MAC, let's try to change it.."
else
logger -s -p daemon.info -t sigmastar "The eth0 interface has a correct MAC - $(fw_printenv -n ethaddr)"
fi
logger -s -p daemon.info -t sigmastar "Loading of kernel modules and initialization of the video system has started"
export TZ=$(cat /etc/TZ)
load_sigmastar -i
load_majestic
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, "
start-stop-daemon -K -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
reload
}
reload() {
load_majestic
}
case "$1" in
start|stop|restart|reload)
"$1"
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac

View File

@ -0,0 +1,40 @@
################################################################################
#
# sigmastar-osdrv-infinity6e
#
################################################################################
SIGMASTAR_OSDRV_INFINITY6E_VERSION =
SIGMASTAR_OSDRV_INFINITY6E_SITE =
SIGMASTAR_OSDRV_INFINITY6E_LICENSE = MIT
SIGMASTAR_OSDRV_INFINITY6E_LICENSE_FILES = LICENSE
SIGMASTAR_OSDRV_INFINITY6E_PATH = $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-infinity6e/files
SIGMASTAR_OSDRV_INFINITY6E_SENSOR = $(call qstrip,$(BR2_PACKAGE_SIGMASTAR_OSDRV_SENSOR))
define SIGMASTAR_OSDRV_INFINITY6E_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/script/bin/*
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
$(INSTALL) -m 755 -t $(TARGET_DIR)/etc/init.d $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/script/init.d/*
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib
$(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/lib/*.so
$(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/4.9.84/sigmastar
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/kmod/*.ko
$(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.84/sigmastar $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/sensor/$(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)/*.ko
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/sensors/iqfile
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensors/iqfile $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/sensor/$(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)/$(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)_iqfile.bin
ln -sf $(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)_iqfile.bin $(TARGET_DIR)/etc/sensors/iqfile/iqfile0.bin
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/sensors/venc_fw
$(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensors/venc_fw $(SIGMASTAR_OSDRV_INFINITY6E_PATH)/sensor/venc_fw/chagall.bin
# Set sensor for insmod
sed -i "s/sensor=/sensor=$(SIGMASTAR_OSDRV_INFINITY6E_SENSOR)/g" $(TARGET_DIR)/usr/bin/load_sigmastar
endef
$(eval $(generic-package))