Add MStar Infinity3

pull/208/head
Dmitry Ermakov 2022-03-21 21:40:06 +03:00
parent 1209ee3008
commit 1782f82dcb
21 changed files with 787891 additions and 9 deletions

View File

@ -0,0 +1,139 @@
name: "MSC313E"
on:
push:
branches:
- production
tags:
- "v*"
# schedule:
# - cron: "00 01 * * *"
workflow_dispatch:
jobs:
build_core:
name: OpenIPC firmware for MSC313E
runs-on: ubuntu-18.04
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v2
- name: Install build dependencies
id: install
run: |
make install-deps
mkdir -p tmp
- name: Free disk space
id: freshing
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Prepare buildroot
id: prepare
run: |
HEAD_TAG=$(git tag --points-at HEAD)
GIT_HASH=$(git rev-parse --short $GITHUB_SHA)
BRANCH_NAME=$(echo $GITHUB_REF | cut -d'/' -f 3)
if [ -z "$HEAD_TAG" ]; then
TAG_NAME="latest"
RELEASE_NAME="Development Build"
PRERELEASE=true
else
TAG_NAME=${{ github.ref }}
RELEASE_NAME="Release ${{ github.ref }}"
PRERELEASE=false
fi
echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
cd $GITHUB_WORKSPACE
make prepare
- name: Build MSC313E firmware
id: build-msc313e-firmware
continue-on-error: true
run: |
ARCHIVE_FW="${GITHUB_WORKSPACE}/output/images/openipc.msc313e-br.tgz"
echo "ARCHIVE_FW=$ARCHIVE_FW" >> $GITHUB_ENV
cd $GITHUB_WORKSPACE
make PLATFORM=sigmastar BOARD=unknown_unknown_msc313e_openipc all
[[ $(stat --printf="%s" ${GITHUB_WORKSPACE}/output/images/uImage) -gt 2097152 ]] && echo "TG_NOTIFY=Warning, kernel size exceeded : $(stat --printf="%s" ${GITHUB_WORKSPACE}/output/images/uImage) vs 2097152... MSC313E" >> $GITHUB_ENV && exit 1
[[ $(stat --printf="%s" ${GITHUB_WORKSPACE}/output/images/rootfs.squashfs) -gt 5242880 ]] && echo "TG_NOTIFY=Warning, rootfs size exceeded - $(stat --printf="%s" ${GITHUB_WORKSPACE}/output/images/rootfs.squashfs) vs 5242880... MSC313E" >> $GITHUB_ENV && exit 1
cd ${GITHUB_WORKSPACE}/output/images
mv uImage uImage.msc313e
mv rootfs.squashfs rootfs.squashfs.msc313e
md5sum rootfs.squashfs.msc313e > rootfs.squashfs.msc313e.md5sum
md5sum uImage.msc313e > uImage.msc313e.md5sum
tar -cvzf $ARCHIVE_FW *msc313e*
- name: Build MSC313E SDK
id: build-msc313e-sdk
continue-on-error: true
run: |
ARCHIVE_SDK="${GITHUB_WORKSPACE}/output/images/arm-openipc-linux-musleabihf_sdk-buildroot.tar.gz"
echo "ARCHIVE_SDK=$ARCHIVE_SDK" >> $GITHUB_ENV
cd $GITHUB_WORKSPACE/output
make sdk
- name: Send warning message to telegram channel
env:
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }}
TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }}
if: steps.build-msc313e-firmware.outcome != 'success' || steps.build-msc313e-sdk.outcome != 'success'
run: |
TG_OPTIONS="-s --connect-timeout 30 --max-time 30"
TG_NOTIFY="${TG_NOTIFY:=Warning, Buildroot compiling error... MSC313E}"
TG_HEADER=$(echo -e "\r\n$TG_NOTIFY \r\n\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH_NAME \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9A\xA0 GitHub Actions")
curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendMessage \
-F chat_id=$TG_CHANNEL -F text="$TG_HEADER"
- name: Create release
uses: actions/create-release@v1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.RELEASE_NAME }}
draft: false
prerelease: ${{ env.PRERELEASE }}
- name: Upload FW to release
uses: svenstaro/upload-release-action@v2
continue-on-error: true
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ARCHIVE_FW }}
asset_name: "openipc.msc313e-br.tgz"
tag: ${{ env.TAG_NAME }}
overwrite: true
- name: Upload SDK to release
uses: svenstaro/upload-release-action@v2
continue-on-error: true
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ARCHIVE_SDK }}
asset_name: "arm-openipc-msc313e-linux-musleabihf_sdk-buildroot.tar.gz"
tag: ${{ env.TAG_NAME }}
overwrite: true
- name: Send binary file to telegram channel
env:
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }}
TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }}
run: |
TG_OPTIONS="-s --connect-timeout 30 --max-time 30"
TG_HEADER=$(echo -e "\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH_NAME \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9C\x85 GitHub Actions")
curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendDocument \
-F chat_id=$TG_CHANNEL -F document="@$ARCHIVE_FW" -F caption="$TG_HEADER"

