meson8, MXQ: add boot from usb support, configurable dtb

This commit is contained in:
Dominik Wójt
2024-11-11 16:30:30 +01:00
committed by Igor
parent 2bf71e2fda
commit a6fc0ab328
3 changed files with 24 additions and 5 deletions

View File

@@ -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"

View File

@@ -0,0 +1,3 @@
dtb_file=/dtb/meson8b-mxq.dtb
# The following contents are auto-generated.

View File

@@ -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