1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 11:36:52 +00:00
This commit is contained in:
mvoelkel
2015-08-05 18:52:25 +02:00
commit 68a450d10a
43 changed files with 6239 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
#!/bin/sh
case "$1" in
start)
if [ -e /config/boot.id ]; then
echo -n `(cat /config/boot.id; echo " 1 + p") | dc` > /config/boot.id
else
echo -n "0" > /config/boot.id
fi
esac

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
echo "64" > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio64/direction
cat /sys/class/gpio/gpio64/value
key=`cat /sys/class/gpio/gpio64/value`
if [ $key -eq 0 ]; then
rm /boot/uImage
#mv /config/rootfs.tar.bz2 /config/rootfs2.tar.bz2
rm /config/*.img
reboot
fi

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,122 @@
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_KERNEL_LZO=y
# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_LOG_BUF_SHIFT=15
CONFIG_BLK_DEV_INITRD=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_EMBEDDED=y
CONFIG_PERF_EVENTS=y
CONFIG_SLAB=y
CONFIG_MODULES=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_PARTITION_ADVANCED=y
# CONFIG_EFI_PARTITION is not set
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
CONFIG_ARCH_AT91=y
CONFIG_ARCH_AT91SAM9G45=y
CONFIG_MACH_OCTONET=y
CONFIG_AEABI=y
# CONFIG_COMPACTION is not set
CONFIG_CMDLINE="console=ttyS0,115200"
CONFIG_CMDLINE_FORCE=y
CONFIG_CPU_IDLE=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_LRO is not set
# CONFIG_INET_DIAG is not set
CONFIG_IPV6=y
CONFIG_NETFILTER=y
CONFIG_VLAN_8021Q=y
# CONFIG_WIRELESS is not set
CONFIG_UEVENT_HELPER_PATH="/sbin/mdev"
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_STANDALONE is not set
CONFIG_MTD=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_ECC_BCH=y
CONFIG_MTD_NAND_ATMEL=y
CONFIG_MTD_UBI=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
# CONFIG_SCSI_LOWLEVEL is not set
CONFIG_NETDEVICES=y
# CONFIG_NET_VENDOR_ARC is not set
CONFIG_MACB=y
# CONFIG_NET_VENDOR_BROADCOM is not set
# CONFIG_NET_VENDOR_CIRRUS is not set
# CONFIG_NET_VENDOR_FARADAY is not set
# CONFIG_NET_VENDOR_HISILICON is not set
# CONFIG_NET_VENDOR_INTEL is not set
# CONFIG_NET_VENDOR_MARVELL is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
# CONFIG_NET_VENDOR_SAMSUNG is not set
# CONFIG_NET_VENDOR_SEEQ is not set
# CONFIG_NET_VENDOR_SMSC is not set
# CONFIG_NET_VENDOR_STMICRO is not set
# CONFIG_NET_VENDOR_VIA is not set
# CONFIG_NET_VENDOR_WIZNET is not set
CONFIG_DAVICOM_PHY=m
# CONFIG_USB_NET_DRIVERS is not set
# CONFIG_WLAN is not set
# CONFIG_INPUT_MOUSEDEV is not set
CONFIG_INPUT_EVDEV=y
# CONFIG_KEYBOARD_ATKBD is not set
CONFIG_KEYBOARD_GPIO=y
# CONFIG_INPUT_MOUSE is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_ATMEL=y
CONFIG_SERIAL_ATMEL_CONSOLE=y
CONFIG_HW_RANDOM=y
CONFIG_GPIO_SYSFS=y
# CONFIG_HWMON is not set
# CONFIG_HID is not set
# CONFIG_USB_HID is not set
CONFIG_USB=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_STORAGE=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT91RM9200=y
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_CONFIGFS_FS=m
CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_CODEPAGE_850=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_ISO8859_15=y
CONFIG_PRINTK_TIME=y
CONFIG_STRIP_ASM_SYMS=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_KGDB=y
CONFIG_CRYPTO_MANAGER=y
# CONFIG_CRYPTO_ANSI_CPRNG is not set
# CONFIG_CRYPTO_HW is not set
CONFIG_CRC_CCITT=m
CONFIG_XZ_DEC=y

View File

@@ -0,0 +1,4 @@
LINUX_OVERRIDE_SRCDIR = ../linux.octonet
LINUX_HEADERS_OVERRIDE_SRCDIR = ../linux.octonet
#OCTOSERVE_OVERRIDE_SRCDIR = ../octoserve

View File

@@ -0,0 +1,44 @@
#!/bin/sh
case "$1" in
start)
sleep 3
if ! ubiattach -p /dev/mtd2; then
ubiformat /dev/mtd2 -e 0; ubiattach -p /dev/mtd2
else
ubirmvol /dev/ubi0 -N rootfs
fi
if ! [ -e /dev/ubi0_0 ]; then ubimkvol /dev/ubi0 -s 64MiB -N config; fi
if ! [ -e /dev/ubi0_1 ]; then ubimkvol /dev/ubi0 -s 128MiB -N rootfs; fi
mkdir /config
mount -t ubifs /dev/ubi0_0 /config
img=`ls /config/octonet.*.img`
if [ "$img" = "" ]; then
sleep 5
if [ -e /dev/sda1 ]; then
mount /dev/sda1 /mnt
cp /mnt/octonet.*.img /config
umount /mnt
fi
fi
img=`ls /config/octonet.*.img`
if [ "$img" = "" ]; then
udhcpc
sleep 3
nimage=`wget http://download.digital-devices.de/download/linux/octonet/ -q -O -|grep img|sort|tail -n 1| cut -d\" -f 2`
wget -P /config http://download.digital-devices.de/download/linux/octonet/$nimage
fi
mount -t ubifs /dev/ubi0_1 /mnt
rm -rf /mnt/*
tar -x -C /mnt -f /config/octonet.*.img
umount /mnt
umount /config
reboot
;;
esac

View File

@@ -0,0 +1,2 @@
#!/bin/sh
/etc/init.d/S99octo stopoctoserve

View File

@@ -0,0 +1,3 @@
#!/bin/sh
/usr/bin/lua /etc/switch/swsetup.lua gb yb
/sbin/poweroff

View File

@@ -0,0 +1,2 @@
#!/bin/sh
/etc/init.d/S99octo startoctoserve

View File

@@ -0,0 +1,3 @@
PWRF power
PAUSE pause
WAKE wake

View File

@@ -0,0 +1,3 @@
EV_KEY 0x01 KEY_POWER 116 1 button/power PWRF 00000080 00000000
EV_KEY 0x01 KEY_PAUSE 119 1 button/pause PAUSE 00000080 00000000
EV_KEY 0x01 KEY_PAUSE 119 0 button/wake WAKE 00000080 00000000

View File

@@ -0,0 +1,2 @@
/dev/mtd0 0xa0000 0x20000 0x20000 1
/dev/mtd0 0xc0000 0x20000 0x20000 1

View File

@@ -0,0 +1,6 @@
recover if gpio input 64; then nand erase 2000000 e000000; fi
fallback nand read 72000000 100000 600000; bootm
ubiboot ubi part ubi && ubifsmount rootfs && ubifsload 72000000 /boot/uImage && bootm
nandboot dcache on; run recover; run ubiboot; run fallback
mtdids nand0=nand_mtd
mtdparts mtdparts=nand_mtd:0x2000000@0x000000(boot),0xe000000@0x2000000(ubi)

View File

@@ -0,0 +1,50 @@
#
# httpd.conf - BusyBox v1.20
#
# H:/serverroot # define the server root. It will override -h
# A:172.20. # Allow address from 172.20.0.0/16
# A:10.0.0.0/25 # Allow any address from 10.0.0.0-10.0.0.127
# A:10.0.0.0/255.255.255.128 # Allow any address that previous set
# A:127.0.0.1 # Allow local loopback connections
# D:* # Deny from other IP connections
# E404:/path/e404.html # /path/e404.html is the 404 (not found) error page
# I:index.html # Show index.html when a directory is requested
#
# P:/url:[http://]hostname[:port]/new/path
# # When /urlXXXXXX is requested, reverse proxy
# # it to http://hostname[:port]/new/pathXXXXXX
#
# /cgi-bin:foo:bar # Require user foo, pwd bar on urls starting with /cgi-bin/
# /adm:admin:setup # Require user admin, pwd setup on urls starting with /adm/
# /adm:toor:PaSsWd # or user toor, pwd PaSsWd on urls starting with /adm/
# /adm:root:* # or user root, pwd from /etc/passwd on urls starting with /adm/
# /wiki:*:* # or any user from /etc/passwd with according pwd on urls starting with /wiki/
# .au:audio/basic # additional mime type for audio.au files
# *.php:/path/php # run xxx.php through an interpreter
#
# A/D may be as a/d or allow/deny - only first char matters.
# Deny/Allow IP logic:
# - Default is to allow all (Allow all (A:*) is a no-op).
# - Deny rules take precedence over allow rules.
# - "Deny all" rule (D:*) is applied last.
#
# Example:
# 1. Allow only specified addresses
# A:172.20 # Allow any address that begins with 172.20.
# A:10.10. # Allow any address that begins with 10.10.
# A:127.0.0.1 # Allow local loopback connections
# D:* # Deny from other IP connections
#
# 2. Only deny specified addresses
# D:1.2.3. # deny from 1.2.3.0 - 1.2.3.255
# D:2.3.4. # deny from 2.3.4.0 - 2.3.4.255
# A:* # (optional line added for clarity)
.js:application/x-javascript
*.lua:/usr/bin/lua
E404:/var/www/e404.html
P:/octoserve/:http://127.0.0.1:8888/
#P:/OS_:http://127.0.0.1:8888/
#/:admin:$1$YVE./jwF$HQo.Ijo0i8RuJ4M3D8aDP/

View File

@@ -0,0 +1,15 @@
#!/bin/sh
case "$1" in
start)
modprobe octonet
lua /etc/switch/swsetup.lua
;;
stop)
;;
restart|reload)
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@@ -0,0 +1,14 @@
#!/bin/sh
case "$1" in
start)
/sbin/acpid -a /etc/acpid.conf -M /etc/acpid.map
;;
stop)
;;
restart|reload)
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@@ -0,0 +1,29 @@
#!/bin/sh
case "$1" in
start)
if [ -e /config/static.ip ]; then
/etc/init.d/S99octo stopoctoserve
. /config/static.ip
ifconfig eth0 $IP $NETMASK
route add default gw $GATEWAY
/etc/init.d/S99octo startoctoserve
else
udhcpc -s /etc/network/udhcpc.script -b -T 4 -A 300
fi
export LUA_PATH="/var/channels/?.lua;;"
httpd -h /var/www -c /etc/httpd.conf
;;
stop)
killall udhcpc
killall zcip
killall httpd
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@@ -0,0 +1,20 @@
#!/bin/sh
case "$1" in
start)
if [ -e /config/telnet.enabled ]; then
telnetd -l /bin/login
fi
;;
stop)
killall telnetd
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@@ -0,0 +1,22 @@
#!/bin/sh
case "$1" in
start)
# if [ -e /config/dms.enabled ]; then
cd /var/dms
export LUA_PATH="/var/channels/?.lua;;"
./dms.lua >/dev/null 2>&1 &
# fi
;;
stop)
killall dms.lua
sleep 2
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@@ -0,0 +1,20 @@
#!/bin/sh
case "$1" in
start)
export LUA_PATH="/var/channels/?.lua;;"
cd /var/mcsetup
./mcsetup.lua server>/dev/null 2>&1 &
;;
stop)
killall mcsetup.lua
sleep 2
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@@ -0,0 +1,36 @@
#!/bin/sh
case "$1" in
start)
;;
stop)
"$0" stopoctoserve
"$0" stopoctonet
;;
startoctonet)
modprobe octonet
;;
stopoctonet)
rmmod -w octonet
;;
restartoctonet)
"$0" stopoctoserve
"$0" stopoctonet
"$0" startoctonet
"$0" startoctoserve
;;
startoctoserve)
octoserve > /dev/null 2>&1 &
;;
stopoctoserve)
killall octoserve
sleep 2
;;
restartoctoserve)
"$0" stopoctoserve
"$0" startoctoserve
;;
*)
echo "Usage: $0 {start|stop|restart|restartoctoserve}"
exit 1
esac

View File

@@ -0,0 +1,7 @@
#!/bin/sh
case "$1" in
start)
/usr/bin/ddflash
;;
esac

View File

@@ -0,0 +1,62 @@
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
# zcip integration idea from here: http://osdir.com/ml/network.zeroconf.workers/2005-06/msg00000.html
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
/usr/bin/logger "udhcpc_action $interface $1 ip=$ip"
do_config() {
killall zcip > /dev/null
/sbin/ifconfig $interface $ip $NETMASK
while route del default gw 0.0.0.0 dev $interface ; do
:
done
if [ -n "$router" ] ; then
metric=0
for i in $router ; do
route add default gw $i dev $interface metric $metric
metric=$metric+1
done
else
route add default dev $interface
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
}
case "$1" in
deconfig)
killall zcip > /dev/null
/sbin/ifconfig $interface 0.0.0.0
;;
fail|leasefail)
(ps | grep zcip | grep -q -v grep) || /sbin/zcip -v $interface /etc/network/zcip.script > /dev/null &
;;
bound)
/etc/init.d/S99octo stopoctoserve
do_config
/etc/init.d/S99octo startoctoserve
;;
renew)
do_config
;;
esac
exit 0

View File

@@ -0,0 +1,39 @@
#!/bin/sh
# only for use as a "zcip" callback script
if [ "x$interface" = x ]
then
exit 1
fi
# zcip should start on boot/resume and various media changes
case "$1" in
init)
# for now, zcip requires the link to be already up,
# and it drops links when they go down. that isn't
# the most robust model...
exit 0
;;
config)
if [ "x$ip" = x ]
then
exit 1
fi
echo $ip > /config/zcip.ip
/etc/init.d/S99octo stopoctoserve
/sbin/ifconfig $interface $ip
/sbin/route add default dev $interface
/etc/init.d/S99octo startoctoserve
exit 0
;;
deconfig)
if [ x$ip = x ]
then
exit 1
fi
/sbin/ifconfig $interface 0.0.0.0
#exec ip address del dev $interface local $ip
;;
esac
exit 1

View File

@@ -0,0 +1,106 @@
#!/usr/bin/lua
function WriteSwitch(addr,reg,value)
os.execute(string.format("ddtest mdio %02X %02X %04X",addr,reg,value))
end
function ReadSwitch(addr,reg)
local ddtest = io.popen(string.format("ddtest mdio %02X %02X",addr,reg),"r")
local ddo = ddtest:read()
ddtest:close()
return tonumber(ddo,16)
end
function WaitSwitch(addr,reg)
local s
repeat
s = ReadSwitch(addr,reg)
if not s then break end
until s < 32768
end
function GetSernbr()
local ddtest = io.popen("ddtest mem c 4","r")
local ddo = ddtest:read()
ddtest:close()
local snr = string.sub(ddo,14,15)..string.sub(ddo,17,18)..string.sub(ddo,20,21)
return tonumber(snr,16)/2
end
local mclist = {}
table.insert(mclist,"224.0.0.1")
table.insert(mclist,"224.0.0.2")
table.insert(mclist,"224.0.0.22")
table.insert(mclist,"239.255.255.250")
local tmp
tmp = ReadSwitch(16,0)
if arg[1] then
local i
for i = 1, #arg, 1 do
if arg[i] == "goff" then
WriteSwitch(16,22,37102)
WaitSwitch(16,22)
end
if arg[i] == "gon" then
WriteSwitch(16,22,37103)
WaitSwitch(16,22)
end
if arg[i] == "gb" then
WriteSwitch(16,22,57380)
WaitSwitch(16,22)
WriteSwitch(16,22,37101)
WaitSwitch(16,22)
end
if arg[i] == "yoff" then
WriteSwitch(18,22,37102)
WaitSwitch(18,22)
end
if arg[i] == "yon" then
WriteSwitch(18,22,37103)
WaitSwitch(18,22)
end
if arg[i] == "yb" then
WriteSwitch(18,22,57380)
WaitSwitch(18,22)
WriteSwitch(18,22,37101)
WaitSwitch(18,22)
end
end
else
WriteSwitch(16,22,37103)
WaitSwitch(16,22)
WriteSwitch(18,22,37102)
WaitSwitch(18,22)
if GetSernbr() < 2300 then
WriteSwitch(16,22,32786)
WriteSwitch(17,22,32786)
WriteSwitch(18,22,32786)
WriteSwitch(19,22,32786)
WriteSwitch(20,22,32786)
else
WriteSwitch(16,22,32819)
WriteSwitch(17,22,32819)
WriteSwitch(18,22,32819)
WriteSwitch(19,22,32819)
WriteSwitch(20,22,32819)
end
WriteSwitch(22, 7,40961)
WriteSwitch(22, 4, 95)
for _,addr in ipairs(mclist) do
local b1,b2,b3,b4 = string.match(addr,"(%d+)%.(%d+)%.(%d+)%.(%d+)")
b2 = tonumber(b2)
b3 = tonumber(b3)
b4 = tonumber(b4)
if b2 > 127 then b2 = b2 - 128 end
WriteSwitch(27, 12, 1015)
WriteSwitch(27, 13, 256)
WriteSwitch(27, 14, 24064 + b2)
WriteSwitch(27, 15, b3 * 256 + b4)
WriteSwitch(27, 11, 45056)
WaitSwitch(27, 11)
end
WriteSwitch(28, 5, 5367)
WriteSwitch(21, 4, 119)
end

View File

@@ -0,0 +1,5 @@
TARGETDIR=$1
grep -q config $TARGETDIR/etc/fstab || echo -e "/dev/ubi0_0\t\t/config\tubifs\tdefaults\t0\t0" >> $TARGETDIR/etc/fstab
grep -q pts $TARGETDIR/etc/securetty || echo -e "pts/0\npts/1\npts/2\npts/3" >> $TARGETDIR/etc/securetty