# Yocto-specifics
setenv bootpart 2
setenv bootdir /

setenv bootargs enable_wait_mode=off
setenv bootargs $bootargs ar1020_i2c.calibration=-17810,0,60214224,0,-22625,78839808,65536,768,1024
setenv nextcon 0;

if hdmidet ; then
	setenv bootargs $bootargs video=mxcfb${nextcon}:dev=hdmi,1280x720M@60,if=RGB24,bpp=32
	setenv fbmem "fbmem=28M";
	setexpr nextcon $nextcon + 1
else
	echo "------ no HDMI monitor";
fi

setenv bootargs $bootargs video=mxcfb${nextcon}:dev=ldb,LG-9.7,if=RGB666,bpp=32
if test "0" -eq $nextcon; then
	setenv fbmem "fbmem=10M";
else
	setenv fbmem ${fbmem},10M
fi
setexpr nextcon $nextcon + 1

while test "4" -ne $nextcon ; do
	setenv bootargs $bootargs video=mxcfb${nextcon}:off ;
	setexpr nextcon $nextcon + 1 ;
done

setenv bootargs $bootargs $fbmem
setenv bootargs "$bootargs console=ttymxc1,115200 vmalloc=400M consoleblank=0 rootwait"

if itest.s x$bootpart == x ; then
	bootpart=1
fi

setenv bootargs "$bootargs root=/dev/mmcblk0p$bootpart" ;

dtbname="imx6";
if itest.s x6S != "x$cpu" ; then
	dtbname=${dtbname}q-;
else
	dtbname=${dtbname}s-;
fi

if itest.s x == "x$board" ; then
	board=sabrelite
fi
dtbname=${dtbname}${board}.dtb;

if itest.s x == x${bootdir} ; then
	bootdir=/boot/
fi

if ${fs}load ${dtype} ${disk}:1 12000000 ${bootdir}$dtbname ; then
	havedtb=1;
else
	havedtb=
fi

if itest.s x == x$allow_noncea ; then
	setenv bootargs $bootargs mxc_hdmi.only_cea=1;
	echo "only CEA modes allowed on HDMI port";
else
        setenv bootargs $bootargs mxc_hdmi.only_cea=0;
        echo "non-CEA modes allowed on HDMI, audio may be affected";
fi

if kbd ; then
	if itest.s xB == x$keybd ; then
		if ${fs}load ${dtype} ${disk}:1 10800000 ${bootdir}uImage-usbwrite ; then
			if ${fs}load ${dtype} ${disk}:1 12800000 ${bootdir}uramdisk-usbwrite.img ; then
			   if itest.s x$havedtb == x ; then
					bootm 10800000 12800000 ;
			   else
					bootm 10800000 12800000 12000000 ;
			   fi
			fi
		fi
	fi
fi

if ${fs}load ${dtype} ${disk}:1 10800000 ${bootdir}uImage ; then
	if itest.s x$havedtb == x ; then
		bootm 10800000 ;
	else
		bootm 10800000 - 12000000
	fi
fi
echo "Error loading kernel image"
