#!/bin/sh
#    Copyright (c) 1996-2011 Brocade Communications Systems, Inc.
#    All rights reserved.
#
#    Description:
#      restore to single partition boot mode

Linux_Load_Addr="0x78000000"
fslHV_Load_Addr="0x2000000"
HVdtb_Load_Addr="0x3000000"
HWdtb_Load_Addr="0x4000000"

if hashow | grep "Dual Partitions" 2>/dev/null; then
    if [ "`cat /proc/device-tree/label 2>/dev/null`" = "p1-linux" ]; then
	echo "single partition boot mode"
	/sbin/bootenv hvcmd "makesinrec 0x79fff000;ext2load usb 0:\$prt $HWdtb_Load_Addr boot/silkworm.dtb;ext2load usb 0:\$prt $fslHV_Load_Addr boot/hv.uImage;ext2load usb 0:\$prt $HVdtb_Load_Addr boot/silkworm_hct.dtb;bootm $fslHV_Load_Addr - $HWdtb_Load_Addr"
/sbin/bootenv hvcmd_fast "makesinrec 0x79fff000;ext2load usb 0:\$prt 1000 /boot/fastloading.mdt; usb fastload 1000;bootm $fslHV_Load_Addr - $HWdtb_Load_Addr"

    else
	echo "set partition 2 in non-boot mode"
	bootenv -v goscmd true
    fi
fi

exit 0
