another AXE init shuffling and workarounds - still not perfect, added missing /lib/modules/axe files

This commit is contained in:
Jaroslav Kysela 2015-04-10 15:08:02 +02:00
parent a89e966c0e
commit 422e02c5a8
8 changed files with 682 additions and 12 deletions

View File

@ -1,4 +1,4 @@
BUILD=5
BUILD=6
VERSION=$(shell date +%Y%m%d%H%M)-$(BUILD)
CPUS=4
STLINUX=/opt/STM/STLinux-2.4
@ -23,6 +23,8 @@ KMODULES = drivers/usb/serial/cp210x.ko \
drivers/usb/serial/ftdi_sio.ko \
drivers/usb/serial/oti6858.ko
MINISATIP_COMMIT=54df9348e7bd7e6075f54f1b93ec4ad36429abe0
BUSYBOX=busybox-1.23.2
DROPBEAR=dropbear-2015.67
@ -35,6 +37,7 @@ OSCAM_REV=10619
define GIT_CLONE
@mkdir -p apps/
git clone $(1) apps/$(2)
cd apps/$(2) && git checkout -b axe $(3)
endef
define WGET
@ -62,13 +65,14 @@ dist:
# create CPIO
#
fs.cpio: kernel-modules busybox dropbear minisatip oscam
fs.cpio: kernel-modules busybox dropbear minisatip oscam tools/axehelper
fakeroot tools/do_min_fs.py \
-r "$(VERSION)" \
-b "bash strace" \
$(foreach m,$(EXTRA_AXE_MODULES), -e "$(EXTRA_AXE_MODULES_DIR)/$(m):lib/modules/axe/$(m)") \
$(foreach m,$(ORIG_FILES), -e "$(EXTRA_AXE_MODULES_DIR)/../$(m):lib/modules/axe/$(m)") \
$(foreach m,$(KMODULES), -e "kernel/$(m):lib/modules/$(m)") \
-e "tools/axehelper:sbin/axehelper" \
-e "apps/$(BUSYBOX)/busybox:bin/busybox" \
$(foreach f,$(DROPBEAR_SBIN_FILES), -e "apps/$(DROPBEAR)/$(f):sbin/$(f)") \
$(foreach f,$(DROPBEAR_BIN_FILES), -e "apps/$(DROPBEAR)/$(f):usr/bin/$(f)") \
@ -163,6 +167,9 @@ firmware/initramfs/root/modules_idl4k_7108_ST40HOST_LINUX_32BITS/axe_dmx.ko:
# syscall dump
#
tools/axehelper: tools/axehelper.c
$(TOOLCHAIN)/bin/sh4-linux-gcc -o tools/axehelper -Wall -lrt tools/axehelper.c
tools/syscall-dump.so: tools/syscall-dump.c
$(TOOLCHAIN)/bin/sh4-linux-gcc -o tools/syscall-dump.o -c -fPIC -Wall tools/syscall-dump.c
$(TOOLCHAIN)/bin/sh4-linux-gcc -o tools/syscall-dump.so -shared -rdynamic tools/syscall-dump.o -ldl
@ -183,7 +190,7 @@ s2i_dump: tools/syscall-dump.so
#
apps/minisatip/axe.h:
$(call GIT_CLONE,https://github.com/catalinii/minisatip.git,minisatip)
$(call GIT_CLONE,https://github.com/catalinii/minisatip.git,minisatip,$(MINISATIP_COMMIT))
cd apps/minisatip; patch -p1 < ../../patches/minisatip-axe.patch
apps/minisatip/minisatip: apps/minisatip/axe.h

View File

@ -17,6 +17,7 @@ mkdir /dev/pts /dev/input
mount -t devpts none /dev/pts -ogid=5,mode=620
# use mdev/sysfs
mkdir -p /lib/modules/$(uname -r)
mount -t sysfs sysfs /sys
touch /dev/mdev.seq
mkdir -p /media
@ -37,15 +38,6 @@ sysctl -q -p
# start syslogd
syslogd -C256
# loopback
ifconfig lo 127.0.0.1 netmask 255.255.255.0
# AXE modules and AXE hw initialization
/lib/modules/axe/load_modules.sh
/etc/init.d/axe &
nc -l 127.0.0.1:1001 -e /bin/true
rm -f /root/main_init.sh
# config/data storage
mkdir -p /mnt/data
mount -t jffs2 /dev/mtdblock4 /mnt/data/
@ -58,6 +50,17 @@ if test -r /etc/sysconfig/passwd ; then
cp /etc/sysconfig/passwd /etc/passwd
fi
# loopback
ifconfig lo 127.0.0.1 netmask 255.255.255.0
# AXE modules and AXE hw initialization
sync
/lib/modules/axe/load_modules.sh
/etc/init.d/axe &
axehelper wait 5000 -10 /tmp/axe-done
#nc -l 127.0.0.1:1001 -e /bin/true
rm -f /root/main_init.sh /tmp/axe-done
# hostname
test -r /etc/sysconfig/config && . /etc/sysconfig/config
test -n "$HOSTNAME" && hostname "$HOSTNAME"

View File

@ -11,6 +11,7 @@ while test ! -f /tmp/nosatip; do
while ! test -r /tmp/satip-network; do
nc -l 127.0.0.1:999 -e /etc/init.d/satip-network
done
. /etc/sysconfig/config
minisatip -f -g $MINISATIP_OPTS
logger "minisatip exited $?, restarting"
done

View File

@ -0,0 +1,286 @@
#!/bin/sh
###############################################################################
## SETUP STAPI DEVICE NAME ENVIRONMENT VARIABLES ##
###############################################################################
## Export LD_LIBRARY_PATH for shared libraries
## -------------------------------------------
export LD_LIBRARY_PATH=/usr/local/lib/libstsdk:$LD_LIBRARY_PATH
## STAPI Root Device Name
## ----------------------
ST_DEV_ROOT_NAME=stapi
export ST_DEV_ROOT_NAME
## STAVMEM Device Name
## -------------------
STAVMEM_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stavmem_ioctl
export STAVMEM_IOCTL_DEV_PATH
## STAUDLX Device Name
## -------------------
STAUDLX_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/staudlx_ioctl
export STAUDLX_IOCTL_DEV_PATH
## STBLAST Device Name
## -------------------
STBLAST_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stblast_ioctl
export STBLAST_IOCTL_DEV_PATH
## STBLIT Device Name
## ------------------
STBLIT_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stblit_ioctl
export STBLIT_IOCTL_DEV_PATH
## STBUFFER Device Name
## --------------------
STBUFFER_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stbuffer_ioctl
export STBUFFER_IOCTL_DEV_PATH
## STCC Device Name
## ----------------
STCC_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stcc_ioctl
export STCC_IOCTL_DEV_PATH
## STCLKRV Device Name
## -------------------
STCLKRV_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stclkrv_ioctl
export STCLKRV_IOCTL_DEV_PATH
## STCOMMON Device Name
## --------------------
STCOMMON_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stcommon_ioctl
export STCOMMON_IOCTL_DEV_PATH
## STDENC Device Name
## ------------------
STDENC_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stdenc_ioctl
export STDENC_IOCTL_DEV_PATH
## STDRMCRYPTO Device Name
## -----------------------
STDRMCRYPTO_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stdrmcrypto_ioctl
export STDRMCRYPTO_IOCTL_DEV_PATH
## STEVT Device Name
## -----------------
STEVT_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stevt_ioctl
export STEVT_IOCTL_DEV_PATH
## STFASTFILTER Device Name
## ------------------------
STFASTFILTER_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stfastfilter_ioctl
export STFASTFILTER_IOCTL_DEV_PATH
## STFDMA Device Name
## ------------------
STFDMA_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stfdma_ioctl
export STFDMA_IOCTL_DEV_PATH
## STFRONTEND Device Name
## ----------------------
STFRONTEND_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stfrontend_ioctl
export STFRONTEND_IOCTL_DEV_PATH
## STFSK Device Name
## -----------------
STFSK_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stfsk_ioctl
export STFSK_IOCTL_DEV_PATH
## STGFB Device Name
## -----------------
STGFB_CORE_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stgfb_core
export STGFB_CORE_DEV_PATH
STGFB_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stgfb_ioctl
export STGFB_IOCTL_DEV_PATH
## STGXOBJ Device Name
## -------------------
STGXOBJ_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stgxobj_ioctl
export STGXOBJ_IOCTL_DEV_PATH
## STHDMI Device Name
## ------------------
STHDMI_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/sthdmi_ioctl
export STHDMI_IOCTL_DEV_PATH
## STI2C Device Name
## -----------------
STI2C_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/sti2c_ioctl
export STI2C_IOCTL_DEV_PATH
## STINJECT Device Name
## --------------------
STINJECT_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stinject_ioctl
export STINJECT_IOCTL_DEV_PATH
## STIPRC Device Name
## ------------------
STIPRC_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stiprc_ioctl
export STIPRC_IOCTL_DEV_PATH
## STKEYSCN Device Name
## --------------------
STKEYSCN_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stkeyscn_ioctl
export STKEYSCN_IOCTL_DEV_PATH
## STLAYER Device Name
## -------------------
STLAYER_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stlayer_ioctl
export STLAYER_IOCTL_DEV_PATH
## STMERGE Device Name
## -------------------
STMERGE_IOCTL_DEV_PATH="/dev/${ST_DEV_ROOT_NAME}/stmerge_ioctl"
export STMERGE_IOCTL_DEV_PATH
## MME Device Name
## ---------------
MME_IOCTL_DEV_PATH="/dev/${ST_DEV_ROOT_NAME}/mme"
export MME_IOCTL_DEV_PATH
## MME Device Name
## ---------------
MME_IOCTL_DEV_PATH="/dev/${ST_DEV_ROOT_NAME}/mme"
export MME_IOCTL_DEV_PATH
## STNET Device Name
## -----------------
STNET_IOCTL_DEV_PATH="/dev/${ST_DEV_ROOT_NAME}/stnet_ioctl"
export STNET_IOCTL_DEV_PATH
## STPCPD Device Name
## ------------------
STPCPD_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpcpd_ioctl
export STPCPD_IOCTL_DEV_PATH
## STPCCRD Device Name
## -------------------
STPCCRD_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpccrd_ioctl
export STPCCRD_IOCTL_DEV_PATH
## STPDCRYPTO Device Name
## ----------------------
STPDCRYPTO_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpdcrypto_ioctl
export STPDCRYPTO_DEV_PATH
## STPIO Device Name
## -----------------
STPIO_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpio_ioctl
export STPIO_IOCTL_DEV_PATH
## STPOD Device Name
## -----------------
STPOD_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpod_ioctl
export STPOD_IOCTL_DEV_PATH
## STPOWER Device Name
## -------------------
STPOWER_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpower_ioctl
export STPOWER_IOCTL_DEV_PATH
## STPTI4 Device Name
## ------------------
STPTI4_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpti4_ioctl
export STPTI4_IOCTL_DEV_PATH
## STPTI5 Device Name
## ------------------
STPTI5_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpti5_ioctl
export STPTI5_IOCTL_DEV_PATH
## STPWM Device Name
## -----------------
STPWM_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stpwm_ioctl
export STPWM_IOCTL_DEV_PATH
## STRM Device Name
## ----------------
STRM_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/strm_ioctl
export STRM_IOCTL_DEV_PATH
## STSCART Device Name
## -------------------
STSCART_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stscart_ioctl
export STSCART_IOCTL_DEV_PATH
## STSKB Device Name
## -----------------
STSKB_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stskb_ioctl
export STSKB_IOCTL_DEV_PATH
## STSMART Device Name
## -------------------
STSMART_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stsmart_ioctl
export STSMART_IOCTL_DEV_PATH
## STSPI Device Name
## -----------------
STSPI_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stspi_ioctl
export STSPI_IOCTL_DEV_PATH
## STSUBT Device Name
## ------------------
STSUBT_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stsubt_ioctl
export STSUBT_IOCTL_DEV_PATH
## STSYS Device Name
## -----------------
STSYS_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stsys_ioctl
export STSYS_IOCTL_DEV_PATH
## STTBX Device Name
## -----------------
STTBX_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/sttbx_ioctl
export STTBX_IOCTL_DEV_PATH
## STTKDMA Device Name
## -------------------
STTKDMA_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/sttkdma_ioctl
export STTKDMA_IOCTL_DEV_PATH
## STTTX Device Name
## -----------------
STTTX_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stttx_ioctl
export STTTX_IOCTL_DEV_PATH
## STTUNER Device Name
## -------------------
STTUNER_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/sttuner_ioctl
export STTUNER_DEV_PATH
## STUART Device Name
## ------------------
STUART_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stuart_ioctl
export STUART_IOCTL_DEV_PATH
## STVBI Device Name
## -----------------
STVBI_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stvbi_ioctl
export STVBI_IOCTL_DEV_PATH
## STVID Device Name
## -----------------
STVID_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stvid_ioctl
export STVID_IOCTL_DEV_PATH
## STVIN Device Name
## -----------------
STVIN_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stvin_ioctl
export STVIN_IOCTL_DEV_PATH
## STVMIX Device Name
## ------------------
STVMIX_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stvmix_ioctl
export STVMIX_IOCTL_DEV_PATH
## STVOUT Device Name
## ------------------
STVOUT_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stvout_ioctl
export STVOUT_IOCTL_DEV_PATH
## STVTG Device Name
## -----------------
STVTG_IOCTL_DEV_PATH=/dev/${ST_DEV_ROOT_NAME}/stvtg_ioctl
export STVTG_IOCTL_DEV_PATH

View File

@ -0,0 +1,332 @@
#!/bin/sh
###############################################################################
## SETUP STAPI DEVICE NAME ENVIRONMENT VARIABLES ##
###############################################################################
# Check if we are on virtual platform (running on x86) or not
# -----------------------------------------------------------
runonvirtualplatform="no"
if [ -f /proc/hce/cwd ]; then
runonvirtualplatform="yes"
fi
# Verify if root module is specified
# ----------------------------------
export PATH=$PATH:/sbin
if [ -z "$MODULES_INSTALL_DIR" ] ; then
if [ "$runonvirtualplatform" = "no" ] ; then
export MODULES_INSTALL_DIR=/lib/modules/axe
else
export MODULES_INSTALL_DIR=.
fi
fi
if [ "$runonvirtualplatform" = "no" ] ; then
source $MODULES_INSTALL_DIR/load_env.sh
else
. $MODULES_INSTALL_DIR/load_env.sh
fi
# Check if we are in 32 or 29bits
# -------------------------------
if [ -f $MODULES_INSTALL_DIR/load_modules_list_29BITS.txt ]; then
LOAD_MODULES_LIST=$MODULES_INSTALL_DIR/load_modules_list_29BITS.txt
AXE_LOAD_MODULES_LIST=$MODULES_INSTALL_DIR/load_modules_list_axe_29BITS.txt
MODE="29BITS"
else
MODE="32BITS"
if [ -f $MODULES_INSTALL_DIR/load_modules_list_32BITS.txt ]; then
LOAD_MODULES_LIST=$MODULES_INSTALL_DIR/load_modules_list_32BITS.txt
AXE_LOAD_MODULES_LIST=$MODULES_INSTALL_DIR/load_modules_list_axe_32BITS.txt
else
LOAD_MODULES_LIST=$MODULES_INSTALL_DIR/load_modules_list.txt
AXE_LOAD_MODULES_LIST=$MODULES_INSTALL_DIR/load_modules_list_axe.txt
fi
fi
###############################################################################
## SETUP DIRECTORY ACCESS ##
###############################################################################
# Verify if modules list exist
# ----------------------------
if [ ! -f $LOAD_MODULES_LIST ] ; then
echo "$LOAD_MODULES_LIST does not exist"
exit
fi
# Create /dev/stapi directory if not exist
# ----------------------------------------
if [ ! -e /dev/stapi ]; then mkdir -p /dev/stapi ;fi
chmod 755 /dev/stapi
if [ ! -e /dev/axe ]; then mkdir -p /dev/axe ;fi
chmod 755 /dev/axe
###############################################################################
## MODULE INSERT PROCEDURE ##
###############################################################################
# Return chip version
# -------------------
define_chip_info()
{
export chipset=`cat /proc/stsys_ioctl/chipset | cut -b1-7`
export chipver=`cat /proc/stsys_ioctl/chipset | cut -b9-9`
}
# Create a node in /dev/ (Arg 1=node_name)
# ----------------------------------------
create_node()
{
node_name="$1"
major=`cat /proc/devices | grep "\b$node_name\b" | cut -b1-3`
if [ ! -z "$major" ]; then
dev="/dev/stapi/$node_name"
if [ -c ${dev} ]; then
if [ "$runonvirtualplatform" = "no" ] ; then
cur_major=$((0x`stat -c %t $dev 2>/dev/null`))
else
cur_major=`cat /proc/devices | grep $node_name|cut -d " " -f 1`
fi
if [ $major -ne $cur_major ]; then
rm -f ${dev} 2> /dev/null
mknod $dev c $major 0 || return 1
chmod 0660 $dev || return 1
fi
fi
if [ ! -c ${dev} ] ; then
rm -f ${dev} 2> /dev/null
mknod $dev c $major 0 || return 1
chmod 0660 $dev || return 1
fi
fi
}
# Load firmware (Arg 1=video1 or audio1)
# --------------------------------------
load_firmware()
{
if [ "$1" = "rt1" ] ; then
if [ "$chipset" = "STx7108" ] ; then
cat $MODULES_INSTALL_DIR/rt_7108_firmware.bin >/dev/stapi/lxload
fi
fi
if [ "$1" = "video1" ] ; then
if [ "$chipset" = "STx5206" ] ; then
cat $MODULES_INSTALL_DIR/companion_5206_video_Ax.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7105" ] ; then
cat $MODULES_INSTALL_DIR/companion_7105_video_Ax.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7106" ] ; then
cat $MODULES_INSTALL_DIR/companion_7106_video_Ax.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7108" ] ; then
if [ "$chipver" = "A" ] ; then
cat $MODULES_INSTALL_DIR/companion_7108_video_Ax.bin >/dev/stapi/lxload
else
cat $MODULES_INSTALL_DIR/companion_7108_video_Bx.bin >/dev/stapi/lxload
fi
fi
if [ "$chipset" = "STx7109" ] ; then
cat $MODULES_INSTALL_DIR/companion_7109_video_Cx.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7111" ] ; then
cat $MODULES_INSTALL_DIR/companion_7111_video_Ax.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7141" ] ; then
cat $MODULES_INSTALL_DIR/companion_7141_video_Ax.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STxH205" ] ; then
cat $MODULES_INSTALL_DIR/companion_h205_video_Ax.bin >/dev/stapi/lxload
fi
fi
if [ "$1" = "audio1" ] ; then
if [ "$chipset" = "STx5206" ] ; then
cat $MODULES_INSTALL_DIR/companion_5206_audio.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7105" ] ; then
cat $MODULES_INSTALL_DIR/companion_7105_audio.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7106" ] ; then
cat $MODULES_INSTALL_DIR/companion_7106_audio.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7108" ] ; then
cat $MODULES_INSTALL_DIR/companion_7108_audio.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7109" ] ; then
cat $MODULES_INSTALL_DIR/companion_7109_audio.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7111" ] ; then
cat $MODULES_INSTALL_DIR/companion_7111_audio.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STx7141" ] ; then
cat $MODULES_INSTALL_DIR/companion_7141_audio.bin >/dev/stapi/lxload
fi
if [ "$chipset" = "STxH205" ] ; then
cat $MODULES_INSTALL_DIR/companion_h205_audio.bin >/dev/stapi/lxload
fi
fi
rmmod lxload
}
# Insert separate STAPI modules
# -----------------------------
insert_separated_modules()
{
cat $LOAD_MODULES_LIST | grep -v "^#" | (while read mode mod_file node_name param; do
if [ "$mode" != "-" ] ; then
if [ "$mode" != "$MODE" ] ; then
continue
fi
fi
if [ "$param" = "-" ] ; then
param=""
fi
if [ ! -f $MODULES_INSTALL_DIR/$mod_file ] ; then
continue
fi
if [ "$node_name" = "lxload" ] ; then
if [ "$param" = "type=rt1" ] ; then
if [ ! -f "$MODULES_INSTALL_DIR/rt_7108_firmware.bin" ] ; then
continue
fi
fi
fi
if [ "$mod_file" = "embxmailbox.ko" ] ; then
if [ ! -f $MODULES_INSTALL_DIR/ics.ko ] ; then
output=$(insmod $MODULES_INSTALL_DIR/$mod_file $param 2>&1 | cat)
else
output=$(insmod $MODULES_INSTALL_DIR/$mod_file 2>&1 | cat)
fi
else
output=$(insmod $MODULES_INSTALL_DIR/$mod_file $param 2>&1 | cat)
fi
[ "$output" != "" ] && { echo "$output" | grep "File exists" >/dev/null && echo "Warning : $mod_file already inserted, skipping" || { echo "$output" ; exit 1 ; } ; }
if [ ! "$node_name" = "-" ] ; then
create_node "$node_name"
fi
if [ "$node_name" = "lxload" ] ; then
define_chip_info
if [ "$param" = "type=rt1" ] ; then
load_firmware "rt1"
fi
if [ "$param" = "type=video1" ] ; then
load_firmware "video1"
fi
if [ "$param" = "type=video2" ] ; then
load_firmware "video2"
fi
if [ "$param" = "type=audio1" ] ; then
load_firmware "audio1"
fi
if [ "$param" = "type=audio2" ] ; then
load_firmware "audio2"
fi
fi
done)
}
# Insert unique STAPI module
# --------------------------
insert_unified_module()
{
# Now we load STAPI and create nodes
echo "* Inserting STAPI Module"
insmod $MODULES_INSTALL_DIR/stapi_core_stripped.ko || return 1
if [ "$1" != "no_stapi_ioctl" ] ; then
insmod $MODULES_INSTALL_DIR/stapi_ioctl_stripped.ko || return 1
else
if [ -f $MODULES_INSTALL_DIR/stpti4_ioctl.ko ]; then
insmod $MODULES_INSTALL_DIR/stpti4_ioctl.ko || return 1
fi
if [ -f $MODULES_INSTALL_DIR/stpti5_ioctl.ko ]; then
insmod $MODULES_INSTALL_DIR/stpti5_ioctl.ko || return 1
fi
fi
if [ -f $MODULES_INSTALL_DIR/staudlx_alsa.ko ]; then
insmod $MODULES_INSTALL_DIR/staudlx_alsa.ko || return 1
fi
if [ "$1" != "no_stapi_ioctl" ] ; then
echo "* Creating device nodes in /dev/stapi"
cat $LOAD_MODULES_LIST | grep -v "^#" | grep -v lxload | (while read mode mod_file node_name param; do
if [ ! "$node_name" = "-" ] ; then
create_node $node_name
fi
done)
fi
}
# Inserting AXE modules
# ---------------------
insert_axe_modules ()
{
local HW=$(awk 'match($0, /hw=[^ ]*/) {print substr($0,RSTART,RLENGTH)}' /proc/cmdline)
local HWID=${HW:3:40}
#echo "$HW"
#echo "$HWID"
if [ ${#HWID} -ne 32 ] ; then
echo "HWID has wrong length"
fi
grep -v "^#" $AXE_LOAD_MODULES_LIST | (while read mode mod_file node_name param minor_cnt; do
if [ "$mode" != "-" ] ; then
if [ "$mode" != "$MODE" ] ; then
continue
fi
fi
if [ ! -f $MODULES_INSTALL_DIR/$mod_file ] ; then
continue
fi
if [ "$param" = "-" ] ; then
param=""
fi
if [ "$node_name" = "frontend" -a "${HWID:0:3}" = "161" ] ; then
mod_file="axe_fe_ml.ko"
fi
param="$(echo $param | sed -e 's/,/ /g')"
insmod $MODULES_INSTALL_DIR/$mod_file $param
done)
/lib/modules/axe/mknodes.out i
## WORKAROUND: if no HWID defined reverse the demux's routing
if [ ${#HWID} -eq 0 ] ; then
echo "SWAPPING TS ROUTE LIKE FOR OLD BOARD"
mv /dev/axe/demux-0 /dev/axe/demux-00
mv /dev/axe/demux-1 /dev/axe/demux-0
mv /dev/axe/demux-00 /dev/axe/demux-1
mv /dev/axe/demuxts-0 /dev/axe/demuxts-00
mv /dev/axe/demuxts-1 /dev/axe/demuxts-0
mv /dev/axe/demuxts-00 /dev/axe/demuxts-1
mv /dev/axe/demux-2 /dev/axe/demux-20
mv /dev/axe/demux-3 /dev/axe/demux-2
mv /dev/axe/demux-20 /dev/axe/demux-3
mv /dev/axe/demuxts-2 /dev/axe/demuxts-20
mv /dev/axe/demuxts-3 /dev/axe/demuxts-2
mv /dev/axe/demuxts-20 /dev/axe/demuxts-3
fi
}
# Choose between inserting severall or unified module
# ---------------------------------------------------
if [ $# -eq 0 ] || [ "$1" != "not_unified" ]; then
if [ -f "$MODULES_INSTALL_DIR/stapi_core_stripped.ko" ] && [ -f "$MODULES_INSTALL_DIR/stapi_ioctl_stripped.ko" ]; then
insert_unified_module $1
else
insert_separated_modules
fi
else
insert_separated_modules
fi
insert_axe_modules

View File

@ -4,5 +4,6 @@
# it is respawned immediately on exit
#
touch "/tmp/axe-done"
echo | nc 127.0.0.1 1001
while test 1; do sleep 999999999; done

1
tools/.gitignore vendored
View File

@ -1,3 +1,4 @@
axehelper
syscall-dump.o
syscall-dump.o.x86_64
syscall-dump.so

39
tools/axehelper.c Normal file
View File

@ -0,0 +1,39 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
unsigned long
getTick ()
{
static unsigned long init = 0;
unsigned long t;
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
t = ts.tv_nsec / 1000000;
t += ts.tv_sec * 1000;
if (init == 0)
init = t;
return t - init;
}
int main(int argc, char *argv[])
{
if (argc > 1 && !strcmp(argv[1], "wait")) {
long int ms = 1000;
const char *f = NULL;
if (argc > 2)
ms = atol(argv[2]);
if (argc > 3)
nice(atoi(argv[3]));
if (argc > 4)
f = argv[4][0] ? argv[4] : NULL;
ms += getTick();
while (ms > getTick())
if (f && !access(f, R_OK))
break;
}
return 0;
}