diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index b46132071..2a834071b 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -101,6 +101,10 @@ jobs: # APFPV - ssc338q_apfpv - ssc378qe_apfpv + - ssc30kq_apfpv-greg + - ssc30kq_apfpv-greg_bu + - ssc338q_apfpv-greg + - ssc338q_apfpv-greg_bu # FPV - hi3516ev200_fpv diff --git a/devices/ssc30kq_apfpv-greg/br-ext-chip-sigmastar/configs/ssc30kq_apfpv-greg_defconfig b/devices/ssc30kq_apfpv-greg/br-ext-chip-sigmastar/configs/ssc30kq_apfpv-greg_defconfig new file mode 100644 index 000000000..880c0ab55 --- /dev/null +++ b/devices/ssc30kq_apfpv-greg/br-ext-chip-sigmastar/configs/ssc30kq_apfpv-greg_defconfig @@ -0,0 +1,76 @@ +# Architecture +BR2_arm=y +BR2_cortex_a7=y +BR2_ARM_FPU_NEON_VFPV4=y +BR2_ARM_INSTRUCTIONS_THUMB2=y + +# Toolchain +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/openipc/firmware/releases/download/$(OPENIPC_TOOLCHAIN).tgz" +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-openipc-linux-gnueabihf" +BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_9=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y +# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set +BR2_TOOLCHAIN_EXTERNAL_CXX=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/openipc/linux/archive/$(OPENIPC_KERNEL).tar.gz" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/infinity6e-ssc012b.config" +BR2_LINUX_KERNEL_UIMAGE=y +BR2_LINUX_KERNEL_XZ=y + +# Filesystem +BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" +BR2_PACKAGE_EXFATPROGS=y +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_IW=y +BR2_PACKAGE_WPA_SUPPLICANT=n +BR2_PACKAGE_HOSTAPD=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=n +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y + +# OpenIPC +BR2_OPENIPC_SOC_VENDOR="sigmastar" +BR2_OPENIPC_SOC_MODEL="ssc30kq" +BR2_OPENIPC_SOC_FAMILY="infinity6e" +BR2_OPENIPC_VARIANT="apfpv-greg" +BR2_OPENIPC_FLASH_SIZE="16" + +# Packages +BR2_PACKAGE_DROPBEAR_OPENIPC=y +BR2_PACKAGE_EXFAT_OPENIPC=y +BR2_PACKAGE_IPCTOOL=y +BR2_PACKAGE_JSONFILTER=y +BR2_PACKAGE_LIBCURL_OPENIPC=y +BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y +# 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_LIBEVENT_OPENIPC=y +BR2_PACKAGE_LIBOGG_OPENIPC=y +BR2_PACKAGE_DIVINUS=n +BR2_PACKAGE_MAJESTIC_FONTS=y +BR2_PACKAGE_MAJESTIC_WEBUI=y +BR2_PACKAGE_MAJESTIC=y +BR2_PACKAGE_MBEDTLS_OPENIPC=y +BR2_PACKAGE_MAVFWD=n +BR2_PACKAGE_APFPV_GREG=y +# BR2_PACKAGE_MSPOSD is not set +BR2_PACKAGE_OPUS_OPENIPC=y +BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y +BR2_PACKAGE_RTL8812AU=n +BR2_PACKAGE_RTL88X2EU_OPENIPC=y +BR2_PACKAGE_RTL8733BU_OPENIPC=n +BR2_PACKAGE_RTL8811CU_OPENIPC=y +BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E=y +BR2_PACKAGE_VTUND_OPENIPC=y +BR2_PACKAGE_YAML_CLI=y diff --git a/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S40network b/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S40network new file mode 100755 index 000000000..19f7be166 --- /dev/null +++ b/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S40network @@ -0,0 +1,22 @@ +#!/bin/sh + +case "$1" in + start) + echo "Starting network..." + ifup lo + ifup eth0 + ifup wlan0 + ;; + + stop) + echo "Stopping network..." + ifdown lo + ifdown -f eth0 + ifdown -f wlan0 + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S95majestic b/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S95majestic new file mode 100755 index 000000000..45d908d2f --- /dev/null +++ b/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S95majestic @@ -0,0 +1,62 @@ +#!/bin/sh + +. /etc/init.d/libmedia.sh + +DAEMON="/usr/bin/majestic" +NAME="majestic" +PIDFILE="/var/run/majestic.pid" + +start() { + echo "Starting $NAME..." + if ensure_pidfile "$NAME" "$PIDFILE"; then + echo "$NAME is already running" + return 0 + fi + + rm -f "$PIDFILE" + start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- -s + if [ $? -ne 0 ]; then + echo "Failed to launch $NAME" + return 1 + fi + echo "$NAME launch requested" +} + +stop() { + echo "Stopping $NAME..." + stop_service "$NAME" "$PIDFILE" 15 || return 1 + # Majestic keeps internal single-instance state briefly after exit. + sleep 2 +} + +status() { + if ensure_pidfile "$NAME" "$PIDFILE"; then + echo "$NAME running pid=$(cat "$PIDFILE")" + return 0 + fi + echo "$NAME stopped" + return 1 +} + +reload() { + ensure_pidfile "$NAME" "$PIDFILE" || { + echo "$NAME not running" + return 1 + } + kill -HUP "$(cat "$PIDFILE")" +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart|reload|status) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|status}" + exit 1 + ;; +esac diff --git a/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S99rc.local b/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S99rc.local new file mode 100755 index 000000000..0e20120de --- /dev/null +++ b/devices/ssc30kq_apfpv-greg/general/overlay/etc/init.d/S99rc.local @@ -0,0 +1,41 @@ +#!/bin/sh + +MAJESTIC_API="http://localhost/api/v1/config.json" + +wait_for_majestic_ready() { + timeout="${1:-30}" + i=0 + while [ "$i" -lt "$timeout" ]; do + curl -sf --connect-timeout 1 --max-time 2 "$MAJESTIC_API" >/dev/null 2>&1 && return 0 + sleep 1 + i=$((i + 1)) + done + return 1 +} + +start() { + echo "S99rc.local: waiting for majestic API..." + if ! wait_for_majestic_ready 10; then + echo "S99rc.local: majestic API not ready after 10s; continuing with /etc/rc.local anyway" + else + echo "S99rc.local: majestic API ready" + fi + echo "S99rc.local: running /etc/rc.local" + /etc/rc.local +} + +stop() { + [ -x /etc/rc.local.stop ] && /etc/rc.local.stop +} + +case "$1" in + start|stop) + "$1" + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + +exit $? diff --git a/devices/ssc30kq_apfpv-greg/general/overlay/etc/network/interfaces.d/wlan0 b/devices/ssc30kq_apfpv-greg/general/overlay/etc/network/interfaces.d/wlan0 new file mode 100755 index 000000000..d73c769f0 --- /dev/null +++ b/devices/ssc30kq_apfpv-greg/general/overlay/etc/network/interfaces.d/wlan0 @@ -0,0 +1,6 @@ +iface wlan0 inet static + address 192.168.0.1 + netmask 255.255.255.0 + pre-up adapter setup + post-up adapter start + post-down adapter stop diff --git a/devices/ssc30kq_apfpv-greg/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko b/devices/ssc30kq_apfpv-greg/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko new file mode 100644 index 000000000..c90d54c88 Binary files /dev/null and b/devices/ssc30kq_apfpv-greg/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko differ diff --git a/devices/ssc30kq_apfpv-greg/general/overlay/usr/share/udhcpc/default.script b/devices/ssc30kq_apfpv-greg/general/overlay/usr/share/udhcpc/default.script new file mode 100755 index 000000000..210e7fd5d --- /dev/null +++ b/devices/ssc30kq_apfpv-greg/general/overlay/usr/share/udhcpc/default.script @@ -0,0 +1,127 @@ +#!/bin/sh + +# udhcpc script edited by Tim Riker + +# Changes by OpenIPC 2021 +# +# - move resolv.conf path to /tmp +# - remove interface notes from resolv.conf + + +[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 + +RESOLV_CONF="/tmp/resolv.conf" +[ -e $RESOLV_CONF ] || touch $RESOLV_CONF +[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" +[ -n "$subnet" ] && NETMASK="netmask $subnet" +# Handle stateful DHCPv6 like DHCPv4 +[ -n "$ipv6" ] && ip="$ipv6/128" + +[ -z "${IF_WAIT_DELAY}" ] && IF_WAIT_DELAY=10 + +wait_for_ipv6_default_route() { + printf "Waiting for IPv6 default route to appear" + while [ $IF_WAIT_DELAY -gt 0 ]; do + if ip -6 route list | grep -q default; then + printf "\n" + return + fi + sleep 1 + printf "." + : $((IF_WAIT_DELAY -= 1)) + done + printf " timeout!\n" +} + +case "$1" in + deconfig) + /sbin/ifconfig $interface up + /sbin/ifconfig $interface 0.0.0.0 + + # drop info from this interface + # resolv.conf may be a symlink to /tmp/, so take care + TMPFILE=$(mktemp) + grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE + cat $TMPFILE > $RESOLV_CONF + rm -f $TMPFILE + + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface + fi + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; + + leasefail|nak) + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot + fi + /sbin/ifconfig $interface $(fw_printenv -n ipaddr || echo -n 192.168.1.10) netmask $(fw_printenv -n netmask || echo -n 255.255.255.0) up + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; + + renew|bound) + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface + fi + /sbin/ifconfig $interface $ip $BROADCAST $NETMASK + if [ -n "$ipv6" ] ; then + wait_for_ipv6_default_route + fi + + if [ -n "$router" ] ; then + echo "deleting routers" + while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do + : + done + + for i in $router ; do + route add default gw $i dev $interface + done + fi + + # drop info from this interface + # resolv.conf may be a symlink to /tmp/, so take care + #TMPFILE=$(mktemp) + #grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE + #cat $TMPFILE > $RESOLV_CONF + #rm -f $TMPFILE + + # Clearing the file because it is in RAM + > $RESOLV_CONF + + # prefer rfc3397 domain search list (option 119) if available + if [ -n "$search" ]; then + search_list=$search + elif [ -n "$domain" ]; then + search_list=$domain + fi + + [ -n "$search_list" ] && + echo "search $search_list" >> $RESOLV_CONF + + for i in $dns ; do + echo adding dns $i + echo "nameserver $i" >> $RESOLV_CONF + done + + ntpd -q -N -n + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; +esac + +HOOK_DIR="$0.d" +for hook in "${HOOK_DIR}/"*; do + [ -f "${hook}" -a -x "${hook}" ] || continue + "${hook}" "${@}" +done + +exit 0 diff --git a/devices/ssc30kq_apfpv-greg/general/overlay/var/www/cgi-bin/p/header.cgi b/devices/ssc30kq_apfpv-greg/general/overlay/var/www/cgi-bin/p/header.cgi new file mode 100755 index 000000000..b3015341b --- /dev/null +++ b/devices/ssc30kq_apfpv-greg/general/overlay/var/www/cgi-bin/p/header.cgi @@ -0,0 +1,117 @@ +#!/usr/bin/haserl +Content-type: text/html; charset=UTF-8 +Cache-Control: no-store +Pragma: no-cache + + + + + + + <% html_title %> + + + + + + + + + +
+
+
+
+
+
+
+ +
+ <%= $(signature) %> +
+ +
+
+
+
+
+
+ +<% if [ -z "$network_gateway" ]; then %> +
+

