 #!/bin/sh

export LD_LIBRARY_PATH=/tmp/lib:$LD_LIBRARY_PATH:

cd /tmp/

chmod 777 web/images/*
chmod 777 web/css/*
chmod 777 web/js/*
chmod 777 web/*
chmod 777 ko/extdrv/*
chmod 777 ko/*
chmod 777 lib/*
chmod 777 *
chmod 777 nginx/sbin/*

cd /tmp/ko
./load3520D

#I2C GPIO1_6 GPIO1_7
himm 0x200F0044 0
himm 0x200F0048 0
#GPIO1 DIR
himm 0x20160400 0xc0

#GPIO7_1 IT6604_HPD
#GPIO7_2 IT6604_RESET
#GPIO7_3 AUDIO_CTRL
himm 0x200F0018 1
himm 0x200F001C 1
himm 0x200F0020 1
#GPIO7 DIR
himm 0x201C0400 0xE

#GPIO7_1 IT6604_HPD ENABLE 
himm 0x201C0008 0
#himm 0x201C0008 2

#GPIO7_2 IT6604_RESET LOW
himm 0x201C0010 0

#GPIO7_3 AUDIO_CTRL
himm 0x201C0020 8

#VIU
himm 0x200F0004 0
himm 0x200F0008 0

#GOIO8_0 CONIFG_RESET
himm 0x200F0030 0
#GOIO8_0 DIR
himm 0x201D0400 0

telnetd&
cp /tmp/passwd /etc/passwd


#GPIO7_2 IT6604_RESET HIGH
himm 0x201C0010 4

#GPIO2_4 GPIO2_5 GPIO2_6 DIR
himm 0x20170400 0x77

#UART1
himm 0x200F0050 1
himm 0x200F0058 1

#UART1_RTSN -> GPIO5_0
#UART1_RXD -> GPIO5_1
#UART1_TXD -> GPIO5_3
#GPIO
himm 0x200F004C 0
himm 0x200F0050 0
himm 0x200F0058 0
himm 0x201A0400 0xB

#UART3
himm 0x200f00b8 1
himm 0x200f00bc 1

echo 20480000 > /proc/sys/net/core/wmem_default
echo 40960000 > /proc/sys/net/core/wmem_max
sysctl -w net.ipv4.tcp_wmem="4096 16384 2080768"

ifconfig lo up

/tmp/nginx/sbin/nginx -p /tmp/nginx/

cd /tmp/
./reset &
./box
