blob: 7a0507ae6bd27ac705722d4ddeaa1d9885b5f4ea [file] [log] [blame]
#!/bin/sh
#
# Copyright (C) 2011-2012 OpenWrt.org
#
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
block_dev_path() {
local dev_path
case "$1" in
/dev/mmcblk*)
dev_path="$1"
;;
PARTLABEL=* | PARTUUID=*)
dev_path=$(blkid -t "$1" -o device)
[ -z "${dev_path}" -o $? -ne 0 ] && return 1
;;
*)
return 1;
;;
esac
echo "${dev_path}"
return 0
}
board=$(board_name)
case "$board" in
mediatek,*-emmc-rfb)
env_dev=$(cat /sys/module/boot_param/parameters/env_part 2>/dev/null)
[ -n "$env_dev" ] && env_dev=$(block_dev_path "${env_dev}")
[ -z "$env_dev" ] && env_dev=$(block_dev_path "PARTLABEL=u-boot-env")
[ -n "$env_dev" ] && \
ubootenv_add_uci_config "$env_dev" "0" "0x80000"
;;
esac
config_load ubootenv
config_foreach ubootenv_add_app_config ubootenv
exit 0