Internet connection not available, please check your network settings.

+
+<% fi %> + +<% if [ ! -e $(get_config) ]; then %> +
+

Majestic configuration not found, please check your Majestic settings.

+
+<% fi %> + +<% if [ "$(cat /etc/TZ)" != "$TZ" ] || [ -e /tmp/system-reboot ]; then %> +
+

Warning.

+

System settings have been updated, restart to apply pending changes.

+ + Restart camera + +
+<% fi %> + +

<%= $page_title %>

+<% log_read %> diff --git a/devices/ssc30kq_apfpv-greg/general/scripts/excludes/ssc30kq_apfpv-greg.list b/devices/ssc30kq_apfpv-greg/general/scripts/excludes/ssc30kq_apfpv-greg.list new file mode 100644 index 000000000..081e93665 --- /dev/null +++ b/devices/ssc30kq_apfpv-greg/general/scripts/excludes/ssc30kq_apfpv-greg.list @@ -0,0 +1,16 @@ +/etc/sensors/imx307.bin +/etc/sensors/gc2053.bin +/etc/sensors/gc4653.bin +/etc/sensors/sc501ai.bin +/lib/modules/4.9.84/kernel/fs/lockd/lockd.ko +/lib/modules/4.9.84/kernel/fs/nfs/nfs.ko +/lib/modules/4.9.84/kernel/fs/nfs/nfsv3.ko +/lib/modules/4.9.84/kernel/net/sunrpc/sunrpc.ko +/lib/modules/4.9.84/sigmastar/sensor_gc2053_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_gc4653_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_imx307_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_imx347_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_os04c10_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_sc501ai_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_sc8235_mipi.ko + diff --git a/devices/ssc30kq_apfpv-greg_bu/br-ext-chip-sigmastar/configs/ssc30kq_apfpv-greg_bu_defconfig b/devices/ssc30kq_apfpv-greg_bu/br-ext-chip-sigmastar/configs/ssc30kq_apfpv-greg_bu_defconfig new file mode 100644 index 000000000..aeb91015c --- /dev/null +++ b/devices/ssc30kq_apfpv-greg_bu/br-ext-chip-sigmastar/configs/ssc30kq_apfpv-greg_bu_defconfig @@ -0,0 +1,76 @@ +# Architecture +BR2_arm=y +BR2_cortex_a7=y +BR2_ARM_FPU_NEON_VFPV4=y +BR2_ARM_INSTRUCTIONS_THUMB2=y + +# Toolchain +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/openipc/firmware/releases/download/$(OPENIPC_TOOLCHAIN).tgz" +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-openipc-linux-gnueabihf" +BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_9=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y +# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set +BR2_TOOLCHAIN_EXTERNAL_CXX=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/openipc/linux/archive/$(OPENIPC_KERNEL).tar.gz" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/infinity6e-ssc012b.config" +BR2_LINUX_KERNEL_UIMAGE=y +BR2_LINUX_KERNEL_XZ=y + +# Filesystem +BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" +BR2_PACKAGE_EXFATPROGS=y +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_IW=y +BR2_PACKAGE_WPA_SUPPLICANT=n +BR2_PACKAGE_HOSTAPD=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=n +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y + +# OpenIPC +BR2_OPENIPC_SOC_VENDOR="sigmastar" +BR2_OPENIPC_SOC_MODEL="ssc30kq" +BR2_OPENIPC_SOC_FAMILY="infinity6e" +BR2_OPENIPC_VARIANT="apfpv-greg" +BR2_OPENIPC_FLASH_SIZE="16" + +# Packages +BR2_PACKAGE_DROPBEAR_OPENIPC=y +BR2_PACKAGE_EXFAT_OPENIPC=y +BR2_PACKAGE_IPCTOOL=y +BR2_PACKAGE_JSONFILTER=y +BR2_PACKAGE_LIBCURL_OPENIPC=y +BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y +# 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_LIBEVENT_OPENIPC=y +BR2_PACKAGE_LIBOGG_OPENIPC=y +BR2_PACKAGE_DIVINUS=n +BR2_PACKAGE_MAJESTIC_FONTS=y +BR2_PACKAGE_MAJESTIC_WEBUI=y +BR2_PACKAGE_MAJESTIC=y +BR2_PACKAGE_MBEDTLS_OPENIPC=y +BR2_PACKAGE_MAVFWD=n +BR2_PACKAGE_APFPV_GREG=y +# BR2_PACKAGE_MSPOSD is not set +BR2_PACKAGE_OPUS_OPENIPC=y +BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y +BR2_PACKAGE_RTL8812AU=n +BR2_PACKAGE_RTL88X2EU_OPENIPC=y +BR2_PACKAGE_RTL8733BU_OPENIPC=y +BR2_PACKAGE_RTL8811CU_OPENIPC=n +BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E=y +BR2_PACKAGE_VTUND_OPENIPC=y +BR2_PACKAGE_YAML_CLI=y diff --git a/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S40network b/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S40network new file mode 100755 index 000000000..19f7be166 --- /dev/null +++ b/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S40network @@ -0,0 +1,22 @@ +#!/bin/sh + +case "$1" in + start) + echo "Starting network..." + ifup lo + ifup eth0 + ifup wlan0 + ;; + + stop) + echo "Stopping network..." + ifdown lo + ifdown -f eth0 + ifdown -f wlan0 + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S95majestic b/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S95majestic new file mode 100755 index 000000000..45d908d2f --- /dev/null +++ b/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S95majestic @@ -0,0 +1,62 @@ +#!/bin/sh + +. /etc/init.d/libmedia.sh + +DAEMON="/usr/bin/majestic" +NAME="majestic" +PIDFILE="/var/run/majestic.pid" + +start() { + echo "Starting $NAME..." + if ensure_pidfile "$NAME" "$PIDFILE"; then + echo "$NAME is already running" + return 0 + fi + + rm -f "$PIDFILE" + start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- -s + if [ $? -ne 0 ]; then + echo "Failed to launch $NAME" + return 1 + fi + echo "$NAME launch requested" +} + +stop() { + echo "Stopping $NAME..." + stop_service "$NAME" "$PIDFILE" 15 || return 1 + # Majestic keeps internal single-instance state briefly after exit. + sleep 2 +} + +status() { + if ensure_pidfile "$NAME" "$PIDFILE"; then + echo "$NAME running pid=$(cat "$PIDFILE")" + return 0 + fi + echo "$NAME stopped" + return 1 +} + +reload() { + ensure_pidfile "$NAME" "$PIDFILE" || { + echo "$NAME not running" + return 1 + } + kill -HUP "$(cat "$PIDFILE")" +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart|reload|status) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|status}" + exit 1 + ;; +esac diff --git a/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S99rc.local b/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S99rc.local new file mode 100755 index 000000000..0e20120de --- /dev/null +++ b/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/init.d/S99rc.local @@ -0,0 +1,41 @@ +#!/bin/sh + +MAJESTIC_API="http://localhost/api/v1/config.json" + +wait_for_majestic_ready() { + timeout="${1:-30}" + i=0 + while [ "$i" -lt "$timeout" ]; do + curl -sf --connect-timeout 1 --max-time 2 "$MAJESTIC_API" >/dev/null 2>&1 && return 0 + sleep 1 + i=$((i + 1)) + done + return 1 +} + +start() { + echo "S99rc.local: waiting for majestic API..." + if ! wait_for_majestic_ready 10; then + echo "S99rc.local: majestic API not ready after 10s; continuing with /etc/rc.local anyway" + else + echo "S99rc.local: majestic API ready" + fi + echo "S99rc.local: running /etc/rc.local" + /etc/rc.local +} + +stop() { + [ -x /etc/rc.local.stop ] && /etc/rc.local.stop +} + +case "$1" in + start|stop) + "$1" + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + +exit $? diff --git a/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/network/interfaces.d/wlan0 b/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/network/interfaces.d/wlan0 new file mode 100755 index 000000000..d73c769f0 --- /dev/null +++ b/devices/ssc30kq_apfpv-greg_bu/general/overlay/etc/network/interfaces.d/wlan0 @@ -0,0 +1,6 @@ +iface wlan0 inet static + address 192.168.0.1 + netmask 255.255.255.0 + pre-up adapter setup + post-up adapter start + post-down adapter stop diff --git a/devices/ssc30kq_apfpv-greg_bu/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko b/devices/ssc30kq_apfpv-greg_bu/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko new file mode 100644 index 000000000..c90d54c88 Binary files /dev/null and b/devices/ssc30kq_apfpv-greg_bu/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko differ diff --git a/devices/ssc30kq_apfpv-greg_bu/general/overlay/usr/share/udhcpc/default.script b/devices/ssc30kq_apfpv-greg_bu/general/overlay/usr/share/udhcpc/default.script new file mode 100755 index 000000000..210e7fd5d --- /dev/null +++ b/devices/ssc30kq_apfpv-greg_bu/general/overlay/usr/share/udhcpc/default.script @@ -0,0 +1,127 @@ +#!/bin/sh + +# udhcpc script edited by Tim Riker + +# Changes by OpenIPC 2021 +# +# - move resolv.conf path to /tmp +# - remove interface notes from resolv.conf + + +[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 + +RESOLV_CONF="/tmp/resolv.conf" +[ -e $RESOLV_CONF ] || touch $RESOLV_CONF +[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" +[ -n "$subnet" ] && NETMASK="netmask $subnet" +# Handle stateful DHCPv6 like DHCPv4 +[ -n "$ipv6" ] && ip="$ipv6/128" + +[ -z "${IF_WAIT_DELAY}" ] && IF_WAIT_DELAY=10 + +wait_for_ipv6_default_route() { + printf "Waiting for IPv6 default route to appear" + while [ $IF_WAIT_DELAY -gt 0 ]; do + if ip -6 route list | grep -q default; then + printf "\n" + return + fi + sleep 1 + printf "." + : $((IF_WAIT_DELAY -= 1)) + done + printf " timeout!\n" +} + +case "$1" in + deconfig) + /sbin/ifconfig $interface up + /sbin/ifconfig $interface 0.0.0.0 + + # drop info from this interface + # resolv.conf may be a symlink to /tmp/, so take care + TMPFILE=$(mktemp) + grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE + cat $TMPFILE > $RESOLV_CONF + rm -f $TMPFILE + + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface + fi + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; + + leasefail|nak) + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot + fi + /sbin/ifconfig $interface $(fw_printenv -n ipaddr || echo -n 192.168.1.10) netmask $(fw_printenv -n netmask || echo -n 255.255.255.0) up + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; + + renew|bound) + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface + fi + /sbin/ifconfig $interface $ip $BROADCAST $NETMASK + if [ -n "$ipv6" ] ; then + wait_for_ipv6_default_route + fi + + if [ -n "$router" ] ; then + echo "deleting routers" + while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do + : + done + + for i in $router ; do + route add default gw $i dev $interface + done + fi + + # drop info from this interface + # resolv.conf may be a symlink to /tmp/, so take care + #TMPFILE=$(mktemp) + #grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE + #cat $TMPFILE > $RESOLV_CONF + #rm -f $TMPFILE + + # Clearing the file because it is in RAM + > $RESOLV_CONF + + # prefer rfc3397 domain search list (option 119) if available + if [ -n "$search" ]; then + search_list=$search + elif [ -n "$domain" ]; then + search_list=$domain + fi + + [ -n "$search_list" ] && + echo "search $search_list" >> $RESOLV_CONF + + for i in $dns ; do + echo adding dns $i + echo "nameserver $i" >> $RESOLV_CONF + done + + ntpd -q -N -n + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; +esac + +HOOK_DIR="$0.d" +for hook in "${HOOK_DIR}/"*; do + [ -f "${hook}" -a -x "${hook}" ] || continue + "${hook}" "${@}" +done + +exit 0 diff --git a/devices/ssc30kq_apfpv-greg_bu/general/overlay/var/www/cgi-bin/p/header.cgi b/devices/ssc30kq_apfpv-greg_bu/general/overlay/var/www/cgi-bin/p/header.cgi new file mode 100755 index 000000000..b3015341b --- /dev/null +++ b/devices/ssc30kq_apfpv-greg_bu/general/overlay/var/www/cgi-bin/p/header.cgi @@ -0,0 +1,117 @@ +#!/usr/bin/haserl +Content-type: text/html; charset=UTF-8 +Cache-Control: no-store +Pragma: no-cache + + + + + + + <% html_title %> + + + + + + + + + +
+
+
+
+
+
+
+ +
+ <%= $(signature) %> +
+ +
+
+
+
+
+
+ +<% if [ -z "$network_gateway" ]; then %> +
+

