# DO NOT EDIT THIS FILE
#
# Please edit /boot/armbianEnv.txt to set supported parameters
#

# default values
setenv rootdev "/dev/mmcblk0p1"
setenv rootfstype "ext4"
setenv verbosity "1"
setenv prefix "/boot/"
setenv boot_interface "mmc"
setenv ethaddr "00:50:43:84:fb:2f"
setenv eth1addr "00:50:43:25:fb:84"

# fdtfile should come from compile-time u-boot patches
if test -z "${fdtfile}"; then
	setenv fdtfile "armada-388-helios4.dtb"
fi

echo "Boot script loaded from ${boot_interface}"

if load ${boot_interface} 0:1 ${loadaddr} ${prefix}armbianEnv.txt; then
	env import -t ${loadaddr} ${filesize}
fi

setenv bootargs "console=ttyS0,115200 root=${rootdev} rootwait rootfstype=${rootfstype} ubootdev=${boot_interface} scandelay loglevel=${verbosity} usb-storage.quirks=${usbstoragequirks} ${extraargs}"

ext4load  ${boot_interface} 0:1 ${fdt_addr} ${prefix}dtb/${fdtfile}
ext4load  ${boot_interface} 0:1 ${ramdisk_addr_r} ${prefix}uInitrd
ext4load  ${boot_interface} 0:1 ${kernel_addr_r} ${prefix}zImage

setenv fdt_high 0xffffffff
setenv initrd_high 0xffffffff

fdt addr ${fdt_addr}
fdt resize

# Update device tree node
fdt set /soc/internal-regs/sata@e0000 status "disabled"
fdt set /soc/internal-regs/sata@a8000 status "disabled"
fdt set /soc/spi@10680 status "okay"
fdt set /soc/spi@10680/spi-flash@0 status "okay"

bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr}

# Recompile with:
# mkimage -C none -A arm -T script -d boot_spi_en.cmd /boot_spi_en.scr