View File

@ -23,6 +23,7 @@ source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/motors/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/node-exporter/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/opus-openipc/Config.in"
source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/rtl8188fu-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/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,65 @@
#ifndef __LINUX_COMPILER_H
#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
#endif
#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
/* Mark functions as cold. gcc will assume any path leading to a call
to them will be unlikely. This means a lot of manual unlikely()s
are unnecessary now for any paths leading to the usual suspects
like BUG(), printk(), panic() etc. [but let's keep them for now for
older compilers]
Early snapshots of gcc 4.3 don't support this and we can't detect this
in the preprocessor, but we can live with this because they're unreleased.
Maketime probing would be overkill here.
gcc also has a __attribute__((__hot__)) to move hot functions into
a special section, but I don't see any sense in this right now in
the kernel context */
#define __cold __attribute__((__cold__))
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
#ifndef __CHECKER__
# define __compiletime_warning(message) __attribute__((warning(message)))
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* __CHECKER__ */
/*
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
* control elsewhere.
*
* Early snapshots of gcc 4.5 don't support this and we can't detect
* this in the preprocessor, but we can live with this because they're
* unreleased. Really, we need to have autoconf for the kernel.
*/
#define unreachable() __builtin_unreachable()
/* Mark a function definition as prohibited from being cloned. */
#define __noclone __attribute__((__noclone__))
/*
* Tell the optimizer that something else uses this function or variable.
*/
#define __visible __attribute__((externally_visible))
/*
* GCC 'asm goto' miscompiles certain code sequences:
*
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
*
* Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
*
* (asm goto is automatically volatile - the naming reflects this.)
*/
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
#define __HAVE_BUILTIN_BSWAP32__
#define __HAVE_BUILTIN_BSWAP64__
#define __HAVE_BUILTIN_BSWAP16__
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,84 @@
--- a/scripts/ms_bin_option_get_int.py 2021-05-17 00:51:18.868114209 +0300
+++ b/scripts/ms_bin_option_get_int.py 2021-05-17 00:05:08.807550092 +0300
@@ -5,10 +5,16 @@
if __name__ == '__main__':
name=sys.argv[2]
-# if sys.argv[3].upper().startswith( '0X' ):
-# value=long(sys.argv[3],16)
-# else:
-# value=long(sys.argv[3])
+ if sys.version_info.major == 2:
+ if sys.argv[3].upper().startswith( '0X' ):
+ value=long(sys.argv[3],16)
+ else:
+ value=long(sys.argv[3])
+ else:
+ if sys.argv[3].upper().startswith( '0X' ):
+ value=int(sys.argv[3],16)
+ else:
+ value=int(sys.argv[3])
fmap=mmap.mmap(os.open(sys.argv[1],os.O_RDWR),0)
--- a/scripts/ms_bin_option_update_int.py 2021-05-17 00:51:18.868114209 +0300
+++ b/scripts/ms_bin_option_update_int.py 2021-05-17 01:02:24.277864288 +0300
@@ -3,12 +3,19 @@
import re, fnmatch, os, sys, mmap, struct
if __name__ == '__main__':
-
- name=sys.argv[2]
- if sys.argv[3].upper().startswith( '0X' ):
- value=long(sys.argv[3],16)
+ print(sys.argv)
+ if sys.version_info.major == 2:
+ name=sys.argv[2]
+ if sys.argv[3].upper().startswith( '0X' ):
+ value=long(sys.argv[3],16)
+ else:
+ value=long(sys.argv[3])
else:
- value=long(sys.argv[3])
+ name=sys.argv[2].encode()
+ if sys.argv[3].upper().startswith( '0X' ):
+ value=int(sys.argv[3],16)
+ else:
+ value=int(sys.argv[3])
fmap=mmap.mmap(os.open(sys.argv[1],os.O_RDWR),0)
--- a/scripts/ms_builtin_dtb_update.py
+++ b/scripts/ms_builtin_dtb_update.py
@@ -6,7 +6,7 @@
name='#MS_DTB#'
- dtb_file=open(sys.argv[2])
+ dtb_file=open(sys.argv[2], "rb+")
dtb_file.seek(0,os.SEEK_END)
size=dtb_file.tell()
dtb_file.seek(0,os.SEEK_SET)
@@ -19,7 +19,10 @@
fmap=mmap.mmap(os.open(sys.argv[1],os.O_RDWR),0)
- offset=fmap.find(name)
+ if sys.version_info.major == 2:
+ offset=fmap.find(name)
+ else:
+ offset=fmap.find(name.encode())
if offset >=0:
print ('offset:0x%08X' % offset)
print (' size:0x%08X' % size )
--- a/scripts/ms_gen_mvxv_h.py
+++ b/scripts/ms_gen_mvxv_h.py
@@ -18,7 +18,7 @@
#print args
if args.file is None :
- print 'ERROR: must specify output header file!!'
+ print ('ERROR: must specify output header file!!')
sys.exit(-1)
version_file=open(args.file,'w')

