diff --git a/general/Config.in b/general/Config.in index 789d0944..2393e68e 100644 --- a/general/Config.in +++ b/general/Config.in @@ -1,17 +1,17 @@ config BR2_OPENIPC_SOC_VENDOR - string "openipc soc vendor" + string "SoC vendor" default "hisilicon" config BR2_OPENIPC_SOC_MODEL - string "openipc soc model" + string "SoC model" default "hi3516ev300" config BR2_OPENIPC_SOC_FAMILY - string "openipc soc family" + string "SoC family" default "hi3516ev200" config BR2_OPENIPC_FLAVOR - string "openipc flavor" + string "OpenIPC flavor" default "lite" source "$BR2_EXTERNAL_GENERAL_PATH/package/Config.in" diff --git a/general/overlay/etc/init.d/S01syslogd b/general/overlay/etc/init.d/S01syslogd index 675aa750..a14c1b0b 100755 --- a/general/overlay/etc/init.d/S01syslogd +++ b/general/overlay/etc/init.d/S01syslogd @@ -36,19 +36,19 @@ stop() { return "$status" } -restart() { - stop - sleep 1 - start -} - case "$1" in - start|stop|restart) - "$1" ;; - reload) - # Restart, since there is no true "reload" feature. - restart ;; + start|stop) + "$1" + ;; + + restart|reload) + stop + sleep 1 + start + ;; + *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 + ;; esac diff --git a/general/overlay/etc/init.d/S10modules b/general/overlay/etc/init.d/S10modules index 5c893c9c..6ed9e789 100755 --- a/general/overlay/etc/init.d/S10modules +++ b/general/overlay/etc/init.d/S10modules @@ -10,7 +10,8 @@ case "$1" in [ -r /etc/modules ] || exit 0 while read module args; do case "$module" in - ""|"#"*) continue ;; + ""|"#"*) continue + ;; esac # attempt to load modules diff --git a/general/overlay/etc/init.d/S10resetd b/general/overlay/etc/init.d/S10resetd index f6ac30e9..df33dd4f 100755 --- a/general/overlay/etc/init.d/S10resetd +++ b/general/overlay/etc/init.d/S10resetd @@ -1,8 +1,8 @@ #!/bin/sh case "$1" in - start) - echo -e '\nLoading resetd...' - /usr/sbin/resetd & - ;; + start) + echo -e '\nLoading resetd...' + /usr/sbin/resetd & + ;; esac diff --git a/general/overlay/etc/init.d/S21rngd b/general/overlay/etc/init.d/S21rngd index 699d0957..547719c2 100755 --- a/general/overlay/etc/init.d/S21rngd +++ b/general/overlay/etc/init.d/S21rngd @@ -32,10 +32,16 @@ stop() case "$1" in start|stop) - "$1" ;; + "$1" + ;; + restart|reload) - stop; start ;; + stop + start + ;; + *) echo "Usage: $0 {start|stop|restart|reload}" >&2 exit 1 + ;; esac diff --git a/general/overlay/etc/init.d/S40mdev b/general/overlay/etc/init.d/S40mdev index bbcbef81..e2dad6dd 100755 --- a/general/overlay/etc/init.d/S40mdev +++ b/general/overlay/etc/init.d/S40mdev @@ -9,13 +9,17 @@ case "$1" in echo /sbin/mdev >/proc/sys/kernel/hotplug /sbin/mdev -s ;; + stop) ;; + restart|reload) ;; + *) - echo "Usage: $0 {start|stop|restart}" + echo "Usage: $0 {start|stop|restart|reload}" exit 1 + ;; esac exit $? diff --git a/general/overlay/etc/init.d/S49ntpd b/general/overlay/etc/init.d/S49ntpd index d07b9eef..0caf7eb7 100755 --- a/general/overlay/etc/init.d/S49ntpd +++ b/general/overlay/etc/init.d/S49ntpd @@ -36,18 +36,19 @@ stop() { return "$status" } -restart() { - stop - sleep 1 - start -} - case "$1" in - start|stop|restart) - "$1" ;; + start|stop) + "$1" + ;; + reload) - restart ;; + stop + sleep 1 + start + ;; + *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 + ;; esac diff --git a/general/overlay/etc/init.d/S50dropbear b/general/overlay/etc/init.d/S50dropbear index c65c5f43..b3d9fb67 100755 --- a/general/overlay/etc/init.d/S50dropbear +++ b/general/overlay/etc/init.d/S50dropbear @@ -30,24 +30,27 @@ start() { start-stop-daemon -S -q -p /var/run/dropbear.pid --exec /usr/sbin/dropbear -- $DROPBEAR_ARGS [ $? = 0 ] && echo "OK" || echo "FAIL" } + stop() { printf "Stopping dropbear sshd: " start-stop-daemon -K -q -p /var/run/dropbear.pid [ $? = 0 ] && echo "OK" || echo "FAIL" } -restart() { - stop - start -} case "$1" in - start|stop|restart) - "$1" ;; - reload) - restart ;; + start|stop) + "$1" + ;; + + restart|reload) + stop + start + ;; + *) - echo "Usage: $0 {start|stop|restart}" + echo "Usage: $0 {start|stop|restart|reload}" exit 1 + ;; esac exit $? diff --git a/general/overlay/etc/init.d/S50snmpd b/general/overlay/etc/init.d/S50snmpd index 4c570e74..a8fc7959 100755 --- a/general/overlay/etc/init.d/S50snmpd +++ b/general/overlay/etc/init.d/S50snmpd @@ -38,18 +38,19 @@ stop() { return "$status" } -restart() { - stop - sleep 1 - start -} - case "$1" in - start|stop|restart) - "$1" ;; - reload) - restart ;; + start|stop) + "$1" + ;; + + restart|reload) + stop + sleep 1 + start + ;; + *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 + ;; esac diff --git a/general/overlay/etc/init.d/S50telnet b/general/overlay/etc/init.d/S50telnet index 24bea503..b6ff0274 100755 --- a/general/overlay/etc/init.d/S50telnet +++ b/general/overlay/etc/init.d/S50telnet @@ -22,12 +22,18 @@ stop() { case "$1" in start|stop) - "$1" ;; + "$1" + ;; + restart|reload) - stop; start ;; + stop + start + ;; + *) - echo "Usage: $0 {start|stop|restart}" + echo "Usage: $0 {start|stop|restart|reload}" exit 1 + ;; esac exit $? diff --git a/general/overlay/etc/init.d/S60crond b/general/overlay/etc/init.d/S60crond index 2670d41c..4402eed7 100755 --- a/general/overlay/etc/init.d/S60crond +++ b/general/overlay/etc/init.d/S60crond @@ -38,18 +38,19 @@ stop() { return "$status" } -restart() { - stop - sleep 1 - start -} - case "$1" in - start|stop|restart) - "$1" ;; - reload) - restart ;; + start|stop) + "$1" + ;; + + restart|reload) + stop + sleep 1 + start + ;; + *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 + ;; esac diff --git a/general/overlay/etc/init.d/S70vendor b/general/overlay/etc/init.d/S70vendor index d17105b7..4b89f798 100755 --- a/general/overlay/etc/init.d/S70vendor +++ b/general/overlay/etc/init.d/S70vendor @@ -1,7 +1,6 @@ #!/bin/sh # load vendor specific drivers -# vendor=$(ipcinfo -v) status=$(check_mac) diff --git a/general/overlay/etc/init.d/rcS b/general/overlay/etc/init.d/rcS index 8e7b7f94..12d3a003 100755 --- a/general/overlay/etc/init.d/rcS +++ b/general/overlay/etc/init.d/rcS @@ -1,37 +1,30 @@ #!/bin/sh - # Setting the TimeZone for all processes -# export TZ=$(cat /etc/TZ) - # Set the firmware creation time as the base system time -# /bin/date -s @$(stat -t /etc/os-release | cut -d" " -f12) - # Start all init scripts in /etc/init.d # executing them in numerical order. -# -for i in /etc/init.d/S??* ;do +for i in /etc/init.d/S??* ; do + # Ignore dangling symlinks (if any). + [ ! -f "$i" ] && continue - # Ignore dangling symlinks (if any). - [ ! -f "$i" ] && continue + case "$i" in + *.sh) + # Source shell script for speed. + ( + trap - INT QUIT TSTP + set start + $i + ) + ;; - case "$i" in - *.sh) - # Source shell script for speed. - ( - trap - INT QUIT TSTP - set start - . $i - ) - ;; - *) - # No sh extension, so fork subprocess. - $i start - ;; - esac + *) + # No sh extension, so fork subprocess. + $i start + ;; + esac done - diff --git a/general/overlay/etc/network/if-post-down.d/bridge b/general/overlay/etc/network/if-post-down.d/bridge index 93e8eef0..2f7cb41a 100755 --- a/general/overlay/etc/network/if-post-down.d/bridge +++ b/general/overlay/etc/network/if-post-down.d/bridge @@ -7,13 +7,20 @@ case "$IF_BRIDGE_PORTS" in "") - exit 0 ;; + exit 0 + ;; + none) - INTERFACES="" ;; + INTERFACES="" + ;; + all) - INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/') ;; + INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/') + ;; + *) - INTERFACES="$IF_BRIDGE_PORTS" ;; + INTERFACES="$IF_BRIDGE_PORTS" + ;; esac brctl delbr $IFACE diff --git a/general/overlay/etc/network/if-pre-up.d/bridge b/general/overlay/etc/network/if-pre-up.d/bridge index 7681684c..3be40117 100755 --- a/general/overlay/etc/network/if-pre-up.d/bridge +++ b/general/overlay/etc/network/if-pre-up.d/bridge @@ -7,13 +7,20 @@ case "$IF_BRIDGE_PORTS" in "") - exit 0 ;; + exit 0 + ;; + none) - INTERFACES="" ;; + INTERFACES="" + ;; + all) - INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/') ;; + INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/') + ;; + *) - INTERFACES="$IF_BRIDGE_PORTS" ;; + INTERFACES="$IF_BRIDGE_PORTS" + ;; esac brctl addbr $IFACE && diff --git a/general/overlay/etc/network/if-pre-up.d/vlan b/general/overlay/etc/network/if-pre-up.d/vlan index 3c8637af..f16aab8e 100755 --- a/general/overlay/etc/network/if-pre-up.d/vlan +++ b/general/overlay/etc/network/if-pre-up.d/vlan @@ -3,34 +3,41 @@ # Most of this stuff is to enable vlans case "$IFACE" in - vlan0*) + vlan0*) vconfig set_name_type VLAN_PLUS_VID VLANID=$(echo $IFACE|sed "s/vlan0*//") ;; + vlan*) vconfig set_name_type VLAN_PLUS_VID_NO_PAD VLANID=$(echo $IFACE|sed "s/vlan*//") ;; + *.0*) vconfig set_name_type DEV_PLUS_VID VLANID=$(echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g") IF_VLAN_RAW_DEVICE=$(echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/") ;; + *.*) vconfig set_name_type DEV_PLUS_VID_NO_PAD VLANID=$(echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g") IF_VLAN_RAW_DEVICE=$(echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/") ;; + *) exit 0 + ;; esac if [ -n "$IF_VLAN_RAW_DEVICE" ]; then [ ! -x /sbin/vconfig ] && exit 0 + if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null; then echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE" exit 1 fi + ip link set up dev $IF_VLAN_RAW_DEVICE vconfig add $IF_VLAN_RAW_DEVICE $VLANID fi diff --git a/general/overlay/etc/profile b/general/overlay/etc/profile index b1d4f3e7..997fbe3d 100644 --- a/general/overlay/etc/profile +++ b/general/overlay/etc/profile @@ -23,17 +23,29 @@ export EDITOR='/bin/vi' [ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; } -differ() { diff -rN "/rom$1" "$1"; } +differ() { + diff -rN "/rom$1" "$1" +} -majestic_changes() { diff -L "Majestic changes" -U 3 /rom/etc/majestic.yaml /etc/majestic.yaml; } +majestic_changes() { + diff -L "Majestic changes" -U 3 /rom/etc/majestic.yaml /etc/majestic.yaml +} -show_modules() { echo; cat /proc/modules | cut -f 1 -d " " | while read module; do echo "Module: $module"; \ +show_modules() { + echo; cat /proc/modules | cut -f 1 -d " " | while read module; do echo "Module: $module"; \ if [ -d "/sys/module/$module/parameters" ]; then ls /sys/module/$module/parameters/ | while read parameter; \ - do echo -n "Parameter: $parameter --> "; cat /sys/module/$module/parameters/$parameter; done; fi; echo; done; } + do echo -n "Parameter: $parameter --> "; cat /sys/module/$module/parameters/$parameter; done; fi; echo; done +} -show_fullname() { echo "openipc-$(ipcinfo --chip-name)-$(ipcinfo --short-sensor)"; } +show_fullname() { + echo "openipc-$(ipcinfo --chip-name)-$(ipcinfo --short-sensor)" +} -set_fullname() { show_fullname >/etc/hostname; } +set_fullname() { + show_fullname >/etc/hostname +} # Source configuration files from /etc/profile.d -for i in /etc/profile.d/*.sh; do [ -r "$i" ] && . $i; done; unset i +for i in /etc/profile.d/*.sh; do + [ -r "$i" ] && . $i +done; unset i diff --git a/general/overlay/usr/sbin/extutils b/general/overlay/usr/sbin/extutils index d0c96a4e..1a5044bb 100755 --- a/general/overlay/usr/sbin/extutils +++ b/general/overlay/usr/sbin/extutils @@ -13,9 +13,11 @@ case "${CMD}" in cli) yaml-cli -i /etc/majestic.yaml "$@" ;; + sensor_cli) yaml-cli -i /etc/sensor/$(fw_printenv -n sensor).yaml $@ ;; + ipctool) IPCTOOL=/tmp/ipctool if [ ! -x $IPCTOOL ]; then @@ -25,11 +27,13 @@ case "${CMD}" in fi $IPCTOOL $@ ;; + check_mac) if [ "$(fw_printenv -n ethaddr)" = "00:00:23:34:45:66" ]; then XMMAC="$(ipcinfo --xm-mac)" && [ -n "${XMMAC}" ] && [ ! "Nothing found." = "${XMMAC}" ] && fw_setenv ethaddr ${XMMAC} && reboot -f || echo "Warning. Wired network interface has default MAC address, please change it." fi ;; + *) ;; esac diff --git a/general/overlay/usr/sbin/firstboot b/general/overlay/usr/sbin/firstboot index e820fac0..04f7baa4 100755 --- a/general/overlay/usr/sbin/firstboot +++ b/general/overlay/usr/sbin/firstboot @@ -5,7 +5,7 @@ set -e if [ "$1" = "-s" ]; then - sysupgrade -n -x + sysupgrade -n -x else - sysupgrade -n -fi \ No newline at end of file + sysupgrade -n +fi diff --git a/general/overlay/usr/sbin/gpio b/general/overlay/usr/sbin/gpio index ffcab319..a76a51d3 100755 --- a/general/overlay/usr/sbin/gpio +++ b/general/overlay/usr/sbin/gpio @@ -1,105 +1,105 @@ #!/bin/sh help() { - echo -e "\n=== GPIO usage ===\n" + echo -e "\n=== GPIO usage ===\n" - echo -e ">\t gpio \n" - echo -e "set\t\t = Output HI\nclear\t\t = Output LOW\ntoggle\t\t = Swap HI <> LOW\nunexport\t = Release GPIO pin back to the kernel space\nread\t\t = Read GPIO pin output state\n" - - echo -e "---\n" + echo -e ">\t gpio \n" + echo -e "set\t\t = Output HI\nclear\t\t = Output LOW\ntoggle\t\t = Swap HI <> LOW\nunexport\t = Release GPIO pin back to the kernel space\nread\t\t = Read GPIO pin output state\n" - echo -e ">\t gpio search \n" - echo -e "Toggle a range of GPIO pins from HI to LOW" - echo -e "gpio search logs to syslog\n" + echo -e "---\n" - echo -e "==================\n" + echo -e ">\t gpio search \n" + echo -e "Toggle a range of GPIO pins from HI to LOW" + echo -e "gpio search logs to syslog\n" + + echo -e "==================\n" } exp() { - if [ ! -d /sys/class/gpio/gpio$1 ]; then - [ ! -f /sys/class/gpio/export ] && echo "Error: No export file!" && exit - echo $1 > /sys/class/gpio/export - [ ! -f /sys/class/gpio/gpio$1/direction ] && echo "Error: No direction file!" && exit - echo out > /sys/class/gpio/gpio$1/direction - fi + if [ ! -d /sys/class/gpio/gpio$1 ]; then + [ ! -f /sys/class/gpio/export ] && echo "Error: No export file!" && exit + echo $1 > /sys/class/gpio/export + [ ! -f /sys/class/gpio/gpio$1/direction ] && echo "Error: No direction file!" && exit + echo out > /sys/class/gpio/gpio$1/direction + fi } write(){ - echo $1 > /sys/class/gpio/gpio$2/value + echo $1 > /sys/class/gpio/gpio$2/value } read() { - [ ! -f /sys/class/gpio/gpio$1/value ] && echo "Error: GPIO-$1 is not set" && exit - echo $(cat /sys/class/gpio/gpio$1/value) + [ ! -f /sys/class/gpio/gpio$1/value ] && echo "Error: GPIO-$1 is not set" && exit + echo $(cat /sys/class/gpio/gpio$1/value) } unexport() { - if [ -d /sys/class/gpio/gpio$1 ]; then - echo $1 > /sys/class/gpio/unexport - else - echo "GPIO-${1} is not exported." - fi + if [ -d /sys/class/gpio/gpio$1 ]; then + echo $1 > /sys/class/gpio/unexport + else + echo "GPIO-${1} is not exported." + fi } search() { - echo -e "Start blink (output) on GPIO range $1 to $2\n" - for pin in $(seq $1 $2); do - echo "=================================" - exp ${pin} && echo " Exported GPIO-${pin} from kernel space" && echo " Set GPIO-${pin} to OUTPUT mode" - write 0 ${pin} && echo " Set GPIO-${pin} to LO level" ; sleep 1 - write 1 ${pin} && echo " Set GPIO-${pin} to HI level" ; sleep 1 - echo in > /sys/class/gpio/gpio${pin}/direction && echo " Set GPIO-${pin} to INPUT mode" - unexport ${pin} && echo " Unexported GPIO-${pin}" - logger HELLO - ${pin} - done + echo -e "Start blink (output) on GPIO range $1 to $2\n" + for pin in $(seq $1 $2); do + echo "=================================" + exp ${pin} && echo " Exported GPIO-${pin} from kernel space" && echo " Set GPIO-${pin} to OUTPUT mode" + write 0 ${pin} && echo " Set GPIO-${pin} to LO level" ; sleep 1 + write 1 ${pin} && echo " Set GPIO-${pin} to HI level" ; sleep 1 + echo in > /sys/class/gpio/gpio${pin}/direction && echo " Set GPIO-${pin} to INPUT mode" + unexport ${pin} && echo " Unexported GPIO-${pin}" + logger HELLO - ${pin} + done } if [ -n $1 ] && [ -n $2 ] && [ $2 -eq $2 ]; then - case $1 in - set) - exp $2 - echo "Setting GPIO-$2 to HI" - write 1 $2 - ;; + case $1 in + set) + exp $2 + echo "Setting GPIO-$2 to HI" + write 1 $2 + ;; - clear) - exp $2 - echo "Setting GPIO-$2 to LOW" - write 0 $2 - ;; + clear) + exp $2 + echo "Setting GPIO-$2 to LOW" + write 0 $2 + ;; - toggle) - exp $2 - if [ $(read $2) -eq 0 ]; then - echo "Setting GPIO-$2 to HI" - write 1 $2 - else - echo "Setting GPIO-$2 to LOW" - write 0 $2 - fi - ;; + toggle) + exp $2 + if [ $(read $2) -eq 0 ]; then + echo "Setting GPIO-$2 to HI" + write 1 $2 + else + echo "Setting GPIO-$2 to LOW" + write 0 $2 + fi + ;; - unexport) - unexport $2 - ;; + unexport) + unexport $2 + ;; - read) - echo $(read $2) - ;; + read) + echo $(read $2) + ;; - search) - if [ ! -z $3 ] && [ $3 -eq $3 ]; then - search $2 $3 - else - echo -e "\n Caution: Toggling single pin. Use to search a range.\n" - search $2 $2 - fi - ;; + search) + if [ ! -z $3 ] && [ $3 -eq $3 ]; then + search $2 $3 + else + echo -e "\n Caution: Toggling single pin. Use to search a range.\n" + search $2 $2 + fi + ;; - *) - help - ;; - esac + *) + help + ;; + esac else - help + help fi diff --git a/general/overlay/usr/sbin/light b/general/overlay/usr/sbin/light index 88d334d2..5d7aef8a 100755 --- a/general/overlay/usr/sbin/light +++ b/general/overlay/usr/sbin/light @@ -5,90 +5,89 @@ GPIO_GREEN= GPIO_BLUE= help() { - echo -e "\n================= LIGHT usage =================\n" - echo -e "Set the colour of the status light\n" - echo -e "light \n" + echo -e "\n================= LIGHT usage =================\n" + echo -e "Set the colour of the status light\n" + echo -e "light \n" } setRed() { - if [ -n "$GPIO_RED" ]; then - [ $1 -eq 1 ] && gpio set "$GPIO_RED" || gpio clear "$GPIO_RED" - else - echo "[INFO] Status Lights: Red GPIO undefined in /usr/sbin/light" > /dev/kmsg - fi + if [ -n "$GPIO_RED" ]; then + [ $1 -eq 1 ] && gpio set "$GPIO_RED" || gpio clear "$GPIO_RED" + else + echo "[INFO] Status Lights: Red GPIO undefined in /usr/sbin/light" > /dev/kmsg + fi } setGreen() { - if [ -n "$GPIO_GREEN" ]; then - [ $1 -eq 1 ] && gpio set "$GPIO_GREEN" || gpio clear "$GPIO_GREEN" - else - echo "[INFO] Status Lights: Green GPIO undefined in /usr/sbin/light" > /dev/kmsg - fi + if [ -n "$GPIO_GREEN" ]; then + [ $1 -eq 1 ] && gpio set "$GPIO_GREEN" || gpio clear "$GPIO_GREEN" + else + echo "[INFO] Status Lights: Green GPIO undefined in /usr/sbin/light" > /dev/kmsg + fi } setBlue() { - if [ -n "$GPIO_BLUE" ]; then - [ $1 -eq 1 ] && gpio set "$GPIO_BLUE" || gpio clear "$GPIO_BLUE" - else - echo "[INFO] Status Lights: Blue GPIO undefined in /usr/sbin/light" > /dev/kmsg - fi + if [ -n "$GPIO_BLUE" ]; then + [ $1 -eq 1 ] && gpio set "$GPIO_BLUE" || gpio clear "$GPIO_BLUE" + else + echo "[INFO] Status Lights: Blue GPIO undefined in /usr/sbin/light" > /dev/kmsg + fi } if [ -n $1 ]; then - case $1 in + case $1 in + off) + setRed 0 + setGreen 0 + setBlue 0 + ;; - off) - setRed 0 - setGreen 0 - setBlue 0 - ;; + red) + setRed 1 + setGreen 0 + setBlue 0 + ;; - red) - setRed 1 - setGreen 0 - setBlue 0 - ;; + green) + setRed 0 + setGreen 1 + setBlue 0 + ;; - green) - setRed 0 - setGreen 1 - setBlue 0 - ;; + blue) + setRed 0 + setGreen 0 + setBlue 1 + ;; - blue) - setRed 0 - setGreen 0 - setBlue 1 - ;; + yellow) + setRed 1 + setGreen 1 + setBlue 0 + ;; - yellow) - setRed 1 - setGreen 1 - setBlue 0 - ;; + magenta|purple) + setRed 1 + setGreen 0 + setBlue 1 + ;; - magenta|purple) - setRed 1 - setGreen 0 - setBlue 1 - ;; + cyan) + setRed 0 + setGreen 1 + setBlue 1 + ;; - cyan) - setRed 0 - setGreen 1 - setBlue 1 - ;; + white) + setRed 1 + setGreen 1 + setBlue 1 + ;; - white) - setRed 1 - setGreen 1 - setBlue 1 - ;; - - *) - help - ;; - esac + *) + help + ;; + esac else - help + help fi diff --git a/general/overlay/usr/sbin/profiler b/general/overlay/usr/sbin/profiler index 51a6e85a..2273b7ca 100755 --- a/general/overlay/usr/sbin/profiler +++ b/general/overlay/usr/sbin/profiler @@ -5,106 +5,115 @@ manufacturer=$(fw_printenv -n manufacturer) || (>&2 echo "Manufacturer not defin # devid=$(fw_printenv -n devid) || (>&2 echo "Device ID not defined in U-Boot ENV"; exit 1) case ${manufacturer} in - Anjoy) - case ${soc} in - ssc335|ssc337|ssc337de) - gpio="ircut1=78 ircut2=79 light=61" - ;; - esac - ;; - Camhi|Hichip|Xin) - case ${soc} in - hi3516ev200|gk7205v200) - gpio="usb_ena=-9" - ;; - hi3516ev300|gk7205v300) - gpio="ircut1=10 ircut2=11 usb_ena=-7" - ;; - hi3518ev200) - gpio="ircut1=1 ircut2=2 light=48" - ;; - t31) - gpio="ircut1=N ircut2=n light=n" - ;; - esac - ;; - Herospeed|Longsee|Cantonk) - case ${soc} in - hi3516ev200|gk7205v200) - gpio="ircut1=12 ircut2=13 irctl=4 alm_in=15 alm_out=14" - ;; - hi3518ev200) - gpio="ircut1=64 ircut2=65" - ;; - hi3516av300) - gpio="ircut1=5 ircut2=6" - ;; - esac - ;; - Jabsco) - case ${soc} in - hi3516ev200|gk7205v200) - gpio="ircut1=52 ircut2=53 irstatus=9" - ;; - esac - ;; - Jvt) - case ${soc} in - hi3516cv200) - gpio="ircut1=64 ircut2=65 light=62" - ;; - hi3518ev200) - gpio="ircut1=64 ircut2=65 light=47" - ;; - esac - ;; - Juan|Sannce) - case ${soc} in - hi3518ev200) - gpio="ircut1=65 ircut2=64 irstatus=-62" - ;; - esac - ;; - Tiandy) - case ${soc} in - hi3518ev200) - gpio="ircut1=78 ircut2=79 irctl=37" - ;; - esac - ;; - Uniview) - case ${soc} in - hi3516ev300|gk7205v300) - gpio="ircut1=63 ircut2=67 reset=" - ;; - esac - ;; - Xiongmai) - case ${soc} in - hi3516ev200|gk7205v200) - gpio="ircut1=8 ircut=29 irstatus=15 irctl=16 alm_in=4,53 alm_out=55 eth_act=14 eth_sta=12 reset=0" - ;; - hi3516ev300|gk7205v300) - gpio="ircut1=10 ircut2=11 irstatus=66 irctl=52 alm_in=4,67 alm_out=65 eth_act=30 eth_sta=31 reset=0" - ;; - hi3516dv100) - gpio="ircut1=14 ircut2=15" - ;; - hi3516cv300) - gpio="ircut1=53 ircut2=54 irstatus=64 irctl=66 alm_in=55 alm_out=1 reset=2 usb_ena=63" - ;; - hi3518ev200) - gpio="ircut1=33 ircut2=34 alm_in=61 alm_out=35" - ;; - esac - ;; - Zenotech|Videopark) - case ${soc} in - hi3516ev300|gk7205v300) - gpio="ircut1=40 ircut2=41 irctl=65" - ;; - esac - ;; + Anjoy) + case ${soc} in + ssc335|ssc337|ssc337de) + gpio="ircut1=78 ircut2=79 light=61" + ;; + esac + ;; + + Camhi|Hichip|Xin) + case ${soc} in + hi3516ev200|gk7205v200) + gpio="usb_ena=-9" + ;; + hi3516ev300|gk7205v300) + gpio="ircut1=10 ircut2=11 usb_ena=-7" + ;; + hi3518ev200) + gpio="ircut1=1 ircut2=2 light=48" + ;; + t31) + gpio="ircut1=N ircut2=n light=n" + ;; + esac + ;; + + Herospeed|Longsee|Cantonk) + case ${soc} in + hi3516ev200|gk7205v200) + gpio="ircut1=12 ircut2=13 irctl=4 alm_in=15 alm_out=14" + ;; + hi3518ev200) + gpio="ircut1=64 ircut2=65" + ;; + hi3516av300) + gpio="ircut1=5 ircut2=6" + ;; + esac + ;; + + Jabsco) + case ${soc} in + hi3516ev200|gk7205v200) + gpio="ircut1=52 ircut2=53 irstatus=9" + ;; + esac + ;; + + Jvt) + case ${soc} in + hi3516cv200) + gpio="ircut1=64 ircut2=65 light=62" + ;; + hi3518ev200) + gpio="ircut1=64 ircut2=65 light=47" + ;; + esac + ;; + + Juan|Sannce) + case ${soc} in + hi3518ev200) + gpio="ircut1=65 ircut2=64 irstatus=-62" + ;; + esac + ;; + + Tiandy) + case ${soc} in + hi3518ev200) + gpio="ircut1=78 ircut2=79 irctl=37" + ;; + esac + ;; + + Uniview) + case ${soc} in + hi3516ev300|gk7205v300) + gpio="ircut1=63 ircut2=67 reset=" + ;; + esac + ;; + + Xiongmai) + case ${soc} in + hi3516ev200|gk7205v200) + gpio="ircut1=8 ircut=29 irstatus=15 irctl=16 alm_in=4,53 alm_out=55 eth_act=14 eth_sta=12 reset=0" + ;; + hi3516ev300|gk7205v300) + gpio="ircut1=10 ircut2=11 irstatus=66 irctl=52 alm_in=4,67 alm_out=65 eth_act=30 eth_sta=31 reset=0" + ;; + hi3516dv100) + gpio="ircut1=14 ircut2=15" + ;; + hi3516cv300) + gpio="ircut1=53 ircut2=54 irstatus=64 irctl=66 alm_in=55 alm_out=1 reset=2 usb_ena=63" + ;; + hi3518ev200) + gpio="ircut1=33 ircut2=34 alm_in=61 alm_out=35" + ;; + esac + ;; + + Zenotech|Videopark) + case ${soc} in + hi3516ev300|gk7205v300) + gpio="ircut1=40 ircut2=41 irctl=65" + ;; + esac + ;; esac echo ${gpio} diff --git a/general/overlay/usr/sbin/resetd b/general/overlay/usr/sbin/resetd index 8d8c9f48..4f687604 100755 --- a/general/overlay/usr/sbin/resetd +++ b/general/overlay/usr/sbin/resetd @@ -10,24 +10,23 @@ count=0 # prepare the pin if [ ! -d /sys/class/gpio/gpio${GPIO} ]; then - echo "${GPIO}" > /sys/class/gpio/export - echo "in" > /sys/class/gpio/gpio"${GPIO}"/direction + echo "${GPIO}" > /sys/class/gpio/export + echo "in" > /sys/class/gpio/gpio"${GPIO}"/direction fi # continuously monitor current value of reset switch -while [ true ] -do - if [ "$(cat /sys/class/gpio/gpio"${GPIO}"/value)" -eq 1 ]; then - count=0 - else - count=$((count+1)) +while [ true ]; do + if [ "$(cat /sys/class/gpio/gpio"${GPIO}"/value)" -eq 1 ]; then + count=0 + else + count=$((count+1)) - # 20 counts =~ 5 seconds @ 0.25 sleep intervals - if [ $count -eq 20 ]; then - echo 'RESETTING FIRMWARE' - firstboot - fi - fi - # This interval uses 1% CPU. Less sleep = more CPU - sleep 0.25 + # 20 counts =~ 5 seconds @ 0.25 sleep intervals + if [ $count -eq 20 ]; then + echo 'RESETTING FIRMWARE' + firstboot + fi + fi + # This interval uses 1% CPU. Less sleep = more CPU + sleep 0.25 done diff --git a/general/overlay/usr/sbin/sysreset.sh b/general/overlay/usr/sbin/sysreset.sh index 0febaeb1..9d201f7e 100755 --- a/general/overlay/usr/sbin/sysreset.sh +++ b/general/overlay/usr/sbin/sysreset.sh @@ -1,28 +1,28 @@ #!/bin/sh show_help() { - echo "Usage: $0 [OPTIONS] + echo "Usage: $0 [OPTIONS] -m Reset Majestic config. -n Reset network config. -h Show this help. " - exit 0 + exit 0 } reset_majestic() { - cp -f /rom/etc/majestic.yaml /etc/majestic.yaml + cp -f /rom/etc/majestic.yaml /etc/majestic.yaml } reset_network() { - cp -f /rom/etc/network/interfaces /etc/network/interfaces + cp -f /rom/etc/network/interfaces /etc/network/interfaces } while getopts hmn flag; do - case ${flag} in - m) reset_majestic ;; - n) reset_network ;; - h) show_help ;; - esac + case ${flag} in + m) reset_majestic ;; + n) reset_network ;; + h) show_help ;; + esac done exit 0 diff --git a/general/overlay/usr/sbin/sysupgrade b/general/overlay/usr/sbin/sysupgrade index c0fe9043..97ce1ecd 100755 --- a/general/overlay/usr/sbin/sysupgrade +++ b/general/overlay/usr/sbin/sysupgrade @@ -47,9 +47,9 @@ do_update_kernel() { local ksoc=$(od -j 32 -N 32 -S 1 -A n "$x" | cut -d- -f3) # FIXME: Ingenic kernels do not include proper SoC identifiers. case "$soc" in - t31) [ "t" != "$ksoc" ] && die "Wrong SoC!" ;; - t21) [ "" != "$ksoc" ] && die "Wrong SoC!" ;; - *) check_soc "$ksoc" + t31) [ "t" != "$ksoc" ] && die "Wrong SoC!" ;; + t21) [ "" != "$ksoc" ] && die "Wrong SoC!" ;; + *) check_soc "$ksoc" esac compare_versions "$kernel_version" "$(get_kernel_version "$x")" && return 0 fi @@ -263,69 +263,84 @@ for i in "$@"; do skip_ver=1 shift ;; + --force_md5) skip_md5=1 shift ;; + --force_soc) skip_soc=1 shift ;; + --force_ver) skip_ver=1 shift ;; + -d) branch_dev=1 shift ;; + -h | --help) print_sysinfo print_usage exit 0 ;; + -k) update_kernel=1 remote_update=1 shift ;; + --kernel=*) update_kernel=1 kernel_file="${i#*=}" [ "$kernel_file" != ${kernel_file#/mnt/mmc} ] && skip_unmount=1 shift ;; + -n | --wipe_overlay) clear_overlay=1 shift ;; + -r) update_rootfs=1 remote_update=1 shift ;; + --rootfs=*) update_rootfs=1 rootfs_file="${i#*=}" [ "$rootfs_file" != ${rootfs_file#/mnt/mmc} ] && skip_unmount=1 shift ;; + --url=*) url="${i#*=}" shift ;; - -x | --no_reboot) - skip_reboot=1 - shift - ;; + -w) update_webui=1 shift ;; + + -x | --no_reboot) + skip_reboot=1 + shift + ;; + -z | --no_update) skip_selfupdate=1 shift ;; + *) print_sysinfo echo_c 37 "\nUnknown option: $1" diff --git a/general/overlay/usr/share/udhcpc/default.script b/general/overlay/usr/share/udhcpc/default.script index fa4872dc..2127b61f 100755 --- a/general/overlay/usr/share/udhcpc/default.script +++ b/general/overlay/usr/share/udhcpc/default.script @@ -17,9 +17,7 @@ RESOLV_CONF="/tmp/resolv.conf" # Handle stateful DHCPv6 like DHCPv4 [ -n "$ipv6" ] && ip="$ipv6/128" -if [ -z "${IF_WAIT_DELAY}" ]; then - IF_WAIT_DELAY=10 -fi +[ -z "${IF_WAIT_DELAY}" ] && IF_WAIT_DELAY=10 wait_for_ipv6_default_route() { printf "Waiting for IPv6 default route to appear" diff --git a/general/package/hisilicon-osdrv-hi3516cv100/files/script/load_hisilicon b/general/package/hisilicon-osdrv-hi3516cv100/files/script/load_hisilicon index bc71139e..716c3059 100755 --- a/general/package/hisilicon-osdrv-hi3516cv100/files/script/load_hisilicon +++ b/general/package/hisilicon-osdrv-hi3516cv100/files/script/load_hisilicon @@ -17,401 +17,401 @@ os_mem_size=${os_mem_size:=32} # SENSOR=${SENSOR:=ar0130} report_error() { - echo "******* Error: There's something wrong, please check! *****" - exit 1 + echo "******* Error: There's something wrong, please check! *****" + exit 1 } insert_osal() { - insmod mmz.ko mmz=anonymous,0,$mmz_start,$mmz_size anony=1 || report_error + insmod mmz.ko mmz=anonymous,0,$mmz_start,$mmz_size anony=1 || report_error } insert_detect() { - cd /lib/modules/3.0.8/hisilicon - sys_config - insert_osal - insmod hi3518_base.ko - insmod hi3518_sys.ko - insmod hi3518_isp.ko - insmod hi_i2c.ko - SENSOR=imx122 insert_sns + cd /lib/modules/3.0.8/hisilicon + sys_config + insert_osal + insmod hi3518_base.ko + insmod hi3518_sys.ko + insmod hi3518_isp.ko + insmod hi_i2c.ko + SENSOR=imx122 insert_sns } remove_detect() { - rmmod -w ssp_sony &>/dev/null - rmmod -w ssp_pana &>/dev/null - rmmod -w ssp_ad9020 &>/dev/null - rmmod -w hi_i2c - rmmod -w hi3518_isp - rmmod -w hi3518_sys - rmmod -w hi3518_base - rmmod -w mmz + rmmod -w ssp_sony &>/dev/null + rmmod -w ssp_pana &>/dev/null + rmmod -w ssp_ad9020 &>/dev/null + rmmod -w hi_i2c + rmmod -w hi3518_isp + rmmod -w hi3518_sys + rmmod -w hi3518_base + rmmod -w mmz } insert_audio() { - insmod acodec.ko - insmod hidmac.ko - insmod hi3518_sio.ko - insmod hi3518_ai.ko - insmod hi3518_ao.ko - insmod hi3518_aenc.ko - insmod hi3518_adec.ko - echo "insert audio" + insmod acodec.ko + insmod hidmac.ko + insmod hi3518_sio.ko + insmod hi3518_ai.ko + insmod hi3518_ao.ko + insmod hi3518_aenc.ko + insmod hi3518_adec.ko + echo "insert audio" } remove_audio() { - rmmod -w hi3518_adec - rmmod -w hi3518_aenc - rmmod -w hi3518_ao - rmmod -w hi3518_ai - rmmod -w hi3518_sio - rmmod -w acodec - rmmod -w hidmac - echo "remove audio" + rmmod -w hi3518_adec + rmmod -w hi3518_aenc + rmmod -w hi3518_ao + rmmod -w hi3518_ai + rmmod -w hi3518_sio + rmmod -w acodec + rmmod -w hidmac + echo "remove audio" } insert_sns() { - case $SENSOR in - ar0130 | 9m034 | po3100k | bf3116 | bg0703) - devmem 0x20030030 32 0x5 #Sensor clock 27 MHz - insmod ssp_ad9020.ko - ;; - icx692) - devmem 0x200f000c 32 32 0x1 #pinmux SPI0 - devmem 0x200f0010 32 32 0x1 #pinmux SPI0 - devmem 0x200f0014 32 0x1 #pinmux SPI0 - insmod ssp_ad9020.ko - ;; - mn34031 | mn34041) - devmem 0x200f000c 32 0x1 #pinmux SPI0 - devmem 0x200f0010 32 0x1 #pinmux SPI0 - devmem 0x200f0014 32 0x1 #pinmux SPI0 - devmem 0x20030030 32 0x5 #Sensor clock 27MHz - insmod ssp_pana.ko - ;; - imx104 | imx123 | imx138_spi | imx222 | imx225 | imx322 | imx323) - devmem 0x200f000c 32 0x1 #pinmux SPI0 - devmem 0x200f0010 32 0x1 #pinmux SPI0 - devmem 0x200f0014 32 0x1 #pinmux SPI0 - devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz - insmod ssp_sony.ko - ;; - imx122) - devmem 0x200f000c 32 0x1 #pinmux SPI0 - devmem 0x200f0010 32 0x1 #pinmux SPI0 - devmem 0x200f0014 32 0x1 #pinmux SPI0 - devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz - devmem 0x200f0124 8 0x0 - devmem 0x20140400 8 0x2 - devmem 0x201403fc 8 0x2 - insmod ssp_sony.ko - ;; - imx138_i2c) - devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz - ;; - ov9712 | ov9732 | soih22 | ov2710 | jxh22 | jxh42) - devmem 0x20030030 32 0x1 #Sensor clock 24 MHz - insmod ssp_ad9020.ko - ;; - ar0140 | ar0141) - devmem 0x20030030 32 0x1 - ;; #Sensor clock 24 MHz - mt9p006) - devmem 0x20030030 32 0x1 #Sensor clock 24 MHz - devmem 0x2003002c 32 0x6a #VI input associated clock phase reversed - devmem 0x200f0138 32 0 # pinmux [GPIO0_6] SVB_PWM TEMPER_DQ - devmem 0x20140400 32 0x60 # set GPIO 0_6 direction OUTPUT - devmem 0x201403FC 32 0xff # set GPIO 0_6 0 - insmod ssp_ad9020.ko - ;; - hm1375 | ar0330) - devmem 0x20030030 32 0x1 - ;; #Sensor clock 24 MHz - imx236) - devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz - ;; - sc1035 | sc1135 | sc2135) - devmem 0x20030030 32 0x5 #Sensor clock 27 MHz - insmod ssp_ad9020.ko - ;; - *) - echo "xxxx Invalid sensor type $SENSOR xxxx" - report_error - ;; - esac + case $SENSOR in + ar0130 | 9m034 | po3100k | bf3116 | bg0703) + devmem 0x20030030 32 0x5 #Sensor clock 27 MHz + insmod ssp_ad9020.ko + ;; + icx692) + devmem 0x200f000c 32 32 0x1 #pinmux SPI0 + devmem 0x200f0010 32 32 0x1 #pinmux SPI0 + devmem 0x200f0014 32 0x1 #pinmux SPI0 + insmod ssp_ad9020.ko + ;; + mn34031 | mn34041) + devmem 0x200f000c 32 0x1 #pinmux SPI0 + devmem 0x200f0010 32 0x1 #pinmux SPI0 + devmem 0x200f0014 32 0x1 #pinmux SPI0 + devmem 0x20030030 32 0x5 #Sensor clock 27MHz + insmod ssp_pana.ko + ;; + imx104 | imx123 | imx138_spi | imx222 | imx225 | imx322 | imx323) + devmem 0x200f000c 32 0x1 #pinmux SPI0 + devmem 0x200f0010 32 0x1 #pinmux SPI0 + devmem 0x200f0014 32 0x1 #pinmux SPI0 + devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz + insmod ssp_sony.ko + ;; + imx122) + devmem 0x200f000c 32 0x1 #pinmux SPI0 + devmem 0x200f0010 32 0x1 #pinmux SPI0 + devmem 0x200f0014 32 0x1 #pinmux SPI0 + devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz + devmem 0x200f0124 8 0x0 + devmem 0x20140400 8 0x2 + devmem 0x201403fc 8 0x2 + insmod ssp_sony.ko + ;; + imx138_i2c) + devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz + ;; + ov9712 | ov9732 | soih22 | ov2710 | jxh22 | jxh42) + devmem 0x20030030 32 0x1 #Sensor clock 24 MHz + insmod ssp_ad9020.ko + ;; + ar0140 | ar0141) + devmem 0x20030030 32 0x1 + ;; #Sensor clock 24 MHz + mt9p006) + devmem 0x20030030 32 0x1 #Sensor clock 24 MHz + devmem 0x2003002c 32 0x6a #VI input associated clock phase reversed + devmem 0x200f0138 32 0 # pinmux [GPIO0_6] SVB_PWM TEMPER_DQ + devmem 0x20140400 32 0x60 # set GPIO 0_6 direction OUTPUT + devmem 0x201403FC 32 0xff # set GPIO 0_6 0 + insmod ssp_ad9020.ko + ;; + hm1375 | ar0330) + devmem 0x20030030 32 0x1 + ;; #Sensor clock 24 MHz + imx236) + devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz + ;; + sc1035 | sc1135 | sc2135) + devmem 0x20030030 32 0x5 #Sensor clock 27 MHz + insmod ssp_ad9020.ko + ;; + *) + echo "xxxx Invalid sensor type $SENSOR xxxx" + report_error + ;; + esac } remove_sns() { - rmmod -w hi_i2c &>/dev/null - rmmod -w ssp &>/dev/null - rmmod -w ssp_sony &>/dev/null - rmmod -w ssp_pana &>/dev/null - rmmod -w ssp_ad9020 &>/dev/null + rmmod -w hi_i2c &>/dev/null + rmmod -w ssp &>/dev/null + rmmod -w ssp_sony &>/dev/null + rmmod -w ssp_pana &>/dev/null + rmmod -w ssp_ad9020 &>/dev/null } sys_config() { - # lowpower.sh - devmem 0x20050080 32 0x000121a8 - #USB PHY - devmem 0x20050084 32 0x005d2188 - #NANDC - devmem 0x200300D0 32 0x5 - devmem 0x200f00c8 32 0x1 - devmem 0x200f00cc 32 0x1 - devmem 0x200f00d0 32 0x1 - devmem 0x200f00d4 32 0x1 - devmem 0x200f00d8 32 0x1 - devmem 0x200f00dc 32 0x1 - devmem 0x200f00e0 32 0x1 - devmem 0x200f00e4 32 0x1 - devmem 0x200f00e8 32 0x1 - devmem 0x200f00ec 32 0x1 - devmem 0x200f00f4 32 0x1 - devmem 0x200f00f8 32 0x1 - #SAR ADC - devmem 0x20030080 32 0x1 - devmem 0x200b0008 32 0x1 - #PWM - devmem 0x20030038 32 0x2 - #IR - devmem 0x20070000 32 0x0 - devmem 0x200f00c4 32 0x1 - #UART2 - devmem 0x200A0030 32 0x0 - #UART2 - devmem 0x200f0108 32 0x0 - devmem 0x200f010c 32 0x0 - #SPI0 SPI1 - devmem 0x200C0004 32 0x7F00 - devmem 0x200E0004 32 0x7F00 - #spi0 - devmem 0x200f000c 32 0x0 - devmem 0x200f0010 32 0x0 - devmem 0x200f0014 32 0x0 - #spi1 - devmem 0x200f0110 32 0x0 - devmem 0x200f0114 32 0x0 - devmem 0x200f0118 32 0x0 - devmem 0x200f011c 32 0x0 - #AUDIO CODEC LINE IN - #devmem 0x20050068 32 0xa8022c2c - #devmem 0x2005006c 32 0xf5035a4a + # lowpower.sh + devmem 0x20050080 32 0x000121a8 + #USB PHY + devmem 0x20050084 32 0x005d2188 + #NANDC + devmem 0x200300D0 32 0x5 + devmem 0x200f00c8 32 0x1 + devmem 0x200f00cc 32 0x1 + devmem 0x200f00d0 32 0x1 + devmem 0x200f00d4 32 0x1 + devmem 0x200f00d8 32 0x1 + devmem 0x200f00dc 32 0x1 + devmem 0x200f00e0 32 0x1 + devmem 0x200f00e4 32 0x1 + devmem 0x200f00e8 32 0x1 + devmem 0x200f00ec 32 0x1 + devmem 0x200f00f4 32 0x1 + devmem 0x200f00f8 32 0x1 + #SAR ADC + devmem 0x20030080 32 0x1 + devmem 0x200b0008 32 0x1 + #PWM + devmem 0x20030038 32 0x2 + #IR + devmem 0x20070000 32 0x0 + devmem 0x200f00c4 32 0x1 + #UART2 + devmem 0x200A0030 32 0x0 + #UART2 + devmem 0x200f0108 32 0x0 + devmem 0x200f010c 32 0x0 + #SPI0 SPI1 + devmem 0x200C0004 32 0x7F00 + devmem 0x200E0004 32 0x7F00 + #spi0 + devmem 0x200f000c 32 0x0 + devmem 0x200f0010 32 0x0 + devmem 0x200f0014 32 0x0 + #spi1 + devmem 0x200f0110 32 0x0 + devmem 0x200f0114 32 0x0 + devmem 0x200f0118 32 0x0 + devmem 0x200f011c 32 0x0 + #AUDIO CODEC LINE IN + #devmem 0x20050068 32 0xa8022c2c + #devmem 0x2005006c 32 0xf5035a4a - # PINMUX - devmem 0x200f0008 32 0x00000001 # 0:GPIO1_2 /1:SENSOR_CLK - #I2C default setting is I2C - i2c_type_select() { - devmem 0x200f0018 32 0x00000001 # 0:GPIO2_0 / 1:I2C_SDA - devmem 0x200f001c 32 0x00000001 # 0:GPIO2_1 / 1:I2C_SCL - } + # PINMUX + devmem 0x200f0008 32 0x00000001 # 0:GPIO1_2 /1:SENSOR_CLK + #I2C default setting is I2C + i2c_type_select() { + devmem 0x200f0018 32 0x00000001 # 0:GPIO2_0 / 1:I2C_SDA + devmem 0x200f001c 32 0x00000001 # 0:GPIO2_1 / 1:I2C_SCL + } - #I2C default setting is I2C - gpio_i2c_type_select() { - devmem 0x200f0018 32 0x00000000 # 0:GPIO2_0 / 1:I2C_SDA - devmem 0x200f001c 32 0x00000000 # 0:GPIO2_1 / 1:I2C_SCL - } + #I2C default setting is I2C + gpio_i2c_type_select() { + devmem 0x200f0018 32 0x00000000 # 0:GPIO2_0 / 1:I2C_SDA + devmem 0x200f001c 32 0x00000000 # 0:GPIO2_1 / 1:I2C_SCL + } - #MII - net_mii_mode() { - devmem 0x200f0030 32 0x1 - devmem 0x200f0034 32 0x1 - devmem 0x200f0038 32 0x1 - devmem 0x200f003C 32 0x1 - devmem 0x200f0040 32 0x1 - devmem 0x200f0044 32 0x1 - devmem 0x200f0048 32 0x1 - devmem 0x200f004C 32 0x1 - devmem 0x200f0050 32 0x1 - devmem 0x200f0054 32 0x1 - devmem 0x200f0058 32 0x1 - devmem 0x200f005C 32 0x1 - devmem 0x200f0060 32 0x1 - devmem 0x200f0064 32 0x1 - devmem 0x200f0068 32 0x1 - devmem 0x200f006C 32 0x1 - #devmem 0x200f0070 32 0x1 - devmem 0x200f0074 32 0x1 - devmem 0x200f0078 32 0x1 - } + #MII + net_mii_mode() { + devmem 0x200f0030 32 0x1 + devmem 0x200f0034 32 0x1 + devmem 0x200f0038 32 0x1 + devmem 0x200f003C 32 0x1 + devmem 0x200f0040 32 0x1 + devmem 0x200f0044 32 0x1 + devmem 0x200f0048 32 0x1 + devmem 0x200f004C 32 0x1 + devmem 0x200f0050 32 0x1 + devmem 0x200f0054 32 0x1 + devmem 0x200f0058 32 0x1 + devmem 0x200f005C 32 0x1 + devmem 0x200f0060 32 0x1 + devmem 0x200f0064 32 0x1 + devmem 0x200f0068 32 0x1 + devmem 0x200f006C 32 0x1 + #devmem 0x200f0070 32 0x1 + devmem 0x200f0074 32 0x1 + devmem 0x200f0078 32 0x1 + } - #RMII - net_rmii_mode() { - devmem 0x200f0030 32 0x1 - devmem 0x200f0034 32 0x1 - devmem 0x200f0038 32 0x1 - #devmem 0x200f003C 32 0x1 - #devmem 0x200f0040 32 0x1 - devmem 0x200f0044 32 0x1 - devmem 0x200f0048 32 0x1 - devmem 0x200f004C 32 0x1 - devmem 0x200f0050 32 0x1 - devmem 0x200f0054 32 0x1 - devmem 0x200f0058 32 0x1 - devmem 0x200f005C 32 0x3 - devmem 0x200f0060 32 0x1 - devmem 0x200f0064 32 0x1 - devmem 0x200f0068 32 0x1 #MII_TXER 0x1,GPIO2_6 0x0 - devmem 0x200f006C 32 0x1 #MII_RXER 0x1,GPIO2_7 0x0 - #devmem 0x200f0070 32 0x1 - devmem 0x200f0074 32 0x1 - devmem 0x200f0078 32 0x1 - } + #RMII + net_rmii_mode() { + devmem 0x200f0030 32 0x1 + devmem 0x200f0034 32 0x1 + devmem 0x200f0038 32 0x1 + #devmem 0x200f003C 32 0x1 + #devmem 0x200f0040 32 0x1 + devmem 0x200f0044 32 0x1 + devmem 0x200f0048 32 0x1 + devmem 0x200f004C 32 0x1 + devmem 0x200f0050 32 0x1 + devmem 0x200f0054 32 0x1 + devmem 0x200f0058 32 0x1 + devmem 0x200f005C 32 0x3 + devmem 0x200f0060 32 0x1 + devmem 0x200f0064 32 0x1 + devmem 0x200f0068 32 0x1 #MII_TXER 0x1,GPIO2_6 0x0 + devmem 0x200f006C 32 0x1 #MII_RXER 0x1,GPIO2_7 0x0 + #devmem 0x200f0070 32 0x1 + devmem 0x200f0074 32 0x1 + devmem 0x200f0078 32 0x1 + } - clk_cfg() { - devmem 0x2003002c 32 0x2a # VICAP, ISP unreset & clock enable - devmem 0x20030048 32 0x2 # VPSS unreset, code also config - devmem 0x20030034 32 0x510 # VDP unreset & HD clock enable # XM: 0x00000043 - devmem 0x20030040 32 0x2 # VEDU unreset - devmem 0x20030060 32 0x2 # JPEG unreset - devmem 0x20030058 32 0x2 # TDE unreset - devmem 0x20030068 32 0x2 # MDU unreset + clk_cfg() { + devmem 0x2003002c 32 0x2a # VICAP, ISP unreset & clock enable + devmem 0x20030048 32 0x2 # VPSS unreset, code also config + devmem 0x20030034 32 0x510 # VDP unreset & HD clock enable # XM: 0x00000043 + devmem 0x20030040 32 0x2 # VEDU unreset + devmem 0x20030060 32 0x2 # JPEG unreset + devmem 0x20030058 32 0x2 # TDE unreset + devmem 0x20030068 32 0x2 # MDU unreset - #devmem 0x2003006c 32 0x2; # IVE unreset - #devmem 0x2003008c 32 0x2; # SIO unreset and clock enable,m/f/bclk config in code. - #devmem 0x20050068 32 0x58000000 # Audio Codec channel config for power down. - } - sysctl() { - devmem 0x20110150 32 0x03ff6 #DMA1 DMA2 - devmem 0x20110154 32 0x03ff6 #ETH - devmem 0x20110158 32 0x03ff6 #USB - devmem 0x2011015C 32 0x03ff6 #CIPHER 0x15C - devmem 0x20110160 32 0x03ff6 #SDIO 0X160 - devmem 0x20110164 32 0x03ff6 #NAND SFC 0X164 - devmem 0x20110168 32 0x10201 #ARMD 0X168 - devmem 0x2011016C 32 0x10201 #ARMI 0X16C - devmem 0x20110170 32 0x03ff6 #IVE 0X170 - devmem 0x20110174 32 0x03ff6 #MD, DDR_TEST 0x174 - devmem 0x20110178 32 0x03ff6 #JPGE #0x178 - devmem 0x2011017C 32 0x03ff3 #TDE0 0X17C - devmem 0x20110180 32 0x03ff4 #VPSS 0X180 - devmem 0x20110184 32 0x10c82 #VENC 0X184 - devmem 0x20110188 32 0x10101 #VICAP FPGA - #devmem 0x20110188 32 0x10640 #VICAP ESL - devmem 0x2011018c 32 0x10100 #VDP - devmem 0x20110100 32 0x67 #mddrc order enable mddrc idmap mode select - #devmem 0x20050054 32 0x123564 #[2:0] VENC [6:4] VPSS [10:8] TDE [14:12] JPGE [18:16] MD - devmem 0x20050038 32 0x3 #DDR0 VICAP VDP - } - i2c_type_select - #net_rmii_mode - #net_mii_mode - clk_cfg + #devmem 0x2003006c 32 0x2 # IVE unreset + #devmem 0x2003008c 32 0x2 # SIO unreset and clock enable,m/f/bclk config in code. + #devmem 0x20050068 32 0x58000000 # Audio Codec channel config for power down. + } + sysctl() { + devmem 0x20110150 32 0x03ff6 #DMA1 DMA2 + devmem 0x20110154 32 0x03ff6 #ETH + devmem 0x20110158 32 0x03ff6 #USB + devmem 0x2011015C 32 0x03ff6 #CIPHER 0x15C + devmem 0x20110160 32 0x03ff6 #SDIO 0X160 + devmem 0x20110164 32 0x03ff6 #NAND SFC 0X164 + devmem 0x20110168 32 0x10201 #ARMD 0X168 + devmem 0x2011016C 32 0x10201 #ARMI 0X16C + devmem 0x20110170 32 0x03ff6 #IVE 0X170 + devmem 0x20110174 32 0x03ff6 #MD, DDR_TEST 0x174 + devmem 0x20110178 32 0x03ff6 #JPGE #0x178 + devmem 0x2011017C 32 0x03ff3 #TDE0 0X17C + devmem 0x20110180 32 0x03ff4 #VPSS 0X180 + devmem 0x20110184 32 0x10c82 #VENC 0X184 + devmem 0x20110188 32 0x10101 #VICAP FPGA + #devmem 0x20110188 32 0x10640 #VICAP ESL + devmem 0x2011018c 32 0x10100 #VDP + devmem 0x20110100 32 0x67 #mddrc order enable mddrc idmap mode select + #devmem 0x20050054 32 0x123564 #[2:0] VENC [6:4] VPSS [10:8] TDE [14:12] JPGE [18:16] MD + devmem 0x20050038 32 0x3 #DDR0 VICAP VDP + } + i2c_type_select + #net_rmii_mode + #net_mii_mode + clk_cfg } insert_ko() { - cd /lib/modules/3.0.8/hisilicon + cd /lib/modules/3.0.8/hisilicon - sys_config + sys_config - insert_osal + insert_osal - insmod hi3518_base.ko - insmod hi3518_sys.ko - insmod hiuser.ko + insmod hi3518_base.ko + insmod hi3518_sys.ko + insmod hiuser.ko - insmod hi3518_tde.ko - insmod hi3518_dsu.ko + insmod hi3518_tde.ko + insmod hi3518_dsu.ko - insmod hi3518_viu.ko - insmod hi3518_isp.ko - insmod hi3518_vpss.ko - # insmod hi3518_vou.ko - # insmod hi3518_vou.ko detectCycle=0 #close dac detect - # insmod hifb.ko video="hifb:vram0_size:1620" + insmod hi3518_viu.ko + insmod hi3518_isp.ko + insmod hi3518_vpss.ko + # insmod hi3518_vou.ko + # insmod hi3518_vou.ko detectCycle=0 #close dac detect + # insmod hifb.ko video="hifb:vram0_size:1620" - insmod hi3518_venc.ko - insmod hi3518_group.ko - insmod hi3518_chnl.ko - insmod hi3518_h264e.ko - insmod hi3518_jpege.ko - insmod hi3518_rc.ko - insmod hi3518_region.ko + insmod hi3518_venc.ko + insmod hi3518_group.ko + insmod hi3518_chnl.ko + insmod hi3518_h264e.ko + insmod hi3518_jpege.ko + insmod hi3518_rc.ko + insmod hi3518_region.ko - # insmod hi3518_vda.ko - insmod hi3518_ive.ko + # insmod hi3518_vda.ko + insmod hi3518_ive.ko - insmod hi_i2c.ko - #insmod gpioi2c.ko - #insmod gpioi2c_ex.ko - insmod pwm.ko - #insmod sil9024.ko norm=5 #720P@60fps + insmod hi_i2c.ko + #insmod gpioi2c.ko + #insmod gpioi2c_ex.ko + insmod pwm.ko + #insmod sil9024.ko norm=5 #720P@60fps - insert_sns >/dev/null + insert_sns >/dev/null - insert_audio - echo "==== Your input Sensor type is $SENSOR ====" + insert_audio + echo "==== Your input Sensor type is $SENSOR ====" - insmod wdt.ko #nodeamon=1 + insmod wdt.ko #nodeamon=1 - # system configuration - sysctl + # system configuration + sysctl } remove_ko() { - rmmod -w wdt - remove_audio - remove_sns + rmmod -w wdt + remove_audio + remove_sns - # rmmod -w sil9024 &> /dev/null - rmmod -w hi_i2c.ko &>/dev/null - rmmod -w pwm - #rmmod -w gpioi2c + # rmmod -w sil9024 &> /dev/null + rmmod -w hi_i2c.ko &>/dev/null + rmmod -w pwm + #rmmod -w gpioi2c - rmmod -w hi3518_ive - # rmmod -w hi3518_vda + rmmod -w hi3518_ive + # rmmod -w hi3518_vda - rmmod -w hi3518_region - rmmod -w hi3518_rc - rmmod -w hi3518_jpege - rmmod -w hi3518_h264e - rmmod -w hi3518_chnl - rmmod -w hi3518_group - rmmod -w hi3518_venc + rmmod -w hi3518_region + rmmod -w hi3518_rc + rmmod -w hi3518_jpege + rmmod -w hi3518_h264e + rmmod -w hi3518_chnl + rmmod -w hi3518_group + rmmod -w hi3518_venc - # rmmod -w hifb - # rmmod -w hi3518_vou - rmmod -w hi3518_vpss - rmmod -w hi3518_isp - rmmod -w hi3518_viu + # rmmod -w hifb + # rmmod -w hi3518_vou + rmmod -w hi3518_vpss + rmmod -w hi3518_isp + rmmod -w hi3518_viu - rmmod -w hi3518_dsu - rmmod -w hi3518_tde + rmmod -w hi3518_dsu + rmmod -w hi3518_tde - rmmod -w hiuser - rmmod -w hi3518_sys - rmmod -w hi3518_base - rmmod -w mmz + rmmod -w hiuser + rmmod -w hi3518_sys + rmmod -w hi3518_base + rmmod -w mmz } load_usage() { - echo "Usage: ./load3518 [-option] [sensor_name]" - echo "options:" - echo " -i sensor_name insert modules" - echo " -r remove modules" - echo " -a sensor_name remove modules first, then insert modules" - echo " -h help information" - echo -e "Available sensors: ar0130, imx104, icx692, ov9715, 9m034, imx122, mt9p006" - echo -e "for example: ./load3518 -a ar0130 \n" + echo "Usage: ./load3518 [-option] [sensor_name]" + echo "options:" + echo " -i sensor_name insert modules" + echo " -r remove modules" + echo " -a sensor_name remove modules first, then insert modules" + echo " -h help information" + echo -e "Available sensors: ar0130, imx104, icx692, ov9715, 9m034, imx122, mt9p006" + echo -e "for example: ./load3518 -a ar0130 \n" } calc_mmz_info() { - mmz_start=$(echo "$mem_start $os_mem_size" | - awk 'BEGIN { temp = 0; } + mmz_start=$(echo "$mem_start $os_mem_size" | + awk 'BEGIN { temp = 0; } { temp = $1/1024/1024 + $2; - } + } END { printf("0x%x00000\n", temp); }') - mmz_size=$(echo "$mem_total $os_mem_size" | - awk 'BEGIN { temp = 0; } + mmz_size=$(echo "$mem_total $os_mem_size" | + awk 'BEGIN { temp = 0; } { temp = $1 - $2; - } + } END { printf("%dM\n", temp); }') - echo "mmz_start: $mmz_start, mmz_size: $mmz_size" + echo "mmz_start: $mmz_start, mmz_size: $mmz_size" } if [ $os_mem_size -ge $mem_total ]; then - echo "[err] os_mem[$os_mem_size], over total_mem[$mem_total]" - exit + echo "[err] os_mem[$os_mem_size], over total_mem[$mem_total]" + exit fi calc_mmz_info @@ -420,42 +420,42 @@ calc_mmz_info # SENSOR=${SENSOR:=imx307} # if [ -n "$SENSOR" ]; then - logger -s -p daemon.info -t hisilicon "Manualy set SENSOR as ${SENSOR}" + logger -s -p daemon.info -t hisilicon "Manualy set SENSOR as ${SENSOR}" else - if fw_printenv -n sensor >/dev/null; then - SENSOR_ENV=$(fw_printenv -n sensor) - export SENSOR=${SENSOR_ENV} - logger -s -p daemon.info -t hisilicon "Get data from environment and set SENSOR as ${SENSOR}" - else - insert_detect - SENSOR_DETECT=$(ipcinfo --short-sensor) - export SENSOR=${SENSOR_DETECT:=unknown} - remove_detect - logger -s -p daemon.info -t hisilicon "Get data from ipcinfo and set SENSOR as ${SENSOR}" - fw_setenv sensor $SENSOR && logger -s -p daemon.info -t hisilicon "Write detected ${SENSOR} to U-Boot ENV" - fi + if fw_printenv -n sensor >/dev/null; then + SENSOR_ENV=$(fw_printenv -n sensor) + export SENSOR=${SENSOR_ENV} + logger -s -p daemon.info -t hisilicon "Get data from environment and set SENSOR as ${SENSOR}" + else + insert_detect + SENSOR_DETECT=$(ipcinfo --short-sensor) + export SENSOR=${SENSOR_DETECT:=unknown} + remove_detect + logger -s -p daemon.info -t hisilicon "Get data from ipcinfo and set SENSOR as ${SENSOR}" + fw_setenv sensor $SENSOR && logger -s -p daemon.info -t hisilicon "Write detected ${SENSOR} to U-Boot ENV" + fi fi # load module if [ "$SENSOR" = "unknown" ]; then - exit 1 + exit 1 else - if [ "$1" = "-i" ]; then - cd /lib/modules/3.0.8/hisilicon - insert_ko - fi + if [ "$1" = "-i" ]; then + cd /lib/modules/3.0.8/hisilicon + insert_ko + fi fi if [ "$1" = "-r" ]; then - remove_ko + remove_ko fi if [ "$1" = "-h" ]; then - load_usage - exit + load_usage + exit fi if [ $# -eq 0 ] || [ "$1" = "-a" ]; then - remove_ko - insert_ko + remove_ko + insert_ko fi diff --git a/general/package/ingenic-osdrv-t20/files/script/load_ingenic b/general/package/ingenic-osdrv-t20/files/script/load_ingenic index 0282b36e..900a0ca3 100755 --- a/general/package/ingenic-osdrv-t20/files/script/load_ingenic +++ b/general/package/ingenic-osdrv-t20/files/script/load_ingenic @@ -11,7 +11,7 @@ fi echo 1 >/proc/sys/vm/overcommit_memory log_vendor() { - logger -s -p daemon.info -t ${vendor} "$1" + logger -s -p daemon.info -t ${vendor} "$1" } check_return() {