diff --git a/config/boards/aml-s805-mxq.tvb b/config/boards/aml-s805-mxq.tvb index 6a1557968..5ff0ed54c 100644 --- a/config/boards/aml-s805-mxq.tvb +++ b/config/boards/aml-s805-mxq.tvb @@ -8,6 +8,7 @@ BOOTCONFIG="none" BOOTSCRIPT="boot-aml-s805-mxq.cmd:boot.cmd" # The preinstalled U-BOOT looks for this script BOOTSCRIPT_OUTPUT="s805_autoscript" +BOOTENV_FILE="aml-s805-mxq.txt" BOOTSIZE="200" BOOTFS_TYPE="fat" diff --git a/config/bootenv/aml-s805-mxq.txt b/config/bootenv/aml-s805-mxq.txt new file mode 100644 index 000000000..b7edee36c --- /dev/null +++ b/config/bootenv/aml-s805-mxq.txt @@ -0,0 +1,3 @@ +dtb_file=/dtb/meson8b-mxq.dtb + +# The following contents are auto-generated. diff --git a/config/bootscripts/boot-aml-s805-mxq.cmd b/config/bootscripts/boot-aml-s805-mxq.cmd index da48b5d5f..2ad46d2e4 100644 --- a/config/bootscripts/boot-aml-s805-mxq.cmd +++ b/config/bootscripts/boot-aml-s805-mxq.cmd @@ -1,5 +1,7 @@ -# TODO: extract dtb file name to config script -# TODO: support for boot from usb +# DO NOT EDIT THIS FILE +# +# Please edit /boot/armbianEnv.txt to set supported parameters +# setenv rootdev "LABEL=armbi_root" setenv rootfstype "ext4" @@ -13,6 +15,19 @@ setenv verbosity "1" # 1 = enabled setenv usb_autosuspend "0" +# Find the bootdev +# Same order is followed as in factory U-BOOT, when searching for this script, +# so same device should be found. +# We can't use `test -z` due to the bug: https://lists.denx.de/pipermail/u-boot/2005-August/011447.html +env set bootdev "" +if test -n "${bootdev}"; test $? != 0; then if fatload usb 0 11000000 s805_autoscript; then env set bootdev "usb 0"; fi; fi; +if test -n "${bootdev}"; test $? != 0; then if fatload usb 1 11000000 s805_autoscript; then env set bootdev "usb 1"; fi; fi; +if test -n "${bootdev}"; test $? != 0; then if fatload usb 2 11000000 s805_autoscript; then env set bootdev "usb 2"; fi; fi; +if test -n "${bootdev}"; test $? != 0; then if fatload usb 3 11000000 s805_autoscript; then env set bootdev "usb 3"; fi; fi; +if test -n "${bootdev}"; test $? != 0; then if fatload mmc 0 11000000 s805_autoscript; then env set bootdev "mmc 0"; fi; fi; + +fatload ${bootdev} 0x20800000 /armbianEnv.txt && env import -t 0x20800000 ${filesize} + ########################################### if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyAML0,115200n8 ${consoleargs}"; fi @@ -23,8 +38,8 @@ if test "${usb_autosuspend}" = "0"; then setenv extraargs "usbcore.autosuspend=- setenv bootargs "root=${rootdev} rootwait rw ${consoleargs} rootfstype=${rootfstype} loglevel=${verbosity} ${extraargs}" # Booting -fatload mmc 0:1 0x20800000 uImage -fatload mmc 0:1 0x22000000 uInitrd -fatload mmc 0:1 0x21800000 dtb/meson8b-mxq.dtb +fatload "${bootdev}" 0x20800000 /uImage +fatload "${bootdev}" 0x22000000 /uInitrd +fatload "${bootdev}" 0x21800000 "${dtb_file}" bootm 0x20800000 0x22000000 0x21800000