View File

@ -0,0 +1,11 @@
--- a/scripts/dtc/dtc-lexer.lex.c_shipped 2015-08-07 22:08:04.000000000 +0300
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped 2021-11-01 22:15:12.347053553 +0300
@@ -637,7 +637,7 @@
#include "srcpos.h"
#include "dtc-parser.tab.h"
-YYLTYPE yylloc;
+extern YYLTYPE yylloc;
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
#define YY_USER_ACTION \

View File

@ -48,18 +48,26 @@
fmap=mmap.mmap(os.open(sys.argv[1],os.O_RDWR),0)
--- a/scripts/ms_builtin_dtb_update.py 2021-05-17 00:51:18.868114209 +0300
+++ b/scripts/ms_builtin_dtb_update.py 2021-05-17 00:02:41.886266869 +0300
@@ -19,7 +19,11 @@
--- a/scripts/ms_builtin_dtb_update.py
+++ b/scripts/ms_builtin_dtb_update.py
@@ -6,7 +6,7 @@
name='#MS_DTB#'
- dtb_file=open(sys.argv[2])
+ dtb_file=open(sys.argv[2], "rb+")
dtb_file.seek(0,os.SEEK_END)
size=dtb_file.tell()
dtb_file.seek(0,os.SEEK_SET)
@@ -19,7 +19,10 @@
fmap=mmap.mmap(os.open(sys.argv[1],os.O_RDWR),0)
- offset=fmap.find(name)
- offset=fmap.find(name)
+ if sys.version_info.major == 2:
+ offset=fmap.find(name)
+ else:
+ offset=fmap.find(name.encode())
+
if offset >=0:
print ('offset:0x%08X' % offset)
print (' size:0x%08X' % size )

View File

