mirror of https://github.com/OpenIPC/firmware.git
Fix Hisilicom compiling trouble
parent
7201613178
commit
f176dd2d64
Binary file not shown.
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
|
||||
DAEMON="majestic"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
DAEMON_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# 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 hisilicon "Check MAC for Xiongmai devices"
|
||||
if [ "$(fw_printenv -n ethaddr)" = "00:00:23:34:45:66" ]; then
|
||||
logger -s -p daemon.info -t hisilicon "The eth0 interface has a lousy MAC, let's try to change it.."
|
||||
XMMAC="$(ipcinfo --xm_mac)" && [ -n "${XMMAC}" ] && fw_setenv ethaddr ${XMMAC} && ifconfig eth0 hw ether ${XMMAC} && logger -s -p daemon.info -t hisilicon "The eth0 interface have new MAC - ${XMMAC}" && reboot -f
|
||||
else
|
||||
logger -s -p daemon.info -t hisilicon "The eth0 interface has a correct MAC - $(fw_printenv -n ethaddr)"
|
||||
fi
|
||||
#
|
||||
logger -s -p daemon.info -t hisilicon "Loading of kernel modules and initialization of the video system has started"
|
||||
export TZ=$(cat /etc/TZ)
|
||||
load_hisilicon -i
|
||||
#
|
||||
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"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
[ -f /usr/sbin/$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
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
|
@ -0,0 +1,87 @@
|
|||
#!/bin/sh
|
||||
|
||||
# on EV200:
|
||||
# GPIO1_0 -> GPIO8 (1*8+0 = 8)
|
||||
# GPIO1_1 -> GPIO9 (1*8+1 = 9)
|
||||
|
||||
# on EV300:
|
||||
# GPIO1_3 -> GPIO11
|
||||
# GPIO1_2 -> GPIO10
|
||||
|
||||
#(normal mode)
|
||||
ir_cut_enable() {
|
||||
# pin_mux
|
||||
echo "$gpio_0" >/sys/class/gpio/unexport
|
||||
echo "$gpio_1" >/sys/class/gpio/unexport
|
||||
echo "$gpio_0" >/sys/class/gpio/export
|
||||
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 (normal 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
|
||||
}
|
||||
|
||||
# (ir mode)
|
||||
ir_cut_disable() {
|
||||
# pin_mux
|
||||
echo "$gpio_0" >/sys/class/gpio/unexport
|
||||
echo "$gpio_1" >/sys/class/gpio/unexport
|
||||
echo "$gpio_0" >/sys/class/gpio/export
|
||||
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 (ir 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 <chip> <mode>"
|
||||
echo "for example:"
|
||||
echo "ir mode : ./ircut_demo hi3516ev200 1"
|
||||
else
|
||||
if [ $1 = "hi3516ev200" ]; then
|
||||
gpio_0=8
|
||||
gpio_1=9
|
||||
elif [ $1 = "hi3516ev300" ]; then
|
||||
gpio_0=11
|
||||
gpio_1=10
|
||||
else
|
||||
echo "wrong chipid: $1, please select: hi3516ev200 or hi3516ev300."
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $2 -eq 0 ]; then
|
||||
echo "normal mode, ir_cut on"
|
||||
ir_cut_enable >/dev/null
|
||||
elif [ $2 -eq 1 ]; then
|
||||
echo "ir mode, ir_cut off"
|
||||
ir_cut_disable >/dev/null
|
||||
else
|
||||
echo "invalid mode, please slect 0 or 1."
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1 @@
|
|||
#
|
|
@ -0,0 +1,39 @@
|
|||
################################################################################
|
||||
#
|
||||
# hisilicon-osdrv-hi3516cv200
|
||||
#
|
||||
################################################################################
|
||||
|
||||
HISILICON_OSDRV_HI3516CV200_VERSION =
|
||||
HISILICON_OSDRV_HI3516CV200_SITE =
|
||||
HISILICON_OSDRV_HI3516CV200_LICENSE = MIT
|
||||
HISILICON_OSDRV_HI3516CV200_LICENSE_FILES = LICENSE
|
||||
|
||||
|
||||
define HISILICON_OSDRV_HI3516CV200_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
|
||||
$(INSTALL) -m 755 -t $(TARGET_DIR)/etc/init.d $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/script/S99hisilicon
|
||||
|
||||
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/sensors
|
||||
# $(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensors $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/sensor/config/*.ini
|
||||
|
||||
$(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/4.9.37/hisilicon
|
||||
# $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.37/hisilicon $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/kmod/*.ko
|
||||
# $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.9.37/hisilicon $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/kmod/xxx.ko
|
||||
|
||||
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
|
||||
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/script/load_hisilicon
|
||||
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/script/ircut_demo
|
||||
|
||||
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib/fonts
|
||||
$(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib/fonts $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/fonts/*.bin
|
||||
|
||||
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib/sensors
|
||||
# $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib/sensors $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/sensor/*.so
|
||||
|
||||
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib
|
||||
# $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib/ $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/lib/*.so
|
||||
# $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib/ $(BR2_EXTERNAL_HISILICON_PATH)/package/hisilicon-osdrv-hi3516cv200/files/lib/xxx.so
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
Loading…
Reference in New Issue