'VÇ¾`¢iù  Ý         ½à                                   Õ    # Bootscript for Check Point V-80 (eMMC/USB/SD)
setenv ow_root "INIT-02"

# ROOT is "eMMC"
if test "${ow_root}" = "eMMC-02"; then
	mmc read ${fdt_addr_r} ${prim_dtb_dest_mmc_blk} ${dtb_partition_block_count}
	mmc read ${kernel_addr_r} 0x5004 ${kernel_partition_block_count}

	setenv ow_root "/dev/mmcblk1p3"
# ROOT is other value (USB/SD)
else
	# ROOT is "INIT", try USB storage (initramfs)
	if test "${ow_root}" = "INIT-02"; then
		setenv devtype usb
		setenv ow_root
	else
		# try USB storage
		part uuid usb 0:2 uuid
		if test -n "${uuid}" -a "${uuid}" = "${ow_root}"; then
			setenv devtype usb
		fi

		set uuid
		# try SD card
		test -z "${devtype}" && part uuid mmc 0:2 uuid
		if test -n "${uuid}" -a "${uuid}" = "${ow_root}"; then
			setenv devtype mmc
		fi

		if test -z "${devtype}"; then
			echo "Cannot find any boot device!"
			exit
		fi

		setenv ow_root "PARTUUID=${ow_root}"
	fi

	load ${devtype} 0:1 ${fdt_addr_r} armada-8040-v-81.dtb
	load ${devtype} 0:1 ${kernel_addr_r} Image
fi

# remove "quiet" option from bootargs
setenv cp_quiet
# set bootargs with "blkdevparts" option
run set_bootargs_vx

test -n "${ow_root}" && setenv bootargs "${bootargs} root=${ow_root} rw rootwait"

booti ${kernel_addr_r} - ${fdt_addr_r}