@ -1,7 +1,98 @@
# 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="3.18.30"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_18=y
# Toolchain
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_GCC_VERSION_7_X=y
# BR2_TOOLCHAIN_USES_UCLIBC is not set
# BR2_TOOLCHAIN_BUILDROOT_UCLIBC is not set
# BR2_TOOLCHAIN_BUILDROOT_LIBC="uclibc"
BR2_TOOLCHAIN_USES_MUSL=y
BR2_TOOLCHAIN_BUILDROOT_MUSL=y
BR2_TOOLCHAIN_BUILDROOT_LIBC="musl"
BR2_TOOLCHAIN_BUILDROOT_CXX=y
# BR2_TOOLCHAIN_BUILDROOT_LOCALE is not set
BR2_TOOLCHAIN_BUILDROOT_USE_SSP=y
# Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.18.30"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_SIGMASTAR_PATH)/board/infinity3/kernel/msc313e.generic.config"
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/infinity3/kernel/patches/ $(BR2_EXTERNAL_SIGMASTAR_PATH)/board/infinity3/kernel/overlay"
# 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 v2.2"
BR2_TARGET_GENERIC_HOSTNAME="openipc-msc313e"
BR2_GLOBAL_PATCH_DIR="$(TOPDIR)/../general/package/all-patches"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(TOPDIR)/../scripts/executing_commands_for_$(BR2_TOOLCHAIN_BUILDROOT_LIBC).sh"
# 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_LAME_OPENIPC=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_LIBWEBSOCKETS_OPENIPC=y
BR2_PACKAGE_LIBYAML=y
BR2_PACKAGE_MAJESTIC_FONTS=y
# BR2_PACKAGE_MAJESTIC_MSC313E=y
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=y
BR2_PACKAGE_OPUS_OPENIPC=y
BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y
BR2_PACKAGE_SIGMASTAR_OSDRV_MSC313E=y
# BR2_PACKAGE_SSHPASS is not set
BR2_PACKAGE_UACME_OPENIPC=y
BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_NL80211=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC=y
BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC_MT7601U=y
# BR2_PACKAGE_RTL8188EU is not set
# WIREGUARD
BR2_PACKAGE_WIREGUARD_LINUX_COMPAT=y
BR2_PACKAGE_WIREGUARD_TOOLS=y

View File

@ -23,6 +23,7 @@ include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/motors/motors.mk
include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/node-exporter/node-exporter.mk
include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/opus-openipc/opus-openipc.mk
include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/rtl8188fu-openipc/rtl8188fu-openipc.mk
include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-msc313e/sigmastar-osdrv-msc313e.mk
include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-ssc335/sigmastar-osdrv-ssc335.mk
include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/uacme-openipc/uacme-openipc.mk
include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/vtund-openipc/vtund-openipc.mk

View File

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

View File