Internet connection not available, please check your network settings.

+
+<% fi %> + +<% if [ ! -e $(get_config) ]; then %> +
+

Majestic configuration not found, please check your Majestic settings.

+
+<% fi %> + +<% if [ "$(cat /etc/TZ)" != "$TZ" ] || [ -e /tmp/system-reboot ]; then %> +
+

Warning.

+

System settings have been updated, restart to apply pending changes.

+ + Restart camera + +
+<% fi %> + +

<%= $page_title %>

+<% log_read %> diff --git a/devices/ssc30kq_apfpv-greg_bu/general/scripts/excludes/ssc30kq_apfpv-greg.list b/devices/ssc30kq_apfpv-greg_bu/general/scripts/excludes/ssc30kq_apfpv-greg.list new file mode 100644 index 000000000..081e93665 --- /dev/null +++ b/devices/ssc30kq_apfpv-greg_bu/general/scripts/excludes/ssc30kq_apfpv-greg.list @@ -0,0 +1,16 @@ +/etc/sensors/imx307.bin +/etc/sensors/gc2053.bin +/etc/sensors/gc4653.bin +/etc/sensors/sc501ai.bin +/lib/modules/4.9.84/kernel/fs/lockd/lockd.ko +/lib/modules/4.9.84/kernel/fs/nfs/nfs.ko +/lib/modules/4.9.84/kernel/fs/nfs/nfsv3.ko +/lib/modules/4.9.84/kernel/net/sunrpc/sunrpc.ko +/lib/modules/4.9.84/sigmastar/sensor_gc2053_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_gc4653_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_imx307_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_imx347_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_os04c10_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_sc501ai_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_sc8235_mipi.ko + diff --git a/devices/ssc338q_apfpv-greg/br-ext-chip-sigmastar/configs/ssc338q_apfpv-greg_defconfig b/devices/ssc338q_apfpv-greg/br-ext-chip-sigmastar/configs/ssc338q_apfpv-greg_defconfig new file mode 100644 index 000000000..f007942c6 --- /dev/null +++ b/devices/ssc338q_apfpv-greg/br-ext-chip-sigmastar/configs/ssc338q_apfpv-greg_defconfig @@ -0,0 +1,75 @@ +# Architecture +BR2_arm=y +BR2_cortex_a7=y +BR2_ARM_FPU_NEON_VFPV4=y +BR2_ARM_INSTRUCTIONS_THUMB2=y + +# Toolchain +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/openipc/firmware/releases/download/$(OPENIPC_TOOLCHAIN).tgz" +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-openipc-linux-gnueabihf" +BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_9=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y +# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set +BR2_TOOLCHAIN_EXTERNAL_CXX=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/openipc/linux/archive/$(OPENIPC_KERNEL).tar.gz" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/infinity6e-ssc012b.config" +BR2_LINUX_KERNEL_UIMAGE=y +BR2_LINUX_KERNEL_XZ=y + +# Filesystem +BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" +BR2_PACKAGE_EXFATPROGS=y +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_IW=y +BR2_PACKAGE_WPA_SUPPLICANT=n +BR2_PACKAGE_HOSTAPD=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=n +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y + +# OpenIPC +BR2_OPENIPC_SOC_VENDOR="sigmastar" +BR2_OPENIPC_SOC_MODEL="ssc338q" +BR2_OPENIPC_SOC_FAMILY="infinity6e" +BR2_OPENIPC_VARIANT="apfpv-greg" +BR2_OPENIPC_FLASH_SIZE="16" + +# Packages +BR2_PACKAGE_DROPBEAR_OPENIPC=y +BR2_PACKAGE_EXFAT_OPENIPC=y +BR2_PACKAGE_IPCTOOL=y +BR2_PACKAGE_JSONFILTER=y +BR2_PACKAGE_LIBCURL_OPENIPC=y +BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y +# 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_LIBEVENT_OPENIPC=y +BR2_PACKAGE_LIBOGG_OPENIPC=y +BR2_PACKAGE_MAJESTIC_FONTS=y +BR2_PACKAGE_MAJESTIC_WEBUI=y +BR2_PACKAGE_MAJESTIC=y +BR2_PACKAGE_MBEDTLS_OPENIPC=y +BR2_PACKAGE_MAVFWD=y +BR2_PACKAGE_APFPV_GREG=y +# BR2_PACKAGE_MSPOSD is not set +BR2_PACKAGE_OPUS_OPENIPC=y +BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y +BR2_PACKAGE_RTL8812AU=n +BR2_PACKAGE_RTL88X2EU_OPENIPC=y +BR2_PACKAGE_RTL8733BU_OPENIPC=n +BR2_PACKAGE_RTL8811CU_OPENIPC=y +BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E=y +BR2_PACKAGE_VTUND_OPENIPC=y +BR2_PACKAGE_YAML_CLI=y diff --git a/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S40network b/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S40network new file mode 100755 index 000000000..19f7be166 --- /dev/null +++ b/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S40network @@ -0,0 +1,22 @@ +#!/bin/sh + +case "$1" in + start) + echo "Starting network..." + ifup lo + ifup eth0 + ifup wlan0 + ;; + + stop) + echo "Stopping network..." + ifdown lo + ifdown -f eth0 + ifdown -f wlan0 + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S95majestic b/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S95majestic new file mode 100755 index 000000000..45d908d2f --- /dev/null +++ b/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S95majestic @@ -0,0 +1,62 @@ +#!/bin/sh + +. /etc/init.d/libmedia.sh + +DAEMON="/usr/bin/majestic" +NAME="majestic" +PIDFILE="/var/run/majestic.pid" + +start() { + echo "Starting $NAME..." + if ensure_pidfile "$NAME" "$PIDFILE"; then + echo "$NAME is already running" + return 0 + fi + + rm -f "$PIDFILE" + start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- -s + if [ $? -ne 0 ]; then + echo "Failed to launch $NAME" + return 1 + fi + echo "$NAME launch requested" +} + +stop() { + echo "Stopping $NAME..." + stop_service "$NAME" "$PIDFILE" 15 || return 1 + # Majestic keeps internal single-instance state briefly after exit. + sleep 2 +} + +status() { + if ensure_pidfile "$NAME" "$PIDFILE"; then + echo "$NAME running pid=$(cat "$PIDFILE")" + return 0 + fi + echo "$NAME stopped" + return 1 +} + +reload() { + ensure_pidfile "$NAME" "$PIDFILE" || { + echo "$NAME not running" + return 1 + } + kill -HUP "$(cat "$PIDFILE")" +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart|reload|status) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|status}" + exit 1 + ;; +esac diff --git a/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S99rc.local b/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S99rc.local new file mode 100755 index 000000000..0e20120de --- /dev/null +++ b/devices/ssc338q_apfpv-greg/general/overlay/etc/init.d/S99rc.local @@ -0,0 +1,41 @@ +#!/bin/sh + +MAJESTIC_API="http://localhost/api/v1/config.json" + +wait_for_majestic_ready() { + timeout="${1:-30}" + i=0 + while [ "$i" -lt "$timeout" ]; do + curl -sf --connect-timeout 1 --max-time 2 "$MAJESTIC_API" >/dev/null 2>&1 && return 0 + sleep 1 + i=$((i + 1)) + done + return 1 +} + +start() { + echo "S99rc.local: waiting for majestic API..." + if ! wait_for_majestic_ready 10; then + echo "S99rc.local: majestic API not ready after 10s; continuing with /etc/rc.local anyway" + else + echo "S99rc.local: majestic API ready" + fi + echo "S99rc.local: running /etc/rc.local" + /etc/rc.local +} + +stop() { + [ -x /etc/rc.local.stop ] && /etc/rc.local.stop +} + +case "$1" in + start|stop) + "$1" + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + +exit $? diff --git a/devices/ssc338q_apfpv-greg/general/overlay/etc/network/interfaces.d/wlan0 b/devices/ssc338q_apfpv-greg/general/overlay/etc/network/interfaces.d/wlan0 new file mode 100755 index 000000000..d73c769f0 --- /dev/null +++ b/devices/ssc338q_apfpv-greg/general/overlay/etc/network/interfaces.d/wlan0 @@ -0,0 +1,6 @@ +iface wlan0 inet static + address 192.168.0.1 + netmask 255.255.255.0 + pre-up adapter setup + post-up adapter start + post-down adapter stop diff --git a/devices/ssc338q_apfpv-greg/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko b/devices/ssc338q_apfpv-greg/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko new file mode 100644 index 000000000..c90d54c88 Binary files /dev/null and b/devices/ssc338q_apfpv-greg/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko differ diff --git a/devices/ssc338q_apfpv-greg/general/overlay/usr/share/udhcpc/default.script b/devices/ssc338q_apfpv-greg/general/overlay/usr/share/udhcpc/default.script new file mode 100755 index 000000000..210e7fd5d --- /dev/null +++ b/devices/ssc338q_apfpv-greg/general/overlay/usr/share/udhcpc/default.script @@ -0,0 +1,127 @@ +#!/bin/sh + +# udhcpc script edited by Tim Riker + +# Changes by OpenIPC 2021 +# +# - move resolv.conf path to /tmp +# - remove interface notes from resolv.conf + + +[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 + +RESOLV_CONF="/tmp/resolv.conf" +[ -e $RESOLV_CONF ] || touch $RESOLV_CONF +[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" +[ -n "$subnet" ] && NETMASK="netmask $subnet" +# Handle stateful DHCPv6 like DHCPv4 +[ -n "$ipv6" ] && ip="$ipv6/128" + +[ -z "${IF_WAIT_DELAY}" ] && IF_WAIT_DELAY=10 + +wait_for_ipv6_default_route() { + printf "Waiting for IPv6 default route to appear" + while [ $IF_WAIT_DELAY -gt 0 ]; do + if ip -6 route list | grep -q default; then + printf "\n" + return + fi + sleep 1 + printf "." + : $((IF_WAIT_DELAY -= 1)) + done + printf " timeout!\n" +} + +case "$1" in + deconfig) + /sbin/ifconfig $interface up + /sbin/ifconfig $interface 0.0.0.0 + + # drop info from this interface + # resolv.conf may be a symlink to /tmp/, so take care + TMPFILE=$(mktemp) + grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE + cat $TMPFILE > $RESOLV_CONF + rm -f $TMPFILE + + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface + fi + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; + + leasefail|nak) + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot + fi + /sbin/ifconfig $interface $(fw_printenv -n ipaddr || echo -n 192.168.1.10) netmask $(fw_printenv -n netmask || echo -n 255.255.255.0) up + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; + + renew|bound) + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface + fi + /sbin/ifconfig $interface $ip $BROADCAST $NETMASK + if [ -n "$ipv6" ] ; then + wait_for_ipv6_default_route + fi + + if [ -n "$router" ] ; then + echo "deleting routers" + while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do + : + done + + for i in $router ; do + route add default gw $i dev $interface + done + fi + + # drop info from this interface + # resolv.conf may be a symlink to /tmp/, so take care + #TMPFILE=$(mktemp) + #grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE + #cat $TMPFILE > $RESOLV_CONF + #rm -f $TMPFILE + + # Clearing the file because it is in RAM + > $RESOLV_CONF + + # prefer rfc3397 domain search list (option 119) if available + if [ -n "$search" ]; then + search_list=$search + elif [ -n "$domain" ]; then + search_list=$domain + fi + + [ -n "$search_list" ] && + echo "search $search_list" >> $RESOLV_CONF + + for i in $dns ; do + echo adding dns $i + echo "nameserver $i" >> $RESOLV_CONF + done + + ntpd -q -N -n + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; +esac + +HOOK_DIR="$0.d" +for hook in "${HOOK_DIR}/"*; do + [ -f "${hook}" -a -x "${hook}" ] || continue + "${hook}" "${@}" +done + +exit 0 diff --git a/devices/ssc338q_apfpv-greg/general/overlay/var/www/cgi-bin/p/header.cgi b/devices/ssc338q_apfpv-greg/general/overlay/var/www/cgi-bin/p/header.cgi new file mode 100755 index 000000000..b3015341b --- /dev/null +++ b/devices/ssc338q_apfpv-greg/general/overlay/var/www/cgi-bin/p/header.cgi @@ -0,0 +1,117 @@ +#!/usr/bin/haserl +Content-type: text/html; charset=UTF-8 +Cache-Control: no-store +Pragma: no-cache + + + + + + + <% html_title %> + + + + + + + + + +
+
+
+
+
+
+
+ +
+ <%= $(signature) %> +
+ +
+
+
+
+
+
+ +<% if [ -z "$network_gateway" ]; then %> +
+

