| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (C) 2011 OpenWrt.org |
| 4 | # |
| 5 | |
| 6 | add_ubootenv() { |
| 7 | local dev=$1 |
| 8 | local offset=$2 |
| 9 | local envsize=$3 |
| 10 | local secsize=$4 |
| 11 | local numsec=$5 |
| 12 | uci batch <<EOF |
| 13 | add ubootenv ubootenv |
| 14 | set ubootenv.@ubootenv[-1].dev='$dev' |
| 15 | set ubootenv.@ubootenv[-1].offset='$offset' |
| 16 | set ubootenv.@ubootenv[-1].envsize='$envsize' |
| 17 | set ubootenv.@ubootenv[-1].secsize='$secsize' |
| 18 | set ubootenv.@ubootenv[-1].numsec='$numsec' |
| 19 | EOF |
| 20 | } |
| 21 | |
| 22 | [ -e /etc/config/ubootenv ] && exit 0 |
| 23 | |
| 24 | touch /etc/config/ubootenv |
| 25 | |
| 26 | . /lib/ar71xx.sh |
| 27 | |
| 28 | board=$(ar71xx_board_name) |
| 29 | |
| 30 | case "$board" in |
| 31 | all0258n) |
| 32 | add_ubootenv /dev/mtd1 0x0 0x10000 0x10000 |
| 33 | ;; |
| 34 | |
| 35 | esac |
| 36 | |
| 37 | uci commit ubootenv |
| 38 | |