diff options
Diffstat (limited to 'target/linux/sunxi/base-files')
5 files changed, 213 insertions, 0 deletions
diff --git a/target/linux/sunxi/base-files/etc/inittab b/target/linux/sunxi/base-files/etc/inittab new file mode 100644 index 0000000..e9de30b --- /dev/null +++ b/target/linux/sunxi/base-files/etc/inittab @@ -0,0 +1,5 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +tts/0::askfirst:/bin/ash --login +ttyS0::askfirst:/bin/ash --login +tty1::askfirst:/bin/ash --login diff --git a/target/linux/sunxi/base-files/etc/uci-defaults/02_network b/target/linux/sunxi/base-files/etc/uci-defaults/02_network new file mode 100644 index 0000000..372fed9 --- /dev/null +++ b/target/linux/sunxi/base-files/etc/uci-defaults/02_network @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Copyright (C) 2013-2014 OpenWrt.org +# + +[ -e /etc/config/network ] && exit 0 + +touch /etc/config/network + +. /lib/sunxi.sh +. /lib/functions/uci-defaults.sh + +ucidef_set_interface_loopback + +case "$( sunxi_board_name )" in +"olinuxino-micro"*) + ucidef_set_interface_lan 'wlan0' + ;; +"lamobo-r1") + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + ucidef_add_switch "switch0" "1" "1" + ucidef_add_switch_vlan "switch0" "1" "4 0 1 2 8t" + ucidef_add_switch_vlan "switch0" "2" "3 8t" + ;; +*) + ucidef_set_interface_lan 'eth0' + ;; +esac + +uci commit network + +exit 0 diff --git a/target/linux/sunxi/base-files/lib/preinit/01_preinit_sunxi.sh b/target/linux/sunxi/base-files/lib/preinit/01_preinit_sunxi.sh new file mode 100644 index 0000000..f221dbc --- /dev/null +++ b/target/linux/sunxi/base-files/lib/preinit/01_preinit_sunxi.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +do_sunxi() { + . /lib/sunxi.sh + + sunxi_board_detect +} + +boot_hook_add preinit_main do_sunxi diff --git a/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh b/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh new file mode 100644 index 0000000..84070de --- /dev/null +++ b/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh @@ -0,0 +1,17 @@ +#!/bin/sh +. /lib/sunxi.sh + +do_b53_hack() { + # hack: enable switch on Lamobo R1 and reset counters + case "$( sunxi_board_name )" in + "lamobo-r1") + ifconfig eth0 up + sleep 1 + swconfig dev switch0 set reset 1 + swconfig dev switch0 set reset_mib 1 + swconfig dev switch0 set apply 1 + ;; + esac +} + +boot_hook_add preinit_main do_b53_hack diff --git a/target/linux/sunxi/base-files/lib/sunxi.sh b/target/linux/sunxi/base-files/lib/sunxi.sh new file mode 100644 index 0000000..ce1292b --- /dev/null +++ b/target/linux/sunxi/base-files/lib/sunxi.sh @@ -0,0 +1,150 @@ +#!/bin/sh + +# defaults +SUNXI_BOARD_NAME="generic" +SUNXI_BOARD_MODEL="Generic sunxi board" + +sunxi_board_detect() { + local board + local model + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + + model="$( cat /proc/device-tree/model )" + + case "$model" in + "Mele A1000") + board="a1000" + ;; + + "BA10 tvbox") + board="ba10-tvbox" + ;; + + "Cubietech Cubieboard") + board="cubieboard" + ;; + + "Miniand Hackberry") + board="hackberry" + ;; + + "INet-97F Rev 02") + board="inet97fv2" + ;; + + "PineRiver Mini X-Plus") + board="mini-xplus" + ;; + + "Olimex A10-OLinuXino-LIME") + board="olinuxino-lime" + ;; + + "LinkSprite pcDuino") + board="pcduino" + ;; + + "Olimex A10s-Olinuxino Micro") + board="olinuxino-micro" + ;; + + "R7 A10s hdmi tv-stick") + board="r7-tv-dongle" + ;; + + "HSG H702") + board="hsg-h702" + ;; + + "Olimex A13-Olinuxino") + board="olinuxino" + ;; + + "Olimex A13-Olinuxino Micro") + board="olinuxino-micro" + ;; + + "Allwinner A31 APP4 EVB1 Evaluation Board") + board="app4-evb1" + ;; + + "WITS A31 Colombus Evaluation Board") + board="colombus" + ;; + + "Merrii A31 Hummingbird") + board="hummingbird" + ;; + + "Mele M9 / A1000G Quad top set box") + board="m9" + ;; + + "LeMaker Banana Pi") + board="bananapi" + ;; + + "LeMaker Banana Pro") + board="bananapro" + ;; + + "Cubietech Cubieboard2") + board="cubieboard2" + ;; + + "Cubietech Cubietruck") + board="cubietruck" + ;; + + "Merrii A20 Hummingbird") + board="hummingbird" + ;; + + "I12 / Q5 / QT840A A20 tvbox") + board="i12-tvbox" + ;; + + "Lamobo R1") + board="lamobo-r1" + ;; + + "Olimex A20-OLinuXino-LIME") + board="olinuxino-lime" + ;; + + "Olimex A20-Olinuxino Micro") + board="olinuxino-a20-micro" + ;; + + "LinkSprite pcDuino3") + board="pcduino3" + ;; + + "Ippo Q8H Dual Core Tablet (v5)") + board="ippo-q8h-v5" + ;; + esac + + if [ "$board" != "" ]; then + SUNXI_BOARD_NAME="$board" + fi + + if [ "$model" != "" ]; then + SUNXI_BOARD_MODEL="$model" + fi + + + echo "$SUNXI_BOARD_NAME" > /tmp/sysinfo/board_name + echo "$SUNXI_BOARD_MODEL" > /tmp/sysinfo/model + echo "Detected $SUNXI_BOARD_NAME // $SUNXI_BOARD_MODEL" +} + +sunxi_board_name() { + local name + + [ -f /tmp/sysinfo/board_name ] && name="$(cat /tmp/sysinfo/board_name)" + [ -z "$name" ] && name="unknown" + + echo "$name" +} |