Internet connection not available, please check your network settings.

+
+<% fi %> + +<% if [ ! -e $(get_config) ]; then %> +
+

Majestic configuration not found, please check your Majestic settings.

+
+<% fi %> + +<% if [ "$(cat /etc/TZ)" != "$TZ" ] || [ -e /tmp/system-reboot ]; then %> +
+

Warning.

+

System settings have been updated, restart to apply pending changes.

+ + Restart camera + +
+<% fi %> + +

<%= $page_title %>

+<% log_read %> diff --git a/devices/ssc338q_apfpv-greg/general/scripts/excludes/ssc338q_apfpv-greg.list b/devices/ssc338q_apfpv-greg/general/scripts/excludes/ssc338q_apfpv-greg.list new file mode 100644 index 000000000..22cfa9327 --- /dev/null +++ b/devices/ssc338q_apfpv-greg/general/scripts/excludes/ssc338q_apfpv-greg.list @@ -0,0 +1,15 @@ +/etc/sensors/imx307.bin +/etc/sensors/gc2053.bin +/etc/sensors/gc4653.bin +/etc/sensors/sc501ai.bin +/lib/modules/4.9.84/kernel/fs/lockd/lockd.ko +/lib/modules/4.9.84/kernel/fs/nfs/nfs.ko +/lib/modules/4.9.84/kernel/fs/nfs/nfsv3.ko +/lib/modules/4.9.84/kernel/net/sunrpc/sunrpc.ko +/lib/modules/4.9.84/sigmastar/sensor_gc2053_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_gc4653_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_imx307_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_imx347_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_os04c10_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_sc501ai_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_sc8235_mipi.ko diff --git a/devices/ssc338q_apfpv-greg_bu/br-ext-chip-sigmastar/configs/ssc338q_apfpv-greg_bu_defconfig b/devices/ssc338q_apfpv-greg_bu/br-ext-chip-sigmastar/configs/ssc338q_apfpv-greg_bu_defconfig new file mode 100644 index 000000000..8d84465d6 --- /dev/null +++ b/devices/ssc338q_apfpv-greg_bu/br-ext-chip-sigmastar/configs/ssc338q_apfpv-greg_bu_defconfig @@ -0,0 +1,75 @@ +# Architecture +BR2_arm=y +BR2_cortex_a7=y +BR2_ARM_FPU_NEON_VFPV4=y +BR2_ARM_INSTRUCTIONS_THUMB2=y + +# Toolchain +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/openipc/firmware/releases/download/$(OPENIPC_TOOLCHAIN).tgz" +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-openipc-linux-gnueabihf" +BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_9=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y +# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set +BR2_TOOLCHAIN_EXTERNAL_CXX=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/openipc/linux/archive/$(OPENIPC_KERNEL).tar.gz" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/infinity6e-ssc012b.config" +BR2_LINUX_KERNEL_UIMAGE=y +BR2_LINUX_KERNEL_XZ=y + +# Filesystem +BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" +BR2_PACKAGE_EXFATPROGS=y +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_ZLIB=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_IW=y +BR2_PACKAGE_WPA_SUPPLICANT=n +BR2_PACKAGE_HOSTAPD=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=n +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y + +# OpenIPC +BR2_OPENIPC_SOC_VENDOR="sigmastar" +BR2_OPENIPC_SOC_MODEL="ssc338q" +BR2_OPENIPC_SOC_FAMILY="infinity6e" +BR2_OPENIPC_VARIANT="apfpv-greg" +BR2_OPENIPC_FLASH_SIZE="16" + +# Packages +BR2_PACKAGE_DROPBEAR_OPENIPC=y +BR2_PACKAGE_EXFAT_OPENIPC=y +BR2_PACKAGE_IPCTOOL=y +BR2_PACKAGE_JSONFILTER=y +BR2_PACKAGE_LIBCURL_OPENIPC=y +BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y +# 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_LIBEVENT_OPENIPC=y +BR2_PACKAGE_LIBOGG_OPENIPC=y +BR2_PACKAGE_MAJESTIC_FONTS=y +BR2_PACKAGE_MAJESTIC_WEBUI=y +BR2_PACKAGE_MAJESTIC=y +BR2_PACKAGE_MBEDTLS_OPENIPC=y +BR2_PACKAGE_MAVFWD=y +BR2_PACKAGE_APFPV_GREG=y +# BR2_PACKAGE_MSPOSD is not set +BR2_PACKAGE_OPUS_OPENIPC=y +BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y +BR2_PACKAGE_RTL8812AU=n +BR2_PACKAGE_RTL88X2EU_OPENIPC=y +BR2_PACKAGE_RTL8733BU_OPENIPC=y +BR2_PACKAGE_RTL8811CU_OPENIPC=n +BR2_PACKAGE_SIGMASTAR_OSDRV_INFINITY6E=y +BR2_PACKAGE_VTUND_OPENIPC=y +BR2_PACKAGE_YAML_CLI=y diff --git a/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S40network b/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S40network new file mode 100755 index 000000000..19f7be166 --- /dev/null +++ b/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S40network @@ -0,0 +1,22 @@ +#!/bin/sh + +case "$1" in + start) + echo "Starting network..." + ifup lo + ifup eth0 + ifup wlan0 + ;; + + stop) + echo "Stopping network..." + ifdown lo + ifdown -f eth0 + ifdown -f wlan0 + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S95majestic b/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S95majestic new file mode 100755 index 000000000..45d908d2f --- /dev/null +++ b/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S95majestic @@ -0,0 +1,62 @@ +#!/bin/sh + +. /etc/init.d/libmedia.sh + +DAEMON="/usr/bin/majestic" +NAME="majestic" +PIDFILE="/var/run/majestic.pid" + +start() { + echo "Starting $NAME..." + if ensure_pidfile "$NAME" "$PIDFILE"; then + echo "$NAME is already running" + return 0 + fi + + rm -f "$PIDFILE" + start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- -s + if [ $? -ne 0 ]; then + echo "Failed to launch $NAME" + return 1 + fi + echo "$NAME launch requested" +} + +stop() { + echo "Stopping $NAME..." + stop_service "$NAME" "$PIDFILE" 15 || return 1 + # Majestic keeps internal single-instance state briefly after exit. + sleep 2 +} + +status() { + if ensure_pidfile "$NAME" "$PIDFILE"; then + echo "$NAME running pid=$(cat "$PIDFILE")" + return 0 + fi + echo "$NAME stopped" + return 1 +} + +reload() { + ensure_pidfile "$NAME" "$PIDFILE" || { + echo "$NAME not running" + return 1 + } + kill -HUP "$(cat "$PIDFILE")" +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart|reload|status) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|status}" + exit 1 + ;; +esac diff --git a/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S99rc.local b/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S99rc.local new file mode 100755 index 000000000..0e20120de --- /dev/null +++ b/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/init.d/S99rc.local @@ -0,0 +1,41 @@ +#!/bin/sh + +MAJESTIC_API="http://localhost/api/v1/config.json" + +wait_for_majestic_ready() { + timeout="${1:-30}" + i=0 + while [ "$i" -lt "$timeout" ]; do + curl -sf --connect-timeout 1 --max-time 2 "$MAJESTIC_API" >/dev/null 2>&1 && return 0 + sleep 1 + i=$((i + 1)) + done + return 1 +} + +start() { + echo "S99rc.local: waiting for majestic API..." + if ! wait_for_majestic_ready 10; then + echo "S99rc.local: majestic API not ready after 10s; continuing with /etc/rc.local anyway" + else + echo "S99rc.local: majestic API ready" + fi + echo "S99rc.local: running /etc/rc.local" + /etc/rc.local +} + +stop() { + [ -x /etc/rc.local.stop ] && /etc/rc.local.stop +} + +case "$1" in + start|stop) + "$1" + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + +exit $? diff --git a/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/network/interfaces.d/wlan0 b/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/network/interfaces.d/wlan0 new file mode 100755 index 000000000..d73c769f0 --- /dev/null +++ b/devices/ssc338q_apfpv-greg_bu/general/overlay/etc/network/interfaces.d/wlan0 @@ -0,0 +1,6 @@ +iface wlan0 inet static + address 192.168.0.1 + netmask 255.255.255.0 + pre-up adapter setup + post-up adapter start + post-down adapter stop diff --git a/devices/ssc338q_apfpv-greg_bu/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko b/devices/ssc338q_apfpv-greg_bu/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko new file mode 100644 index 000000000..c90d54c88 Binary files /dev/null and b/devices/ssc338q_apfpv-greg_bu/general/overlay/lib/modules/4.9.84/sigmastar/sensor_imx415_mipi.ko differ diff --git a/devices/ssc338q_apfpv-greg_bu/general/overlay/usr/share/udhcpc/default.script b/devices/ssc338q_apfpv-greg_bu/general/overlay/usr/share/udhcpc/default.script new file mode 100755 index 000000000..210e7fd5d --- /dev/null +++ b/devices/ssc338q_apfpv-greg_bu/general/overlay/usr/share/udhcpc/default.script @@ -0,0 +1,127 @@ +#!/bin/sh + +# udhcpc script edited by Tim Riker + +# Changes by OpenIPC 2021 +# +# - move resolv.conf path to /tmp +# - remove interface notes from resolv.conf + + +[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 + +RESOLV_CONF="/tmp/resolv.conf" +[ -e $RESOLV_CONF ] || touch $RESOLV_CONF +[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" +[ -n "$subnet" ] && NETMASK="netmask $subnet" +# Handle stateful DHCPv6 like DHCPv4 +[ -n "$ipv6" ] && ip="$ipv6/128" + +[ -z "${IF_WAIT_DELAY}" ] && IF_WAIT_DELAY=10 + +wait_for_ipv6_default_route() { + printf "Waiting for IPv6 default route to appear" + while [ $IF_WAIT_DELAY -gt 0 ]; do + if ip -6 route list | grep -q default; then + printf "\n" + return + fi + sleep 1 + printf "." + : $((IF_WAIT_DELAY -= 1)) + done + printf " timeout!\n" +} + +case "$1" in + deconfig) + /sbin/ifconfig $interface up + /sbin/ifconfig $interface 0.0.0.0 + + # drop info from this interface + # resolv.conf may be a symlink to /tmp/, so take care + TMPFILE=$(mktemp) + grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE + cat $TMPFILE > $RESOLV_CONF + rm -f $TMPFILE + + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface + fi + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; + + leasefail|nak) + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot + fi + /sbin/ifconfig $interface $(fw_printenv -n ipaddr || echo -n 192.168.1.10) netmask $(fw_printenv -n netmask || echo -n 255.255.255.0) up + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; + + renew|bound) + if [ -x /usr/sbin/avahi-autoipd ]; then + /usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface + fi + /sbin/ifconfig $interface $ip $BROADCAST $NETMASK + if [ -n "$ipv6" ] ; then + wait_for_ipv6_default_route + fi + + if [ -n "$router" ] ; then + echo "deleting routers" + while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do + : + done + + for i in $router ; do + route add default gw $i dev $interface + done + fi + + # drop info from this interface + # resolv.conf may be a symlink to /tmp/, so take care + #TMPFILE=$(mktemp) + #grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE + #cat $TMPFILE > $RESOLV_CONF + #rm -f $TMPFILE + + # Clearing the file because it is in RAM + > $RESOLV_CONF + + # prefer rfc3397 domain search list (option 119) if available + if [ -n "$search" ]; then + search_list=$search + elif [ -n "$domain" ]; then + search_list=$domain + fi + + [ -n "$search_list" ] && + echo "search $search_list" >> $RESOLV_CONF + + for i in $dns ; do + echo adding dns $i + echo "nameserver $i" >> $RESOLV_CONF + done + + ntpd -q -N -n + + if [ "$interface" = "eth0" ] && [ -x /usr/bin/adapter ]; then + /usr/bin/adapter route + fi + ;; +esac + +HOOK_DIR="$0.d" +for hook in "${HOOK_DIR}/"*; do + [ -f "${hook}" -a -x "${hook}" ] || continue + "${hook}" "${@}" +done + +exit 0 diff --git a/devices/ssc338q_apfpv-greg_bu/general/overlay/var/www/cgi-bin/p/header.cgi b/devices/ssc338q_apfpv-greg_bu/general/overlay/var/www/cgi-bin/p/header.cgi new file mode 100755 index 000000000..b3015341b --- /dev/null +++ b/devices/ssc338q_apfpv-greg_bu/general/overlay/var/www/cgi-bin/p/header.cgi @@ -0,0 +1,117 @@ +#!/usr/bin/haserl +Content-type: text/html; charset=UTF-8 +Cache-Control: no-store +Pragma: no-cache + + + + + + + <% html_title %> + + + + + + + + + +
+
+
+
+
+
+
+ +
+ <%= $(signature) %> +
+ +
+
+
+
+
+
+ +<% if [ -z "$network_gateway" ]; then %> +
+

