#
# Copyright (C) 2021 OpenWrt.org
#

[ -e /etc/config/ubootenv ] && exit 0

touch /etc/config/ubootenv

. /lib/uboot-envtools.sh
. /lib/functions.sh

board=$(board_name)

case "$board" in
bananapi,bpi-r2)
	. /lib/upgrade/common.sh
	export_bootdevice
	export_partdevice ubootpart 1
	ubootenv_add_uci_config "/dev/$ubootpart" "0xb0000" "0x10000" "0x10000" "1"
esac

config_load ubootenv
config_foreach ubootenv_add_app_config ubootenv

exit 0
