diff options
author | Zoltan HERPAI <wigyori@uid0.hu> | 2013-11-14 23:12:52 +0000 |
---|---|---|
committer | Zoltan HERPAI <wigyori@uid0.hu> | 2013-11-14 23:12:52 +0000 |
commit | 448a6b8d51f92ff19995645ff99f7f49804482fc (patch) | |
tree | 76658ab5db8672127f7cb73adb2682a83e432727 /target/linux/sunxi/base-files/lib | |
parent | 4e381a077c60fb9518cc754c470094436f3f9c4d (diff) | |
download | upstream-448a6b8d51f92ff19995645ff99f7f49804482fc.tar.gz upstream-448a6b8d51f92ff19995645ff99f7f49804482fc.tar.bz2 upstream-448a6b8d51f92ff19995645ff99f7f49804482fc.zip |
sunxi: rework target
- update kernel to 3.12
- add patches for clocks, i2c, usb, sid, rtc
- support common image for A10/A13/A20
- add support for a couple boards
- most drivers are configured into the kernel as of now
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38811 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/sunxi/base-files/lib')
-rw-r--r-- | target/linux/sunxi/base-files/lib/preinit/01_preinit_sunxi.sh | 9 | ||||
-rw-r--r-- | target/linux/sunxi/base-files/lib/sunxi.sh | 45 |
2 files changed, 54 insertions, 0 deletions
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 0000000000..f221dbc582 --- /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/sunxi.sh b/target/linux/sunxi/base-files/lib/sunxi.sh new file mode 100644 index 0000000000..adf9f8462c --- /dev/null +++ b/target/linux/sunxi/base-files/lib/sunxi.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# defaults +SUNXI_BOARD_NAME="generic sunxi" +SUNXI_BOARD_MODEL="generic sunxi" +SUNXI_ENV_DEV=/dev/mmcblk0 + +#Helper functions +get_cmdline_opt() +{ +cat /proc/cmdline | awk -F$1= '{print $2}' | awk '{print $1}' +} + +#Since fw_getenv doesn't work with blockdevs let's make a hack +uboot_getenv() +{ + dd if=$SUNXI_ENV_DEV bs=1024 skip=544 count=128 2>dev/null |\strings|grep $1|cut -d"=" -f2 +} + +#Actual routines go below +sunxi_env_dev() +{ + local dev + dev=`get_cmdline_opt root|cut -d"p" -f1` + SUNXI_ENV_DEV=$dev + echo "probing $dev for uboot env data" +} + +sunxi_board_detect() { + local board + local model + sunxi_env_dev + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + board="`uboot_getenv wrt_board`" + model="`uboot_getenv wrt_model`" + 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" +} |