Internet connection not available, please check your network settings.

+
+<% fi %> + +<% if [ ! -e $(get_config) ]; then %> +
+

Majestic configuration not found, please check your Majestic settings.

+
+<% fi %> + +<% if [ "$(cat /etc/TZ)" != "$TZ" ] || [ -e /tmp/system-reboot ]; then %> +
+

Warning.

+

System settings have been updated, restart to apply pending changes.

+ + Restart camera + +
+<% fi %> + +

<%= $page_title %>

+<% log_read %> diff --git a/devices/ssc338q_apfpv-greg_bu/general/scripts/excludes/ssc338q_apfpv-greg.list b/devices/ssc338q_apfpv-greg_bu/general/scripts/excludes/ssc338q_apfpv-greg.list new file mode 100644 index 000000000..22cfa9327 --- /dev/null +++ b/devices/ssc338q_apfpv-greg_bu/general/scripts/excludes/ssc338q_apfpv-greg.list @@ -0,0 +1,15 @@ +/etc/sensors/imx307.bin +/etc/sensors/gc2053.bin +/etc/sensors/gc4653.bin +/etc/sensors/sc501ai.bin +/lib/modules/4.9.84/kernel/fs/lockd/lockd.ko +/lib/modules/4.9.84/kernel/fs/nfs/nfs.ko +/lib/modules/4.9.84/kernel/fs/nfs/nfsv3.ko +/lib/modules/4.9.84/kernel/net/sunrpc/sunrpc.ko +/lib/modules/4.9.84/sigmastar/sensor_gc2053_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_gc4653_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_imx307_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_imx347_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_os04c10_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_sc501ai_mipi.ko +/lib/modules/4.9.84/sigmastar/sensor_sc8235_mipi.ko