@ -18,7 +18,7 @@ fresh() {
[ -d buildroot-2020.02.12/dl ] && mv buildroot-2020.02.12/dl .
make distclean #clean
[ -d buildroot* ] && echo -e "\nBuildroot found, OK\n" || make prepare
[ -d dl ] && mv dl buildroot-2020.02.12/dl
[ -d dl ] && mv dl buildroot-2020.02.12/dl || return 0
}
should_fit() {
@ -373,6 +373,13 @@ nt98566() {
#################################################################################
msc313e() {
soc="msc313e"
fresh && make PLATFORM=sigmastar BOARD=unknown_unknown_${soc}_openipc all && rename
}
#################################################################################
ssc325() {
soc="ssc325"
fresh && make PLATFORM=sigmastar BOARD=unknown_unknown_${soc}_openipc all && rename
@ -570,6 +577,8 @@ gk7102s # testing..
#
#######
#
# msc313e # OpenIPC
#
# ssc325 # OpenIPC
#
# ssc333 # OpenIPC

View File

@ -0,0 +1,6 @@
config BR2_PACKAGE_SIGMASTAR_OSDRV_MSC313E
bool "sigmastar-osdrv-msc313e"
help
sigmastar-osdrv-msc313e - SigmaStar kernel modules and libs
https://openipc.org

View File

@ -0,0 +1,72 @@
#!/bin/sh
DAEMON="majestic"
PIDFILE="/var/run/$DAEMON.pid"
DAEMON_ARGS="-s"
# shellcheck source=/dev/null
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
load_majestic() {
printf 'Starting %s: ' "$DAEMON"
[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, "
# shellcheck disable=SC2086 # we need the word splitting
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)" = "D0:22:12:88:88:88" ]; 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,69 @@
#!/bin/sh
#
# OpenIPC.org | 2021.04.26
#
if [ TEST$2 != "TEST" ];
then
export level=$2
else
export level=0
fi
echo "$0 $1 $level"
set_level()
{
export DEBUGLEVEL=$1
echo $DEBUGLEVEL > /proc/mi_modules/mi_ai/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_ao/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_divp/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_rgn/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_sensor/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_shadow/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_sys/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_venc/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_vif/debug_level
echo $DEBUGLEVEL > /proc/mi_modules/mi_vpe/debug_level
}
show_level()
{
export SHELLCMD="cat /proc/mi_modules/mi_ai/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_ao/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_divp/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_rgn/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_sensor/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_shadow/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_sys/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_venc/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_vif/debug_level "
echo $SHELLCMD && $SHELLCMD
export SHELLCMD="cat /proc/mi_modules/mi_vpe/debug_level "
echo $SHELLCMD && $SHELLCMD
}
case "$1" in
set)
set_level $level
show_level
;;
show)
show_level
;;
*)
echo $"Usage: $0 {set|show}"
exit 1
;;
esac

View File

@ -0,0 +1,85 @@
#!/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 = "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, 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,179 @@
#!/bin/sh
#
# OpenIPC.org | 2021.06.16
#
# Useage: ./load [ -r|-i|-a ]
# -r : rmmod all modules
# -i : insmod all modules
# default : rmmod all moules and then insmod them
PATH_MODULE=/lib/modules/3.18.30/sigmastar
# Sensor
sensor=$(fw_printenv -n 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=256 logBufSize=256
insmod ${PATH_MODULE}/mi_ai.ko
insmod ${PATH_MODULE}/mi_ao.ko
insmod ${PATH_MODULE}/mi_rgn.ko
insmod ${PATH_MODULE}/mi_divp.ko thread_priority=98
#insmod ${PATH_MODULE}/mi_ipu.ko
insmod ${PATH_MODULE}/mi_vpe.ko thread_priority=98
insmod ${PATH_MODULE}/mi_sensor.ko
insmod ${PATH_MODULE}/mi_vif.ko thread_priority=98
#
case $sensor in
gc2053)
# Untested | The information is obtained from the Gospell firmware
insmod ${PATH_MODULE}/mi_venc.ko max_width=1920 max_height=1080 max_jpe_task=1;
;;
gc4653)
# Untested | The information is obtained from the Anjoy firmware
insmod ${PATH_MODULE}/mi_venc.ko max_width=2560 max_height=1440 thread_priority=99;
;;
imx307)
# Untested | The information is obtained from the Anjoy and Brovotech (no any params) firmware
insmod ${PATH_MODULE}/mi_venc.ko max_width=2304 max_height=1296 thread_priority=99;
;;
imx335)
# Untested | The information is obtained from the Anjoy firmware
insmod ${PATH_MODULE}/mi_venc.ko max_width=2592 max_height=1944 thread_priority=99;
;;
sc2239)
# Untested | The information is obtained from the IMOU firmware
insmod ${PATH_MODULE}/mi_venc.ko thread_priority=99;
;;
sc2335)
# Untested | The information is obtained from the Tiandy firmware
insmod ${PATH_MODULE}/mi_venc.ko;
;;
sc3335)
# Untested | The information is obtained from the Uniview firmware (no any params on other version)
insmod ${PATH_MODULE}/mi_venc.ko max_width=2304 max_height=1296 mi_timeout_reset=1;
;;
auto)
insmod ${PATH_MODULE}/mi_venc.ko;
;;
*)
echo -e "\n\e[1;31mAn UNSUPPORTED sensor type is specified - ${sensor}\e[0m\n" | logger -s -t OpenIPC;
;;
esac
#
insmod ${PATH_MODULE}/mi_shadow.ko
#
major=$(awk '$2=="mi_poll" {print $1}' /proc/devices)
mknod /dev/mi_poll c $major 0
#
# Disable it now, untested
#echo hvsp2 down /config/iqfile/filter.txt /config/iqfile/filter.txt > /sys/class/mstar/mscl/hvsp
#
# Change firmware folder
# insmod ${PATH_MODULE}/mi_venc.ko fw_path="/config/venc_fw/chagall.bin"
#
# Change configs folder
echo isproot /etc/sensors/iqfile > /dev/ispmid
#
case $sensor in
gc2053)
# Untested | The information is obtained from the Gospell firmware
insmod ${PATH_MODULE}/sensor_gc2053_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2;
;;
gc4653)
# Untested | The information is obtained from the Anjoy firmware
insmod ${PATH_MODULE}/sensor_gc4653_mipi.ko chmap=1;
;;
imx307)
# Untested | The information is obtained from the Anjoy and Brovotech (mclk=37.125M) firmware
insmod ${PATH_MODULE}/sensor_imx307_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2 mclk=37.125M;
;;
imx335)
# Untested | The information is obtained from the Anjoy firmware
insmod ${PATH_MODULE}/sensor_imx335_mipi.ko chmap=1;
;;
sc2239)
# Untested | The information is obtained from the IMOU firmware
insmod ${PATH_MODULE}/sensor_sc2239_mipi.ko chmap=1;
;;
sc2335)
# Untested | The information is obtained from the Tiandy firmware
insmod ${PATH_MODULE}/sensor_sc2335_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2;
;;
sc3335)
# Untested | The information is obtained from the Uniview firmware
insmod ${PATH_MODULE}/sensor_sc3335_mipi.ko chmap=1;
;;
auto)
insmod ${PATH_MODULE}/sensor_imx307_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2 mclk=37.125M;
insmod ${PATH_MODULE}/sensor_gc2053_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2;
insmod ${PATH_MODULE}/sensor_sc2335_mipi.ko chmap=1 lane_num=2 hdr_lane_num=2;
;;
*)
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 drv_ms_cus_gc2053_MIPI
rmmod drv_ms_cus_gc4653_MIPI
rmmod drv_ms_cus_imx307_MIPI
rmmod drv_ms_cus_imx335_MIPI
rmmod drv_ms_cus_sc2239_MIPI
rmmod drv_ms_cus_sc2335_MIPI
rmmod drv_ms_cus_sc3335_MIPI
rmmod mi_shadow
rmmod mi_venc
rmmod mi_vif
rmmod mi_sensor
rmmod mi_vpe
rmmod mi_ipu
rmmod mi_divp
rmmod mi_rgn
rmmod mi_ao
rmmod mi_ai
rmmod mi_sys
rmmod mi_common
rmmod mhal
}
if [ -z ${sensor} ]; then
echo -e "\n\e[1;31mThe sensor parameter is MISSING\e[0m\n" | logger -s -t OpenIPC
exit 1
elif [ ${sensor} = "none" ]; then
echo -e "\n\e[1;33mThe sensor is assigned to NONE\e[0m\n" | logger -s -t OpenIPC
exit 0
elif [ ${sensor} = "auto" ]; then
echo -e "\n\e[1;33mThe sensor is assigned to AUTO\e[0m\n" | logger -s -t OpenIPC
else
echo -e "\n\e[1;32mThe sensor is assigned - ${sensor}\e[0m\n" | logger -s -t OpenIPC
# Temporary crutch, sorry
[ ! -f /data/ut/chagall.bin ] && (mkdir -p /data/ut; ln -sf /etc/sensors/venc_fw/chagall.bin /data/ut/chagall.bin)
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,33 @@
################################################################################
#
# sigmastar-osdrv-msc313e
#
################################################################################
SIGMASTAR_OSDRV_MSC313E_VERSION =
SIGMASTAR_OSDRV_MSC313E_SITE =
SIGMASTAR_OSDRV_MSC313E_LICENSE = MIT
SIGMASTAR_OSDRV_MSC313E_LICENSE_FILES = LICENSE
define SIGMASTAR_OSDRV_MSC313E_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
$(INSTALL) -m 755 -t $(TARGET_DIR)/etc/init.d $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-msc313e/files/script/S95sigmastar
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/sensors/iqfile
# $(INSTALL) -m 755 -d $(TARGET_DIR)/etc/sensors/venc_fw
# $(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensors/venc_fw $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-msc313e/files/sensor/venc_fw/chagall.bin
$(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/3.18.30/sigmastar
# $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.18.30/sigmastar $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-msc313e/files/kmod/*.ko
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-msc313e/files/script/load*
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-msc313e/files/script/ircut_demo
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-msc313e/files/script/debug_level
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib
# $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib/ $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-msc313e/files/lib/*.so
endef
$(eval $(generic-package))