#!/bin/sh

BOOT_REASON_RELOAD=1

#
# List all firmware/image that needs auto-upgrade
#

# Update PHY firmware (if needed)
/usr/bin/updt_util phyfw
if [ $? -eq 1 ]; then
    /sbin/reboot -r "$BOOT_REASON_RELOAD: Reload for new PHY Firmware"
fi

#
# List all u-boot env auto-update
#

# $1 - env
# $2 - value
update_uboot_env() {
    local UBOOT_ENV=`/usr/bin/shared_printenv $1 | sed "s/^${1}=//g"`

    if [ "$UBOOT_ENV" != "$2" ]; then
        /usr/bin/shared_setenv $1 $2
    fi
}

update_uboot_env fdt_high 0x2000000
